Downloads · 30 days
114
8% of all-time downloads
Orneyfish/Meta-Llama-3-8B_F_16.gguf
Meta-Llama-3-8B_F_16.gguf is a text generation model from Orneyfish. Use it when you need the model to write or continue text. The card lists the license as other.
- This is a GGUF quantized version of Meta-Llama-3-8B.
Downloads · 30 days
114
8% of all-time downloads
All-time downloads
1.4K
Public
Repo size
24.6 GB
Likes
0
Public
Click a slice to open those files.
.gguf24.6 GB · 100%
From the Hugging Face model README
GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp. GGUF offers numerous advantages over GGML, such as better tokenisation, and support for special tokens. It is also supports metadata, and is designed to be extensible.
Here is an incomplate list of clients and libraries that are known to support GGUF:
llama.cpp. The source project for GGUF. Offers a CLI and a server option. text-generation-webui, the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration. KoboldCpp, a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling. LM Studio, an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration. LoLLMS Web UI, a great web UI with many interesting and unique features, including a full model library for easy model selection. Faraday.dev, an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration. ctransformers, a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server. llama-cpp-python, a Python library with GPU accel, LangChain support, and OpenAI-compatible API server. candle, a Rust ML framework with a focus on performance, including GPU support, and ease of use.
##### Llama3 Inference #############
from huggingface_hub import hf_hub_download
import time
from llama_cpp.llama import Llama, LlamaGrammar
import httpx
import json
import torch
import multiprocessing as mp
number_of_cpu = mp.cpu_count()
grammar_text = httpx.get("https://raw.githubusercontent.com/ggerganov/llama.cpp/master/grammars/json.gbnf").text
grammar = LlamaGrammar.from_string(grammar_text)
model_name_or_path = "Orneyfish/Meta-Llama-3-8B_F_16.gguf"
model_basename = "Meta-Llama-3-8B_F_16.gguf" # the model is in bin format
model_path = hf_hub_download(repo_id=model_name_or_path, filename=model_basename, local_dir='models/')
from langchain import PromptTemplate, LLMChain
from langchain.callbacks.manager import CallbackManager
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
# Callbacks support token-wise streaming
callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
# Verbose is required to pass to the callback manager
n_gpu_layers = 40 # Change this value based on your model and your GPU VRAM pool.
n_batch = 1024 # Should be between 1 and n_ctx, consider the amount of VRAM in your GPU.
# Loading model,
llm = Llama(
model_path=model_path,
n_threads=number_of_cpu,
n_gpu_layers=n_gpu_layers,
n_batch=n_batch,
n_threads_batch = 512,
# use_mlock =True,
callback_manager=callback_manager,
verbose=True,
n_ctx=8196, # Context window
stop = ['USER:'], # Dynamic stopping when such token is detected.
temperature = 0.2,
# use_mmap = False,
)
1. System prompt message added to a single user message
prompt = """<|begin_of_text|><|start_header_id|>system<|end_header_id|>
{{ system_prompt }}<|eot_id|><|start_header_id|>user<|end_header_id|>
{{ user_message }}<|eot_id|><|start_header_id|>assistant<|end_header_id|>"""
2. System prompt and multiple turn conversation between the user and assistant
prompt = """<|begin_of_text|><|start_header_id|>system<|end_header_id|>
{{ system_prompt }}<|eot_id|><|start_header_id|>user<|end_header_id|>
{{ user_message_1 }}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
{{ model_answer_1 }}<|eot_id|><|start_header_id|>user<|end_header_id|>
{{ user_message_2 }}<|eot_id|><|start_header_id|>assistant<|end_header_id|>"""