Instructions to use casperhansen/llama-3-70b-instruct-awq with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use casperhansen/llama-3-70b-instruct-awq with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="casperhansen/llama-3-70b-instruct-awq") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("casperhansen/llama-3-70b-instruct-awq") model = AutoModelForCausalLM.from_pretrained("casperhansen/llama-3-70b-instruct-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
- vLLM
How to use casperhansen/llama-3-70b-instruct-awq with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "casperhansen/llama-3-70b-instruct-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": "casperhansen/llama-3-70b-instruct-awq", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/casperhansen/llama-3-70b-instruct-awq
- SGLang
How to use casperhansen/llama-3-70b-instruct-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 "casperhansen/llama-3-70b-instruct-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": "casperhansen/llama-3-70b-instruct-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 "casperhansen/llama-3-70b-instruct-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": "casperhansen/llama-3-70b-instruct-awq", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use casperhansen/llama-3-70b-instruct-awq with Docker Model Runner:
docker model run hf.co/casperhansen/llama-3-70b-instruct-awq
encountered error when loading model
vllm 0.3.1
ValueError: Couldn't instantiate the backend tokenizer from one of:
(1) a tokenizers library serialization file,
(2) a slow tokenizer instance to convert or
(3) an equivalent slow tokenizer class to instantiate and convert.
You need to have sentencepiece installed to convert a slow tokenizer to a fast one.
need 0.4.1
but 0.4.1 is not out yet? only 0.4.0.post1?
need 0.4.1
It does seem to run on v0.4.0.post1, as the generation_config.json has the updated eos_token, see https://github.com/vllm-project/vllm/issues/4180#issuecomment-2066187578
Some versions of vLLM have issues with quantized models. v0.4.0.post1 is the latest that I have confirmed to work personally.
I've just built a docker image for the latest vLLM (for their dev version, so it is v0.4.1.dev, see https://hub.docker.com/r/aiappsref/vllm/tags) and I have just tested it with this quantized model and it seems to be working.
It actually works better than v0.4.0.post1, as that was not finishing its response at the EOS but kept going (that was a known bug fixed in v0.4.1)
I still have it on 0.4.1