Instructions to use ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16") model = AutoModelForCausalLM.from_pretrained("ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16") 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 ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16
- SGLang
How to use ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16 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 "ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16" \ --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": "ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16", "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 "ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16" \ --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": "ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16 with Docker Model Runner:
docker model run hf.co/ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16
~8 tok/sec with ~5k context on vLLM with Flash Attention and `kv_cache_dtype="fp8"` on 3090TI 24GB VRAM
The AQLM format seems quite promising to fit that sweet sweet Q8_0 performance onto a home desktop rig. Still experimenting and setup a demo repo that might help folks get something up and running quickly (possibly on Windows with Docker [untested still]) https://github.com/ubergarm/vLLM-inference-AQLM/
Is there a .json file available to feed vLLM for the quantization_param_path="somefile.json"? Not exactly sure if it would help, but experimenting with setting kv_cache_dtype="fp8" seems to fit a little more context before OOMing...
Will be interesting to see the adoption of AQLM and what models with larger base contexts are quantized in the near future given the fairly hefty quantization demands.
Exciting stuff! Thanks for sharing!
The quantization params are in config.json right here and both transformers and vLLM support it out of the box without any additional configs.
We have put out small demo for vLLM. The link is in the GitHub repo readme. From my own tests, context up to 3000 tokens (without fp8) works with this model on RTX3090.
llm = LLM(
model="ISTA-DASLab/Meta-Llama-3-70B-Instruct-AQLM-2Bit-1x16",
enforce_eager=True,
gpu_memory_utilization=0.99,
max_model_len=3000,
)
Ahh thanks for pointing that out. Yes, I got your small demo working locally with 5k context using "fp8" just for testing, but likely won't bother for actual use:
WARNING 05-06 22:48:50 model_runner.py:211] KV cache scaling factors provided, but the KV cache data type is not FP8. KV cache scaling factors will not be used.
Looking into the evaluation stuff now, thanks for releasing this models in this interesting AQLM quant!