Instructions to use relaxml/Llama-2-7b-chat-E8PRVQ-3Bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use relaxml/Llama-2-7b-chat-E8PRVQ-3Bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="relaxml/Llama-2-7b-chat-E8PRVQ-3Bit") 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("relaxml/Llama-2-7b-chat-E8PRVQ-3Bit") model = AutoModelForCausalLM.from_pretrained("relaxml/Llama-2-7b-chat-E8PRVQ-3Bit", 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 relaxml/Llama-2-7b-chat-E8PRVQ-3Bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "relaxml/Llama-2-7b-chat-E8PRVQ-3Bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "relaxml/Llama-2-7b-chat-E8PRVQ-3Bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/relaxml/Llama-2-7b-chat-E8PRVQ-3Bit
- SGLang
How to use relaxml/Llama-2-7b-chat-E8PRVQ-3Bit 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 "relaxml/Llama-2-7b-chat-E8PRVQ-3Bit" \ --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": "relaxml/Llama-2-7b-chat-E8PRVQ-3Bit", "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 "relaxml/Llama-2-7b-chat-E8PRVQ-3Bit" \ --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": "relaxml/Llama-2-7b-chat-E8PRVQ-3Bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use relaxml/Llama-2-7b-chat-E8PRVQ-3Bit with Docker Model Runner:
docker model run hf.co/relaxml/Llama-2-7b-chat-E8PRVQ-3Bit
Upload folder using huggingface_hub
#2
by at676 - opened
- config.json +2 -1
- generation_config.json +1 -1
- model.safetensors +1 -1
config.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
| 4 |
"LlamaForCausalLM"
|
| 5 |
],
|
| 6 |
"attention_bias": false,
|
|
|
|
| 7 |
"bos_token_id": 1,
|
| 8 |
"eos_token_id": 2,
|
| 9 |
"hidden_act": "silu",
|
|
@@ -34,7 +35,7 @@
|
|
| 34 |
"rope_theta": 10000.0,
|
| 35 |
"tie_word_embeddings": false,
|
| 36 |
"torch_dtype": "float16",
|
| 37 |
-
"transformers_version": "4.
|
| 38 |
"use_cache": true,
|
| 39 |
"vocab_size": 32000
|
| 40 |
}
|
|
|
|
| 4 |
"LlamaForCausalLM"
|
| 5 |
],
|
| 6 |
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
"bos_token_id": 1,
|
| 9 |
"eos_token_id": 2,
|
| 10 |
"hidden_act": "silu",
|
|
|
|
| 35 |
"rope_theta": 10000.0,
|
| 36 |
"tie_word_embeddings": false,
|
| 37 |
"torch_dtype": "float16",
|
| 38 |
+
"transformers_version": "4.36.2",
|
| 39 |
"use_cache": true,
|
| 40 |
"vocab_size": 32000
|
| 41 |
}
|
generation_config.json
CHANGED
|
@@ -6,5 +6,5 @@
|
|
| 6 |
"pad_token_id": 0,
|
| 7 |
"temperature": 0.6,
|
| 8 |
"top_p": 0.9,
|
| 9 |
-
"transformers_version": "4.
|
| 10 |
}
|
|
|
|
| 6 |
"pad_token_id": 0,
|
| 7 |
"temperature": 0.6,
|
| 8 |
"top_p": 0.9,
|
| 9 |
+
"transformers_version": "4.36.2"
|
| 10 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2957619856
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:431b584b3fc0f509775349e02316a1b8d59f012b5f00e8c9e7ffec657913c755
|
| 3 |
size 2957619856
|