Instructions to use fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym
- SGLang
How to use fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym 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 "fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym with Docker Model Runner:
docker model run hf.co/fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym
Use Docker
docker model run hf.co/fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-symModel Information
Quantized version of meta-llama/Llama-3.2-3B-Instruct using torch.float32 for quantization tuning.
- 4 bits (INT4)
- group size = 128
- Symmetrical Quantization
- Algorith method: TEQ (Trainable Equivalent Transformation for Quantization of LLMs)
Quantization framework: Intel Neural Compressor version 3.3.1
Note: this INT4 version of Llama-3.2-3B-Instruct has been quantized to run inference through CPU.
Disclaimer
This quantized model comes with no warrenty. It has been developed experimetally only for research purposes.
This repository only contains contains two files: quantized_model.pt (weights structure) and qconfig.json, and the generated model is a quantized model. It needs to be used in combination with the base model meta-llama/Llama-3.2-3B-Instruct.
Replication Recipe
$ conda create --name neural-compressor-3.3.1 --file requirements_conda_neural-compressor-3.3.1
$ python meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym.py
Run Inference
To run inference you can use fbaldassarri/woq-inference.
python teq_inference.py --base meta-llama/Llama-3.2-3B-Instruct --model_dir ./meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym --weights_file quantized_weight.pt --config_file qconfig.json --prompt "What If you have got superpowers?" --device cpu
Note: You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
License
Model tree for fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym
Base model
meta-llama/Llama-3.2-3B-Instruct
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fbaldassarri/meta-llama_Llama-3.2-3B-Instruct-TEQ-int4-gs128-sym", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'