Text Generation
Transformers
Safetensors
llama
gptq
4bit
int4
gptqmodel
modelcloud
llama-3.1
8b
instruct
conversational
text-generation-inference
4-bit precision
Instructions to use ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit") model = AutoModelForCausalLM.from_pretrained("ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit
- SGLang
How to use ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit 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 "ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit" \ --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": "ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit", "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 "ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit" \ --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": "ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit with Docker Model Runner:
docker model run hf.co/ModelCloud/Meta-Llama-3.1-8B-Instruct-gptq-4bit
Upload folder using huggingface_hub
#7
by lrl-modelcloud - opened
- config.json +4 -3
- model.safetensors +1 -1
- quantize_config.json +2 -2
config.json
CHANGED
|
@@ -21,16 +21,17 @@
|
|
| 21 |
"num_attention_heads": 32,
|
| 22 |
"num_hidden_layers": 32,
|
| 23 |
"num_key_value_heads": 8,
|
|
|
|
| 24 |
"pretraining_tp": 1,
|
| 25 |
"quantization_config": {
|
| 26 |
"bits": 4,
|
| 27 |
"checkpoint_format": "gptq",
|
| 28 |
"damp_percent": 0.005,
|
| 29 |
-
"desc_act":
|
| 30 |
"group_size": 128,
|
| 31 |
"lm_head": false,
|
| 32 |
"meta": {
|
| 33 |
-
"quantizer": "gptqmodel:0.9.
|
| 34 |
},
|
| 35 |
"model_file_base_name": null,
|
| 36 |
"model_name_or_path": null,
|
|
@@ -53,4 +54,4 @@
|
|
| 53 |
"transformers_version": "4.44.0.dev0",
|
| 54 |
"use_cache": true,
|
| 55 |
"vocab_size": 128256
|
| 56 |
-
}
|
|
|
|
| 21 |
"num_attention_heads": 32,
|
| 22 |
"num_hidden_layers": 32,
|
| 23 |
"num_key_value_heads": 8,
|
| 24 |
+
"pad_token_id": 128004,
|
| 25 |
"pretraining_tp": 1,
|
| 26 |
"quantization_config": {
|
| 27 |
"bits": 4,
|
| 28 |
"checkpoint_format": "gptq",
|
| 29 |
"damp_percent": 0.005,
|
| 30 |
+
"desc_act": false,
|
| 31 |
"group_size": 128,
|
| 32 |
"lm_head": false,
|
| 33 |
"meta": {
|
| 34 |
+
"quantizer": "gptqmodel:0.9.10-dev0"
|
| 35 |
},
|
| 36 |
"model_file_base_name": null,
|
| 37 |
"model_name_or_path": null,
|
|
|
|
| 54 |
"transformers_version": "4.44.0.dev0",
|
| 55 |
"use_cache": true,
|
| 56 |
"vocab_size": 128256
|
| 57 |
+
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5732943672
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:22ead7ca212f7be98881c8842ae9146e7362ecbbcc2ae69ff1f6a19a802972de
|
| 3 |
size 5732943672
|
quantize_config.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"bits": 4,
|
| 3 |
"group_size": 128,
|
| 4 |
-
"desc_act":
|
| 5 |
"static_groups": false,
|
| 6 |
"sym": true,
|
| 7 |
"lm_head": false,
|
|
@@ -12,6 +12,6 @@
|
|
| 12 |
"quant_method": "gptq",
|
| 13 |
"checkpoint_format": "gptq",
|
| 14 |
"meta": {
|
| 15 |
-
"quantizer": "gptqmodel:0.9.
|
| 16 |
}
|
| 17 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"bits": 4,
|
| 3 |
"group_size": 128,
|
| 4 |
+
"desc_act": false,
|
| 5 |
"static_groups": false,
|
| 6 |
"sym": true,
|
| 7 |
"lm_head": false,
|
|
|
|
| 12 |
"quant_method": "gptq",
|
| 13 |
"checkpoint_format": "gptq",
|
| 14 |
"meta": {
|
| 15 |
+
"quantizer": "gptqmodel:0.9.10-dev0"
|
| 16 |
}
|
| 17 |
}
|