Text Generation
Transformers
ONNX
English
llama
facebook
meta
llama-2
ONNX
DirectML
DML
conversational
ONNXRuntime
custom_code
Instructions to use EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml
- SGLang
How to use EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml 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 "EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml" \ --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": "EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml", "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 "EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml" \ --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": "EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml with Docker Model Runner:
docker model run hf.co/EmbeddedLLM/llama-2-13b-chat-int4-onnx-directml
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- genai_config.json +54 -0
- model.onnx +3 -0
- model.onnx.data +3 -0
- special_tokens_map.json +23 -0
- tokenizer.json +0 -0
- tokenizer_config.json +41 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
model.onnx.data filter=lfs diff=lfs merge=lfs -text
|
genai_config.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": {
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"context_length": 4096,
|
| 5 |
+
"decoder": {
|
| 6 |
+
"session_options": {
|
| 7 |
+
"log_id": "onnxruntime-genai",
|
| 8 |
+
"provider_options": [
|
| 9 |
+
{
|
| 10 |
+
"dml": {}
|
| 11 |
+
}
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
"filename": "model.onnx",
|
| 15 |
+
"head_size": 128,
|
| 16 |
+
"hidden_size": 5120,
|
| 17 |
+
"inputs": {
|
| 18 |
+
"input_ids": "input_ids",
|
| 19 |
+
"attention_mask": "attention_mask",
|
| 20 |
+
"position_ids": "position_ids",
|
| 21 |
+
"past_key_names": "past_key_values.%d.key",
|
| 22 |
+
"past_value_names": "past_key_values.%d.value"
|
| 23 |
+
},
|
| 24 |
+
"outputs": {
|
| 25 |
+
"logits": "logits",
|
| 26 |
+
"present_key_names": "present.%d.key",
|
| 27 |
+
"present_value_names": "present.%d.value"
|
| 28 |
+
},
|
| 29 |
+
"num_attention_heads": 40,
|
| 30 |
+
"num_hidden_layers": 40,
|
| 31 |
+
"num_key_value_heads": 40
|
| 32 |
+
},
|
| 33 |
+
"eos_token_id": 2,
|
| 34 |
+
"pad_token_id": 0,
|
| 35 |
+
"type": "llama",
|
| 36 |
+
"vocab_size": 32000
|
| 37 |
+
},
|
| 38 |
+
"search": {
|
| 39 |
+
"diversity_penalty": 0.0,
|
| 40 |
+
"do_sample": true,
|
| 41 |
+
"early_stopping": true,
|
| 42 |
+
"length_penalty": 1.0,
|
| 43 |
+
"max_length": 4096,
|
| 44 |
+
"min_length": 0,
|
| 45 |
+
"no_repeat_ngram_size": 0,
|
| 46 |
+
"num_beams": 1,
|
| 47 |
+
"num_return_sequences": 1,
|
| 48 |
+
"past_present_share_buffer": true,
|
| 49 |
+
"repetition_penalty": 1.0,
|
| 50 |
+
"temperature": 0.6,
|
| 51 |
+
"top_k": 1,
|
| 52 |
+
"top_p": 0.9
|
| 53 |
+
}
|
| 54 |
+
}
|
model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:72e9189e3b8d77602943d82413ad7a106d1ef21d929a59dfe33cb55daf273f27
|
| 3 |
+
size 343788
|
model.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ca6950764c48bfd31e8d911f7857bec3802f8b845b50bec1e3b7240a7312ff69
|
| 3 |
+
size 7558588416
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"unk_token": {
|
| 17 |
+
"content": "<unk>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
}
|
| 23 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"0": {
|
| 6 |
+
"content": "<unk>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"1": {
|
| 14 |
+
"content": "<s>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"2": {
|
| 22 |
+
"content": "</s>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"bos_token": "<s>",
|
| 31 |
+
"clean_up_tokenization_spaces": false,
|
| 32 |
+
"eos_token": "</s>",
|
| 33 |
+
"legacy": false,
|
| 34 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 35 |
+
"pad_token": null,
|
| 36 |
+
"padding_side": "right",
|
| 37 |
+
"sp_model_kwargs": {},
|
| 38 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 39 |
+
"unk_token": "<unk>",
|
| 40 |
+
"use_default_system_prompt": false
|
| 41 |
+
}
|