Edit model card

Meta-Llama-3-8B-GGUF

Model Details

  • Meta developed and released the Meta Llama 3 family of large language models (LLMs) based on the Transformer architecture.
  • Model Architecture: Transformer-based with 8.5 billion parameters.
  • GGUF Quantization: Currently only availabel in f_16, Q8_0 version.

About GGUF

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.

Intended Use

  • This model is intended for research and experimentation in understanding and advancing language model capabilities.
  • Sample Use Cases:
    • Text generation of various kinds (creative, factual, etc.)
    • Summarization
    • Question-answering

Performance & Limitations

  • Performance Metrics: Report speed improvements, performance changes compared to the original model.
  • Limitations: May still generate unsafe or biased outputs, use with caution. Performance changes compared to the original due to quantization.

How to Use

  1. Load the model and tokenizer:
##### 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,
)

Prompt Template

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|>"""

Please test the model out

Downloads last month
30
GGUF
Model size
8.03B params
Architecture
llama
Inference Examples
Inference API (serverless) has been turned off for this model.

Model tree for Orneyfish/Meta-Llama-3-8B_F_16.gguf

Quantized
(229)
this model