Instructions to use gradientai/Llama-3-8B-Instruct-262k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gradientai/Llama-3-8B-Instruct-262k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="gradientai/Llama-3-8B-Instruct-262k") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("gradientai/Llama-3-8B-Instruct-262k") model = AutoModelForCausalLM.from_pretrained("gradientai/Llama-3-8B-Instruct-262k") 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use gradientai/Llama-3-8B-Instruct-262k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gradientai/Llama-3-8B-Instruct-262k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gradientai/Llama-3-8B-Instruct-262k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/gradientai/Llama-3-8B-Instruct-262k
- SGLang
How to use gradientai/Llama-3-8B-Instruct-262k 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 "gradientai/Llama-3-8B-Instruct-262k" \ --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": "gradientai/Llama-3-8B-Instruct-262k", "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 "gradientai/Llama-3-8B-Instruct-262k" \ --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": "gradientai/Llama-3-8B-Instruct-262k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use gradientai/Llama-3-8B-Instruct-262k with Docker Model Runner:
docker model run hf.co/gradientai/Llama-3-8B-Instruct-262k
Uploading EXL2 quants
Amazing @bullerwins . Just curious:
- How did you quantize them / which scripts?
- which UI / Inference engine are you using for the exl2 quants and local inference?
Amazing @bullerwins . Just curious:
- How did you quantize them / which scripts?
- which UI / Inference engine are you using for the exl2 quants and local inference?
I'm using Turboderp's exllamav2 https://github.com/turboderp/exllamav2
Script:
python3 convert.py -i gradientai_Llama-3-8B-Instruct-262k/ -o /temp/ -cf gradientai_Llama-3-8B-Instruct-262k_exl2_5.0bpw/ -b 5.0
I'm testing it using Oobabooga's Textgen webui for inference: https://github.com/oobabooga/text-generation-webui
@bullerwins Working on a revised version (with better chat alignment). Would you be up for creating quants? Id be linking them in the readme again
Also: We released the better alignment for 70-B.
https://huggingface.co/gradientai/Llama-3-70B-Instruct-Gradient-262k
@bullerwins We just upgraded the weights, you should see a drastic improvment over the previous iteration.
Working on the upgraded 8B weights exl2 quants as well as 70B with better alignment
Exl2 quants for today's (4th of May 2024) updated weights:
I called them v2 for clarity
8.0bpw https://huggingface.co/bullerwins/gradientai_Llama-3-8B-Instruct-262k_v2_exl2_8.0bpw
6.0bpw https://huggingface.co/bullerwins/gradientai_Llama-3-8B-Instruct-262k_v2_exl2_6.0bpw
5.0bpw https://huggingface.co/bullerwins/gradientai_Llama-3-8B-Instruct-262k_v2_exl2_5.0bpw
Opening a PR for the readme