Instructions to use TheBloke/zephyr-7B-beta-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheBloke/zephyr-7B-beta-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TheBloke/zephyr-7B-beta-AWQ") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TheBloke/zephyr-7B-beta-AWQ") model = AutoModelForCausalLM.from_pretrained("TheBloke/zephyr-7B-beta-AWQ") 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 TheBloke/zephyr-7B-beta-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheBloke/zephyr-7B-beta-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/zephyr-7B-beta-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TheBloke/zephyr-7B-beta-AWQ
- SGLang
How to use TheBloke/zephyr-7B-beta-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/zephyr-7B-beta-AWQ" \ --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": "TheBloke/zephyr-7B-beta-AWQ", "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 "TheBloke/zephyr-7B-beta-AWQ" \ --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": "TheBloke/zephyr-7B-beta-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TheBloke/zephyr-7B-beta-AWQ with Docker Model Runner:
docker model run hf.co/TheBloke/zephyr-7B-beta-AWQ
Is there a way to finetune these AWQ beasts?
Apparently there is no way to finetune this AWQ beauty and it's for inference only?
Correct, I'm not aware of support for training on AWQ models at this time. For training with quantization your options are BitsandBytes (ie qLoRA), or GPTQ. For training I recommend the Axolotl training framework, which supports both qLoRA and training of GPTQ models.
Now that Transformers supports AWQ, it's theoretically possible that PEFT training support could come in the future.
Tagging @casperhansen (author of AutoAWQ) and @ybelkada (Hugging Face staff, responsible for the Transformers AWQ and GPTQ integration) to make them aware of this request.
Generally, if you are on a tight budget, I would recommend to train quantized models with QLoRA, merge the adapter to base model, then quantize to your preferred quant, e.g. AWQ.
AWQ is not compatible with PEFT yet, and I am not deep enough into the subject of training with quantized models to tell you if AWQ would be better than GPTQ in that scenario.
Indeed I second what @casperhansen said, the recommended workflow is
1- Fine-tune the base model using QLoRA on your target domain
2- Further quantize it with AWQ / GPTQ using tools such as autoawq
3- Deploy the AWQ/GPTQ for faster inference
You can read more about it here: https://huggingface.co/blog/overview-quantization-transformers
@casperhansen I'm looking forward to the day when AWQ and PEFT play nicely together. I'm currently creating several GPTQ-LoRA adapters, one for each of my tasks. That way, I can keep just one GPTQ base model in VRAM at all times and then enable one adapter at a time, depending on where I am in my pipeline. Obviously, I would prefer to be doing this with the superior AWQ method. π