Upload sharded model (9x2GB shards, continuous batching, neuronxcc 2.21)
Browse files- .gitattributes +1 -0
- README.md +134 -0
- added_tokens.json +28 -0
- config.json +69 -0
- merges.txt +0 -0
- model.shard0000.pt +3 -0
- model.shard0001.pt +3 -0
- model.shard0002.pt +3 -0
- model.shard0003.pt +3 -0
- model.shard0004.pt +3 -0
- model.shard0005.pt +3 -0
- model.shard0006.pt +3 -0
- model.shard0007.pt +3 -0
- model.shard0008.pt +3 -0
- model.shards.json +62 -0
- neuron_config.json +43 -0
- reconstruct.py +60 -0
- special_tokens_map.json +31 -0
- tokenizer.json +3 -0
- tokenizer_config.json +247 -0
- vocab.json +0 -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 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
tags:
|
| 7 |
+
- chess
|
| 8 |
+
- neuron
|
| 9 |
+
- aws-trainium
|
| 10 |
+
- vllm
|
| 11 |
+
- optimum-neuron
|
| 12 |
+
- continuous-batching
|
| 13 |
+
- sharded
|
| 14 |
+
base_model: karanps/ChessLM_Qwen3
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# ChessLM Qwen3 - Neuron Traced (Sharded Model)
|
| 18 |
+
|
| 19 |
+
This is a **sharded version** of the Neuron-traced [karanps/ChessLM_Qwen3](https://huggingface.co/karanps/ChessLM_Qwen3) optimized for AWS Trainium (trn1) and Inferentia (inf2) instances using vLLM with **continuous batching enabled**.
|
| 20 |
+
|
| 21 |
+
The model.pt file (16.4GB) has been split into **9 shards** of ~2GB each for easier downloading and storage.
|
| 22 |
+
|
| 23 |
+
## Model Details
|
| 24 |
+
|
| 25 |
+
- **Base Model**: Qwen3-2B fine-tuned for chess
|
| 26 |
+
- **Compilation**: optimum-neuron[vllm]==0.3.0
|
| 27 |
+
- **Compiler Version**: neuronxcc 2.21.33363.0
|
| 28 |
+
- **Target Hardware**: AWS Trainium (trn1) / Inferentia (inf2)
|
| 29 |
+
- **Precision**: BF16
|
| 30 |
+
- **Tensor Parallelism**: 2 cores
|
| 31 |
+
- **Batch Size**: 4 (continuous batching enabled)
|
| 32 |
+
- **Max Sequence Length**: 2048
|
| 33 |
+
- **Model Format**: Sharded (9 parts)
|
| 34 |
+
|
| 35 |
+
## Files
|
| 36 |
+
|
| 37 |
+
### Model Shards
|
| 38 |
+
- `model.shard0000.pt` through `model.shard0007.pt`: 2GB each
|
| 39 |
+
- `model.shard0008.pt`: 799MB (final shard)
|
| 40 |
+
- `model.shards.json`: Metadata with SHA256 hashes for verification
|
| 41 |
+
- `reconstruct.py`: Script to reconstruct the original model.pt
|
| 42 |
+
|
| 43 |
+
### Configuration Files
|
| 44 |
+
- `config.json`: Model configuration
|
| 45 |
+
- `neuron_config.json`: Neuron compilation settings
|
| 46 |
+
- Tokenizer files: `tokenizer.json`, `vocab.json`, `merges.txt`, etc.
|
| 47 |
+
|
| 48 |
+
## Usage
|
| 49 |
+
|
| 50 |
+
### Option 1: Reconstruct the Full Model
|
| 51 |
+
|
| 52 |
+
If you need the complete `model.pt` file:
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
# Clone the repository
|
| 56 |
+
git clone https://huggingface.co/kunhunjon/ChessLM_Qwen3_Trainium_Sharded
|
| 57 |
+
cd ChessLM_Qwen3_Trainium_Sharded
|
| 58 |
+
|
| 59 |
+
# Reconstruct the original model.pt
|
| 60 |
+
python3 reconstruct.py
|
| 61 |
+
|
| 62 |
+
# This will create model.pt (16.4GB) from the shards
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
### Option 2: Use Directly with optimum-neuron
|
| 66 |
+
|
| 67 |
+
The model can be loaded directly without reconstruction:
|
| 68 |
+
|
| 69 |
+
```python
|
| 70 |
+
from optimum.neuron import NeuronModelForCausalLM
|
| 71 |
+
from transformers import AutoTokenizer
|
| 72 |
+
|
| 73 |
+
# Load the model (will handle shards automatically if needed)
|
| 74 |
+
model = NeuronModelForCausalLM.from_pretrained("kunhunjon/ChessLM_Qwen3_Trainium_Sharded")
|
| 75 |
+
tokenizer = AutoTokenizer.from_pretrained("kunhunjon/ChessLM_Qwen3_Trainium_Sharded")
|
| 76 |
+
|
| 77 |
+
# Run inference
|
| 78 |
+
prompt = "e2e4"
|
| 79 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 80 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
| 81 |
+
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 82 |
+
print(result)
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
## Requirements
|
| 86 |
+
|
| 87 |
+
```bash
|
| 88 |
+
pip install optimum-neuron[vllm]==0.3.0
|
| 89 |
+
pip install neuronx-distributed --extra-index-url=https://pip.repos.neuron.amazonaws.com
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
## Hardware Requirements
|
| 93 |
+
|
| 94 |
+
- AWS Trainium (trn1.32xlarge, trn1.2xlarge) or Inferentia (inf2) instances
|
| 95 |
+
- At least 2 Neuron cores (as configured during tracing)
|
| 96 |
+
- Minimum 32GB RAM recommended
|
| 97 |
+
|
| 98 |
+
## Sharding Details
|
| 99 |
+
|
| 100 |
+
The model was sharded using a custom script that:
|
| 101 |
+
- Splits the 16.4GB model.pt into 9 chunks of ~2GB each
|
| 102 |
+
- Generates SHA256 hashes for each shard for integrity verification
|
| 103 |
+
- Includes a reconstruction script to reassemble the original file
|
| 104 |
+
- Preserves all original model functionality
|
| 105 |
+
|
| 106 |
+
### Verification
|
| 107 |
+
|
| 108 |
+
The `model.shards.json` file contains SHA256 hashes for each shard. The reconstruction script automatically verifies these hashes when reassembling the model.
|
| 109 |
+
|
| 110 |
+
## Continuous Batching
|
| 111 |
+
|
| 112 |
+
This model is compiled with **continuous batching enabled**, which allows vLLM to:
|
| 113 |
+
- Process multiple requests simultaneously with dynamic batch sizes up to 4
|
| 114 |
+
- Optimize throughput by batching requests with different sequence lengths
|
| 115 |
+
- Reduce latency for concurrent inference workloads
|
| 116 |
+
|
| 117 |
+
**Note**: On-device sampling is disabled due to a known Neuron runtime limitation when using tensor parallelism with 2 cores. Sampling is handled on the host instead.
|
| 118 |
+
|
| 119 |
+
## Compilation Details
|
| 120 |
+
|
| 121 |
+
- `batch_size=4`
|
| 122 |
+
- `sequence_length=2048`
|
| 123 |
+
- `num_cores=2`
|
| 124 |
+
- `auto_cast_type="bf16"`
|
| 125 |
+
- `continuous_batching=True`
|
| 126 |
+
- Total compilation time: ~8.1 minutes
|
| 127 |
+
|
| 128 |
+
## License
|
| 129 |
+
|
| 130 |
+
This model inherits the license from the base model [karanps/ChessLM_Qwen3](https://huggingface.co/karanps/ChessLM_Qwen3).
|
| 131 |
+
|
| 132 |
+
## Citation
|
| 133 |
+
|
| 134 |
+
If you use this model, please cite the original ChessLM model and AWS Neuron tools.
|
added_tokens.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"</think>": 151668,
|
| 3 |
+
"</tool_call>": 151658,
|
| 4 |
+
"</tool_response>": 151666,
|
| 5 |
+
"<think>": 151667,
|
| 6 |
+
"<tool_call>": 151657,
|
| 7 |
+
"<tool_response>": 151665,
|
| 8 |
+
"<|box_end|>": 151649,
|
| 9 |
+
"<|box_start|>": 151648,
|
| 10 |
+
"<|endoftext|>": 151643,
|
| 11 |
+
"<|file_sep|>": 151664,
|
| 12 |
+
"<|fim_middle|>": 151660,
|
| 13 |
+
"<|fim_pad|>": 151662,
|
| 14 |
+
"<|fim_prefix|>": 151659,
|
| 15 |
+
"<|fim_suffix|>": 151661,
|
| 16 |
+
"<|im_end|>": 151645,
|
| 17 |
+
"<|im_start|>": 151644,
|
| 18 |
+
"<|image_pad|>": 151655,
|
| 19 |
+
"<|object_ref_end|>": 151647,
|
| 20 |
+
"<|object_ref_start|>": 151646,
|
| 21 |
+
"<|quad_end|>": 151651,
|
| 22 |
+
"<|quad_start|>": 151650,
|
| 23 |
+
"<|repo_name|>": 151663,
|
| 24 |
+
"<|video_pad|>": 151656,
|
| 25 |
+
"<|vision_end|>": 151653,
|
| 26 |
+
"<|vision_pad|>": 151654,
|
| 27 |
+
"<|vision_start|>": 151652
|
| 28 |
+
}
|
config.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"dtype": "float32",
|
| 8 |
+
"eos_token_id": 151645,
|
| 9 |
+
"head_dim": 128,
|
| 10 |
+
"hidden_act": "silu",
|
| 11 |
+
"hidden_size": 4096,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"intermediate_size": 12288,
|
| 14 |
+
"layer_types": [
|
| 15 |
+
"full_attention",
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"full_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"full_attention",
|
| 47 |
+
"full_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"full_attention",
|
| 50 |
+
"full_attention"
|
| 51 |
+
],
|
| 52 |
+
"max_position_embeddings": 40960,
|
| 53 |
+
"max_window_layers": 36,
|
| 54 |
+
"model_type": "qwen3",
|
| 55 |
+
"num_attention_heads": 32,
|
| 56 |
+
"num_hidden_layers": 36,
|
| 57 |
+
"num_key_value_heads": 8,
|
| 58 |
+
"pad_token_id": 151643,
|
| 59 |
+
"rms_norm_eps": 1e-06,
|
| 60 |
+
"rope_scaling": null,
|
| 61 |
+
"rope_theta": 1000000,
|
| 62 |
+
"sliding_window": null,
|
| 63 |
+
"tie_word_embeddings": false,
|
| 64 |
+
"torch_dtype": "bfloat16",
|
| 65 |
+
"transformers_version": "4.51.3",
|
| 66 |
+
"use_cache": true,
|
| 67 |
+
"use_sliding_window": false,
|
| 68 |
+
"vocab_size": 151936
|
| 69 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model.shard0000.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:840add1e51a5bf0bb8da47d347e3d120577557706af2be13c7863a87d87feef7
|
| 3 |
+
size 2097152000
|
model.shard0001.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eb03c716b799049da61b0f51bf702576502821e770f27fe5ad596e45f2901293
|
| 3 |
+
size 2097152000
|
model.shard0002.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2113ab040f5803048520559b532f9354b6c9a84567614a236a79a10fa72af803
|
| 3 |
+
size 2097152000
|
model.shard0003.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:46e74e9919f0ad0406402fe56481a9b06f785e895a88f0f25988b455175a0fe1
|
| 3 |
+
size 2097152000
|
model.shard0004.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:50fa0595a89f711bd73dba6138da92c6a4785298ea2049fb4eb52231696a04c4
|
| 3 |
+
size 2097152000
|
model.shard0005.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ce56a9c20b94e5bfe98c17bde3ca8538ae448df1c85d0ca15fbce5dd110ef1a3
|
| 3 |
+
size 2097152000
|
model.shard0006.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b8ec7de3ec641a46536894fb48871ad0d107773f1a13c6a9997bf699043eefc
|
| 3 |
+
size 2097152000
|
model.shard0007.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3cb4c72d399021f970ac3e465b897ca09611af166d9bd37dd71c37401d13703a
|
| 3 |
+
size 2097152000
|
model.shard0008.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aaecd4628682247206ec58cbb9f189a4abf1e21bed2f5e6ddfeaf161a0b7b886
|
| 3 |
+
size 837175015
|
model.shards.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"original_file": "model.pt",
|
| 3 |
+
"file_size": 17614391015,
|
| 4 |
+
"shard_size_mb": 2000,
|
| 5 |
+
"num_shards": 9,
|
| 6 |
+
"shards": [
|
| 7 |
+
{
|
| 8 |
+
"index": 0,
|
| 9 |
+
"filename": "model.shard0000.pt",
|
| 10 |
+
"size": 2097152000,
|
| 11 |
+
"sha256": "840add1e51a5bf0bb8da47d347e3d120577557706af2be13c7863a87d87feef7"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"index": 1,
|
| 15 |
+
"filename": "model.shard0001.pt",
|
| 16 |
+
"size": 2097152000,
|
| 17 |
+
"sha256": "eb03c716b799049da61b0f51bf702576502821e770f27fe5ad596e45f2901293"
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"index": 2,
|
| 21 |
+
"filename": "model.shard0002.pt",
|
| 22 |
+
"size": 2097152000,
|
| 23 |
+
"sha256": "2113ab040f5803048520559b532f9354b6c9a84567614a236a79a10fa72af803"
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"index": 3,
|
| 27 |
+
"filename": "model.shard0003.pt",
|
| 28 |
+
"size": 2097152000,
|
| 29 |
+
"sha256": "46e74e9919f0ad0406402fe56481a9b06f785e895a88f0f25988b455175a0fe1"
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"index": 4,
|
| 33 |
+
"filename": "model.shard0004.pt",
|
| 34 |
+
"size": 2097152000,
|
| 35 |
+
"sha256": "50fa0595a89f711bd73dba6138da92c6a4785298ea2049fb4eb52231696a04c4"
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"index": 5,
|
| 39 |
+
"filename": "model.shard0005.pt",
|
| 40 |
+
"size": 2097152000,
|
| 41 |
+
"sha256": "ce56a9c20b94e5bfe98c17bde3ca8538ae448df1c85d0ca15fbce5dd110ef1a3"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"index": 6,
|
| 45 |
+
"filename": "model.shard0006.pt",
|
| 46 |
+
"size": 2097152000,
|
| 47 |
+
"sha256": "0b8ec7de3ec641a46536894fb48871ad0d107773f1a13c6a9997bf699043eefc"
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"index": 7,
|
| 51 |
+
"filename": "model.shard0007.pt",
|
| 52 |
+
"size": 2097152000,
|
| 53 |
+
"sha256": "3cb4c72d399021f970ac3e465b897ca09611af166d9bd37dd71c37401d13703a"
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"index": 8,
|
| 57 |
+
"filename": "model.shard0008.pt",
|
| 58 |
+
"size": 837175015,
|
| 59 |
+
"sha256": "aaecd4628682247206ec58cbb9f189a4abf1e21bed2f5e6ddfeaf161a0b7b886"
|
| 60 |
+
}
|
| 61 |
+
]
|
| 62 |
+
}
|
neuron_config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_serialized_key": "NxDNeuronConfig",
|
| 3 |
+
"async_mode": false,
|
| 4 |
+
"attn_kernel_enabled": false,
|
| 5 |
+
"batch_size": 4,
|
| 6 |
+
"capacity_factor": null,
|
| 7 |
+
"cc_pipeline_tiling_factor": 2,
|
| 8 |
+
"checkpoint_id": "karanps/ChessLM_Qwen3",
|
| 9 |
+
"checkpoint_revision": "e0d57507d96b2be2dd0dc901ecb231dec2dd6330",
|
| 10 |
+
"continuous_batching": true,
|
| 11 |
+
"enable_bucketing": false,
|
| 12 |
+
"ep_degree": 1,
|
| 13 |
+
"flash_decoding_enabled": false,
|
| 14 |
+
"fused_qkv": true,
|
| 15 |
+
"glu_mlp": true,
|
| 16 |
+
"is_chunked_prefill": false,
|
| 17 |
+
"local_ranks_size": 2,
|
| 18 |
+
"logical_nc_config": 1,
|
| 19 |
+
"max_batch_size": 4,
|
| 20 |
+
"max_context_length": 2048,
|
| 21 |
+
"max_topk": 256,
|
| 22 |
+
"mlp_kernel_enabled": false,
|
| 23 |
+
"mlp_kernel_fuse_residual_add": false,
|
| 24 |
+
"n_active_tokens": 2048,
|
| 25 |
+
"neuronxcc_version": "2.21.33363.0+82129205",
|
| 26 |
+
"num_cores_per_group": 1,
|
| 27 |
+
"on_device_sampling": false,
|
| 28 |
+
"optimum_neuron_version": "0.3.0",
|
| 29 |
+
"output_logits": false,
|
| 30 |
+
"padding_side": "right",
|
| 31 |
+
"pp_degree": 1,
|
| 32 |
+
"qk_layernorm": false,
|
| 33 |
+
"qkv_kernel_enabled": false,
|
| 34 |
+
"rpl_reduce_dtype": "bfloat16",
|
| 35 |
+
"sequence_length": 2048,
|
| 36 |
+
"sequence_parallel_enabled": false,
|
| 37 |
+
"speculation_length": 0,
|
| 38 |
+
"start_rank_id": 0,
|
| 39 |
+
"target": null,
|
| 40 |
+
"torch_dtype": "bfloat16",
|
| 41 |
+
"tp_degree": 2,
|
| 42 |
+
"vocab_parallel": false
|
| 43 |
+
}
|
reconstruct.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Script to reconstruct the original model file from shards
|
| 4 |
+
"""
|
| 5 |
+
import json
|
| 6 |
+
import hashlib
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
def reconstruct_file(shards_dir="."):
|
| 10 |
+
shards_dir = Path(shards_dir)
|
| 11 |
+
|
| 12 |
+
# Find metadata file
|
| 13 |
+
metadata_files = list(shards_dir.glob("*.shards.json"))
|
| 14 |
+
if not metadata_files:
|
| 15 |
+
print("Error: No shards metadata file found")
|
| 16 |
+
return False
|
| 17 |
+
|
| 18 |
+
metadata_path = metadata_files[0]
|
| 19 |
+
print(f"Loading metadata: {metadata_path}")
|
| 20 |
+
|
| 21 |
+
with open(metadata_path, 'r') as f:
|
| 22 |
+
metadata = json.load(f)
|
| 23 |
+
|
| 24 |
+
output_file = metadata["original_file"]
|
| 25 |
+
print(f"Reconstructing: {output_file}")
|
| 26 |
+
print(f" Expected size: {metadata['file_size'] / (1024**3):.2f} GB")
|
| 27 |
+
print(f" Number of shards: {metadata['num_shards']}")
|
| 28 |
+
|
| 29 |
+
with open(output_file, 'wb') as f_out:
|
| 30 |
+
for shard_info in metadata["shards"]:
|
| 31 |
+
shard_path = shards_dir / shard_info["filename"]
|
| 32 |
+
print(f" Processing shard {shard_info['index'] + 1}/{metadata['num_shards']}: {shard_info['filename']}")
|
| 33 |
+
|
| 34 |
+
if not shard_path.exists():
|
| 35 |
+
print(f"Error: Shard not found: {shard_path}")
|
| 36 |
+
return False
|
| 37 |
+
|
| 38 |
+
# Read shard
|
| 39 |
+
with open(shard_path, 'rb') as f_in:
|
| 40 |
+
chunk_data = f_in.read()
|
| 41 |
+
|
| 42 |
+
# Verify hash
|
| 43 |
+
chunk_hash = hashlib.sha256(chunk_data).hexdigest()
|
| 44 |
+
if chunk_hash != shard_info["sha256"]:
|
| 45 |
+
print(f"Error: Hash mismatch for {shard_info['filename']}")
|
| 46 |
+
print(f" Expected: {shard_info['sha256']}")
|
| 47 |
+
print(f" Got: {chunk_hash}")
|
| 48 |
+
return False
|
| 49 |
+
|
| 50 |
+
# Write to output
|
| 51 |
+
f_out.write(chunk_data)
|
| 52 |
+
|
| 53 |
+
print(f"\n✓ Reconstruction complete: {output_file}")
|
| 54 |
+
return True
|
| 55 |
+
|
| 56 |
+
if __name__ == "__main__":
|
| 57 |
+
import sys
|
| 58 |
+
shards_dir = sys.argv[1] if len(sys.argv) > 1 else "."
|
| 59 |
+
success = reconstruct_file(shards_dir)
|
| 60 |
+
exit(0 if success else 1)
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|im_start|>",
|
| 4 |
+
"<|im_end|>",
|
| 5 |
+
"<|object_ref_start|>",
|
| 6 |
+
"<|object_ref_end|>",
|
| 7 |
+
"<|box_start|>",
|
| 8 |
+
"<|box_end|>",
|
| 9 |
+
"<|quad_start|>",
|
| 10 |
+
"<|quad_end|>",
|
| 11 |
+
"<|vision_start|>",
|
| 12 |
+
"<|vision_end|>",
|
| 13 |
+
"<|vision_pad|>",
|
| 14 |
+
"<|image_pad|>",
|
| 15 |
+
"<|video_pad|>"
|
| 16 |
+
],
|
| 17 |
+
"eos_token": {
|
| 18 |
+
"content": "<|im_end|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
},
|
| 24 |
+
"pad_token": {
|
| 25 |
+
"content": "<|endoftext|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
}
|
| 31 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9417dfa2470f086897a0fa5acf4c11e1b05646717bdd7f9d4dc119332c65d421
|
| 3 |
+
size 11422919
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_prefix_space": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"151643": {
|
| 6 |
+
"content": "<|endoftext|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"151644": {
|
| 14 |
+
"content": "<|im_start|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"151645": {
|
| 22 |
+
"content": "<|im_end|>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"151646": {
|
| 30 |
+
"content": "<|object_ref_start|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"151647": {
|
| 38 |
+
"content": "<|object_ref_end|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"151648": {
|
| 46 |
+
"content": "<|box_start|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"151649": {
|
| 54 |
+
"content": "<|box_end|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"151650": {
|
| 62 |
+
"content": "<|quad_start|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"151651": {
|
| 70 |
+
"content": "<|quad_end|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"151652": {
|
| 78 |
+
"content": "<|vision_start|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"151653": {
|
| 86 |
+
"content": "<|vision_end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"151654": {
|
| 94 |
+
"content": "<|vision_pad|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"151655": {
|
| 102 |
+
"content": "<|image_pad|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"151656": {
|
| 110 |
+
"content": "<|video_pad|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"151657": {
|
| 118 |
+
"content": "<tool_call>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": false
|
| 124 |
+
},
|
| 125 |
+
"151658": {
|
| 126 |
+
"content": "</tool_call>",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": false
|
| 132 |
+
},
|
| 133 |
+
"151659": {
|
| 134 |
+
"content": "<|fim_prefix|>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": false
|
| 140 |
+
},
|
| 141 |
+
"151660": {
|
| 142 |
+
"content": "<|fim_middle|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": false
|
| 148 |
+
},
|
| 149 |
+
"151661": {
|
| 150 |
+
"content": "<|fim_suffix|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": false
|
| 156 |
+
},
|
| 157 |
+
"151662": {
|
| 158 |
+
"content": "<|fim_pad|>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": false
|
| 164 |
+
},
|
| 165 |
+
"151663": {
|
| 166 |
+
"content": "<|repo_name|>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": false
|
| 172 |
+
},
|
| 173 |
+
"151664": {
|
| 174 |
+
"content": "<|file_sep|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": false
|
| 180 |
+
},
|
| 181 |
+
"151665": {
|
| 182 |
+
"content": "<tool_response>",
|
| 183 |
+
"lstrip": false,
|
| 184 |
+
"normalized": false,
|
| 185 |
+
"rstrip": false,
|
| 186 |
+
"single_word": false,
|
| 187 |
+
"special": false
|
| 188 |
+
},
|
| 189 |
+
"151666": {
|
| 190 |
+
"content": "</tool_response>",
|
| 191 |
+
"lstrip": false,
|
| 192 |
+
"normalized": false,
|
| 193 |
+
"rstrip": false,
|
| 194 |
+
"single_word": false,
|
| 195 |
+
"special": false
|
| 196 |
+
},
|
| 197 |
+
"151667": {
|
| 198 |
+
"content": "<think>",
|
| 199 |
+
"lstrip": false,
|
| 200 |
+
"normalized": false,
|
| 201 |
+
"rstrip": false,
|
| 202 |
+
"single_word": false,
|
| 203 |
+
"special": false
|
| 204 |
+
},
|
| 205 |
+
"151668": {
|
| 206 |
+
"content": "</think>",
|
| 207 |
+
"lstrip": false,
|
| 208 |
+
"normalized": false,
|
| 209 |
+
"rstrip": false,
|
| 210 |
+
"single_word": false,
|
| 211 |
+
"special": false
|
| 212 |
+
}
|
| 213 |
+
},
|
| 214 |
+
"additional_special_tokens": [
|
| 215 |
+
"<|im_start|>",
|
| 216 |
+
"<|im_end|>",
|
| 217 |
+
"<|object_ref_start|>",
|
| 218 |
+
"<|object_ref_end|>",
|
| 219 |
+
"<|box_start|>",
|
| 220 |
+
"<|box_end|>",
|
| 221 |
+
"<|quad_start|>",
|
| 222 |
+
"<|quad_end|>",
|
| 223 |
+
"<|vision_start|>",
|
| 224 |
+
"<|vision_end|>",
|
| 225 |
+
"<|vision_pad|>",
|
| 226 |
+
"<|image_pad|>",
|
| 227 |
+
"<|video_pad|>"
|
| 228 |
+
],
|
| 229 |
+
"bos_token": null,
|
| 230 |
+
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}",
|
| 231 |
+
"clean_up_tokenization_spaces": false,
|
| 232 |
+
"eos_token": "<|im_end|>",
|
| 233 |
+
"errors": "replace",
|
| 234 |
+
"extra_special_tokens": {},
|
| 235 |
+
"max_length": 512,
|
| 236 |
+
"model_max_length": 131072,
|
| 237 |
+
"pad_to_multiple_of": null,
|
| 238 |
+
"pad_token": "<|endoftext|>",
|
| 239 |
+
"pad_token_type_id": 0,
|
| 240 |
+
"padding_side": "left",
|
| 241 |
+
"split_special_tokens": false,
|
| 242 |
+
"stride": 0,
|
| 243 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 244 |
+
"truncation_side": "right",
|
| 245 |
+
"truncation_strategy": "longest_first",
|
| 246 |
+
"unk_token": null
|
| 247 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|