Instructions to use TheBloke/law-LLM-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheBloke/law-LLM-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TheBloke/law-LLM-AWQ", device_map="auto")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TheBloke/law-LLM-AWQ") model = AutoModelForCausalLM.from_pretrained("TheBloke/law-LLM-AWQ", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TheBloke/law-LLM-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheBloke/law-LLM-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/law-LLM-AWQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TheBloke/law-LLM-AWQ
- SGLang
How to use TheBloke/law-LLM-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/law-LLM-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/law-LLM-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/law-LLM-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/law-LLM-AWQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TheBloke/law-LLM-AWQ with Docker Model Runner:
docker model run hf.co/TheBloke/law-LLM-AWQ
Error quantizing AWQ?
@TheBloke I want a guide via AWQ quantization, I’m having issues quantizing AutoAWQForCausalLM from my code, and the issues is:
ValueError: WQLinear_GEMM(in_features=14336, out_features=4096, bias=False, w_bit=4, group_size=128) does not have a parameter or a buffer named weight.
This is the code:
!pip install --upgrade transformers
from awq import AutoAWQForCausalLM
from transformers import AutoTokenizer
import torch
import safetensors
import os
#Rexe/Faradaylab-aria-mistral-merge
model_path = 'Faradaylab/ARIA-7B-V3-mistral-french-v1'
quant_name = model_path.split('/')[-1] + '-AWQ'
quant_path = 'Rexe/' + quant_name
quant_config = { 'zero_point': True, 'q_group_size': 128, 'w_bit': 4 }
load model
model = AutoAWQForCausalLM.from_quantized(model_path, device_map='auto', use_safetensors=True, strict=False)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True, use_fast=True)
Quantize
model.quantize(tokenizer, quant_config=quant_config)
save quantized model
model.save_quantized(quant_name, safetensors=True, shard_size='10GB')
tokenizer.save_pretrained(quant_name)