Instructions to use dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq
- SGLang
How to use dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq 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 "dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq" \ --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": "dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq", "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 "dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq" \ --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": "dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq with Docker Model Runner:
docker model run hf.co/dropbox-dash/Llama-3-8b-instruct_2bitgs64_hqq
Update README.md
Browse files
README.md
CHANGED
|
@@ -58,17 +58,22 @@ from hqq.core.quantize import *
|
|
| 58 |
from hqq.utils.patching import *
|
| 59 |
from hqq.utils.generation_hf import HFGenerator
|
| 60 |
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
#Load the model
|
| 64 |
###################################################
|
| 65 |
model_id = 'mobiuslabsgmbh/Llama-3-8b-instruct_2bitgs64_hqq'
|
| 66 |
-
model = AutoHQQHFModel.from_quantized(model_id, cache_dir=
|
| 67 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 68 |
|
| 69 |
#Use optimized inference kernels
|
| 70 |
###################################################
|
| 71 |
-
prepare_for_inference(model, backend=backend
|
| 72 |
|
| 73 |
#Generate
|
| 74 |
###################################################
|
|
|
|
| 58 |
from hqq.utils.patching import *
|
| 59 |
from hqq.utils.generation_hf import HFGenerator
|
| 60 |
|
| 61 |
+
#Settings
|
| 62 |
+
###################################################
|
| 63 |
+
backend = "bitblas" #bitblas or gemlite for 2-bit runtime
|
| 64 |
+
compute_dtype = torch.bfloat16 if backend=="torchao_int4" else torch.float16
|
| 65 |
+
device = 'cuda:0'
|
| 66 |
+
cache_dir = '.'
|
| 67 |
|
| 68 |
#Load the model
|
| 69 |
###################################################
|
| 70 |
model_id = 'mobiuslabsgmbh/Llama-3-8b-instruct_2bitgs64_hqq'
|
| 71 |
+
model = AutoHQQHFModel.from_quantized(model_id, cache_dir=cache_dir, compute_dtype=compute_dtype, device=device, adapter='adapter_v0.1.lora').eval();
|
| 72 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, cache_dir=cache_dir)
|
| 73 |
|
| 74 |
#Use optimized inference kernels
|
| 75 |
###################################################
|
| 76 |
+
prepare_for_inference(model, backend=backend) #It takes a while...
|
| 77 |
|
| 78 |
#Generate
|
| 79 |
###################################################
|