Instructions to use yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit") model = AutoModelForCausalLM.from_pretrained("yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit
- SGLang
How to use yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit with Docker Model Runner:
docker model run hf.co/yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit
Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit
This repository contains a W2A16 OmniQuant checkpoint derived from
meta-llama/Meta-Llama-3.1-8B-Instruct.
Quantization configuration
- Method: OmniQuant
- Weight precision: 2-bit
- Activation precision: 16-bit
- Group size: 128
- Optimization epochs: 40
- Learnable weight clipping (LWC): enabled
- Learnable equivalent transformation (LET): disabled
- Calibration dataset: C4 English validation split
- Calibration samples: 128
- Calibration sequence length: 512
- Calibration seed: 42
Evaluation
| Dataset | Split | Sequence length | Perplexity |
|---|---|---|---|
| WikiText2 | test | 2048 | 671.2557 |
The evaluation used the full tokenized WikiText2 test corpus with non-overlapping 2048-token windows.
Checkpoint format
This follows OmniQuant's fake-quantized Hugging Face save path. It is not a packed low-bit runtime checkpoint, so its storage and loading memory can remain close to FP16 despite representing W2A16 quantized weights.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto",
)
Transformers may report unused weight_quantizer.scales and
weight_quantizer.zeros entries when loading. The fake-quantized model weights
still load through the standard Transformers path used for the reported PPL.
License
Use of this checkpoint is subject to the license and terms of the base model.
- Downloads last month
- 52
Model tree for yw223/Meta-Llama-3.1-8B-Instruct-OmniQuant-2bit
Base model
meta-llama/Llama-3.1-8B