Instructions to use TheBloke/LLaMA-7b-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheBloke/LLaMA-7b-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TheBloke/LLaMA-7b-AWQ")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TheBloke/LLaMA-7b-AWQ") model = AutoModelForCausalLM.from_pretrained("TheBloke/LLaMA-7b-AWQ") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TheBloke/LLaMA-7b-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheBloke/LLaMA-7b-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/LLaMA-7b-AWQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TheBloke/LLaMA-7b-AWQ
- SGLang
How to use TheBloke/LLaMA-7b-AWQ 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 "TheBloke/LLaMA-7b-AWQ" \ --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": "TheBloke/LLaMA-7b-AWQ", "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 "TheBloke/LLaMA-7b-AWQ" \ --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": "TheBloke/LLaMA-7b-AWQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TheBloke/LLaMA-7b-AWQ with Docker Model Runner:
docker model run hf.co/TheBloke/LLaMA-7b-AWQ
Confusion about size on disk
What is the reason the params is stored in float16 and int32 in the .safetensors file?
Why it is not another format such as int4 to shrink the size on disk by a factor of 4-8 times
@laiviet Its stored in 4bit? The original model file is slightly over 13gb(https://huggingface.co/huggyllama/llama-7b/tree/main)
This quantized version is less then 4gb.
@YaTharThShaRma999
here is the data I loaded from the .safetensor
Total params: 1,128,828,928
Total bytes: 3,889,307,648
A linear layer weight (4096, 4096) is decomposed into these, which scale down significantly in size.
They are all stored as either I32 (int32) or F16 (fp16)
model.layers.0.self_attn.v_proj.qweight [4096, 512] I32
model.layers.0.self_attn.v_proj.qzeros [32, 512] I32
model.layers.0.self_attn.v_proj.scales [32, 4096] F16
My hypothesis is that the safetensor doesn't have int format, so they save it has I32 each I32 can store 8 I4 params
So actually
model.layers.0.self_attn.v_proj.qweight [4096, 512] in I32 is [4096, 4096] in I4
model.layers.0.self_attn.v_proj.qzeros [32, 512] in I32 is [32, 4096] in I4