Text Generation
Transformers
Safetensors
llama
conversational
text-generation-inference
8-bit precision
compressed-tensors
Instructions to use nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2") model = AutoModelForCausalLM.from_pretrained("nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2
- SGLang
How to use nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2 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 "nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2" \ --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": "nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2", "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 "nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2" \ --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": "nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2 with Docker Model Runner:
docker model run hf.co/nm-testing/tinyllama-oneshot-w8a8-dynamic-token-v2
Upload folder using huggingface_hub
Browse files- config.json +75 -0
- generation_config.json +7 -0
- model.safetensors +3 -0
- recipe.yaml +10 -0
- special_tokens_map.json +24 -0
- tokenizer.json +0 -0
- tokenizer_config.json +42 -0
config.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "/root/.cache/huggingface/hub/models--TinyLlama--TinyLlama-1.1B-intermediate-step-1431k-3T/snapshots/036fa4651240b9a1487f709833b9e4b96b4c1574",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"LlamaForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"bos_token_id": 1,
|
| 9 |
+
"compression_config": {
|
| 10 |
+
"quantization_config": {
|
| 11 |
+
"config_groups": {
|
| 12 |
+
"group_0": {
|
| 13 |
+
"input_activations": {
|
| 14 |
+
"block_structure": null,
|
| 15 |
+
"dynamic": true,
|
| 16 |
+
"group_size": null,
|
| 17 |
+
"num_bits": 8,
|
| 18 |
+
"observer": "memoryless",
|
| 19 |
+
"observer_kwargs": {},
|
| 20 |
+
"strategy": "token",
|
| 21 |
+
"symmetric": true,
|
| 22 |
+
"type": "int"
|
| 23 |
+
},
|
| 24 |
+
"output_activations": null,
|
| 25 |
+
"targets": [
|
| 26 |
+
"Linear"
|
| 27 |
+
],
|
| 28 |
+
"weights": {
|
| 29 |
+
"block_structure": null,
|
| 30 |
+
"dynamic": false,
|
| 31 |
+
"group_size": null,
|
| 32 |
+
"num_bits": 8,
|
| 33 |
+
"observer": "minmax",
|
| 34 |
+
"observer_kwargs": {},
|
| 35 |
+
"strategy": "tensor",
|
| 36 |
+
"symmetric": true,
|
| 37 |
+
"type": "int"
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
},
|
| 41 |
+
"format": "int-quantized",
|
| 42 |
+
"global_compression_ratio": 1.2391304140415598,
|
| 43 |
+
"ignore": [
|
| 44 |
+
"lm_head"
|
| 45 |
+
],
|
| 46 |
+
"quant_method": "sparseml",
|
| 47 |
+
"quantization_status": "frozen"
|
| 48 |
+
},
|
| 49 |
+
"sparsity_config": {
|
| 50 |
+
"format": "dense",
|
| 51 |
+
"global_sparsity": 7.819320427273134,
|
| 52 |
+
"registry_requires_subclass": false,
|
| 53 |
+
"sparsity_structure": "unstructured"
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"eos_token_id": 2,
|
| 57 |
+
"hidden_act": "silu",
|
| 58 |
+
"hidden_size": 2048,
|
| 59 |
+
"initializer_range": 0.02,
|
| 60 |
+
"intermediate_size": 5632,
|
| 61 |
+
"max_position_embeddings": 2048,
|
| 62 |
+
"model_type": "llama",
|
| 63 |
+
"num_attention_heads": 32,
|
| 64 |
+
"num_hidden_layers": 22,
|
| 65 |
+
"num_key_value_heads": 4,
|
| 66 |
+
"pretraining_tp": 1,
|
| 67 |
+
"rms_norm_eps": 1e-05,
|
| 68 |
+
"rope_scaling": null,
|
| 69 |
+
"rope_theta": 10000.0,
|
| 70 |
+
"tie_word_embeddings": false,
|
| 71 |
+
"torch_dtype": "bfloat16",
|
| 72 |
+
"transformers_version": "4.40.0",
|
| 73 |
+
"use_cache": true,
|
| 74 |
+
"vocab_size": 32000
|
| 75 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 1,
|
| 3 |
+
"eos_token_id": 2,
|
| 4 |
+
"max_length": 2048,
|
| 5 |
+
"pad_token_id": 0,
|
| 6 |
+
"transformers_version": "4.40.0"
|
| 7 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:416a7f8569151f839a863e5d4a8424f784e97dcdf77fd074aabdf46b61c10cd9
|
| 3 |
+
size 1231252556
|
recipe.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
quant_stage:
|
| 2 |
+
quant_modifiers:
|
| 3 |
+
GPTQModifier:
|
| 4 |
+
sequential_update: false
|
| 5 |
+
ignore: [lm_head]
|
| 6 |
+
config_groups:
|
| 7 |
+
group_0:
|
| 8 |
+
weights: {num_bits: 8, type: int, symmetric: true, strategy: tensor}
|
| 9 |
+
input_activations: {num_bits: 8, type: int, symmetric: true, dynamic: true, strategy: token}
|
| 10 |
+
targets: [Linear]
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"pad_token": "</s>",
|
| 17 |
+
"unk_token": {
|
| 18 |
+
"content": "<unk>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"chat_template": "{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ '<|user|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'system' %}\n{{ '<|system|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'assistant' %}\n{{ '<|assistant|>\n' + message['content'] + eos_token }}\n{% endif %}\n{% if loop.last and add_generation_prompt %}\n{{ '<|assistant|>' }}\n{% endif %}\n{% endfor %}",
|
| 32 |
+
"clean_up_tokenization_spaces": false,
|
| 33 |
+
"eos_token": "</s>",
|
| 34 |
+
"legacy": false,
|
| 35 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 36 |
+
"pad_token": "</s>",
|
| 37 |
+
"padding_side": "right",
|
| 38 |
+
"sp_model_kwargs": {},
|
| 39 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 40 |
+
"unk_token": "<unk>",
|
| 41 |
+
"use_default_system_prompt": false
|
| 42 |
+
}
|