Upload quantized model Fara1.5-4B-AutoRound-W4A16-RTN
Browse files- .gitattributes +1 -0
- README.md +178 -0
- chat_template.jinja +154 -0
- config.json +122 -0
- generation_config.json +7 -0
- model.safetensors +3 -0
- preprocessor_config.json +26 -0
- processor_config.json +60 -0
- quantization_config.json +13 -0
- tokenizer.json +3 -0
- tokenizer_config.json +35 -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,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model:
|
| 3 |
+
- microsoft/Fara1.5-4B
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- quantized
|
| 7 |
+
- w4a16
|
| 8 |
+
- autoround
|
| 9 |
+
- low-bit-open-llm-leaderboard
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Fara1.5-4B-AutoRound-W4A16-RTN
|
| 13 |
+
|
| 14 |
+
## Model Details
|
| 15 |
+
|
| 16 |
+
This model is a int4 weight-only quantization with group_size 128 and symmetric quantization of [microsoft/Fara1.5-4B](https://huggingface.co/microsoft/Fara1.5-4B) generated by [AutoRound](https://github.com/intel/auto-round). Please follow the license of the original model.
|
| 17 |
+
|
| 18 |
+
## Quantization Details
|
| 19 |
+
|
| 20 |
+
| Attribute | Value |
|
| 21 |
+
|-----------|-------|
|
| 22 |
+
| Base Model | [microsoft/Fara1.5-4B](https://huggingface.co/microsoft/Fara1.5-4B) |
|
| 23 |
+
| Quantization Tool | [AutoRound](https://github.com/intel/auto-round) |
|
| 24 |
+
| Quantization Scheme | W4A16 |
|
| 25 |
+
| Quantized Size | 3619 MB |
|
| 26 |
+
|
| 27 |
+
## Evaluation Results
|
| 28 |
+
|
| 29 |
+
| Task | Accuracy |
|
| 30 |
+
|------|----------|
|
| 31 |
+
| hellaswag | 0.5418 |
|
| 32 |
+
| mmlu | 0.7083 |
|
| 33 |
+
| mmlu_abstract_algebra | 0.4500 |
|
| 34 |
+
| mmlu_anatomy | 0.7259 |
|
| 35 |
+
| mmlu_astronomy | 0.8750 |
|
| 36 |
+
| mmlu_business_ethics | 0.8000 |
|
| 37 |
+
| mmlu_clinical_knowledge | 0.7811 |
|
| 38 |
+
| mmlu_college_biology | 0.8542 |
|
| 39 |
+
| mmlu_college_chemistry | 0.5500 |
|
| 40 |
+
| mmlu_college_computer_science | 0.6700 |
|
| 41 |
+
| mmlu_college_mathematics | 0.5200 |
|
| 42 |
+
| mmlu_college_medicine | 0.7052 |
|
| 43 |
+
| mmlu_college_physics | 0.4804 |
|
| 44 |
+
| mmlu_computer_security | 0.7800 |
|
| 45 |
+
| mmlu_conceptual_physics | 0.8000 |
|
| 46 |
+
| mmlu_econometrics | 0.6316 |
|
| 47 |
+
| mmlu_electrical_engineering | 0.7517 |
|
| 48 |
+
| mmlu_elementary_mathematics | 0.6481 |
|
| 49 |
+
| mmlu_formal_logic | 0.5556 |
|
| 50 |
+
| mmlu_global_facts | 0.3900 |
|
| 51 |
+
| mmlu_high_school_biology | 0.8935 |
|
| 52 |
+
| mmlu_high_school_chemistry | 0.7192 |
|
| 53 |
+
| mmlu_high_school_computer_science | 0.8200 |
|
| 54 |
+
| mmlu_high_school_european_history | 0.8061 |
|
| 55 |
+
| mmlu_high_school_geography | 0.8434 |
|
| 56 |
+
| mmlu_high_school_government_and_politics | 0.8912 |
|
| 57 |
+
| mmlu_high_school_macroeconomics | 0.7615 |
|
| 58 |
+
| mmlu_high_school_mathematics | 0.4889 |
|
| 59 |
+
| mmlu_high_school_microeconomics | 0.8613 |
|
| 60 |
+
| mmlu_high_school_physics | 0.6424 |
|
| 61 |
+
| mmlu_high_school_psychology | 0.8844 |
|
| 62 |
+
| mmlu_high_school_statistics | 0.7269 |
|
| 63 |
+
| mmlu_high_school_us_history | 0.8431 |
|
| 64 |
+
| mmlu_high_school_world_history | 0.8354 |
|
| 65 |
+
| mmlu_human_aging | 0.6816 |
|
| 66 |
+
| mmlu_human_sexuality | 0.7939 |
|
| 67 |
+
| mmlu_humanities | 0.6283 |
|
| 68 |
+
| mmlu_international_law | 0.8264 |
|
| 69 |
+
| mmlu_jurisprudence | 0.7593 |
|
| 70 |
+
| mmlu_logical_fallacies | 0.7669 |
|
| 71 |
+
| mmlu_machine_learning | 0.5893 |
|
| 72 |
+
| mmlu_management | 0.8835 |
|
| 73 |
+
| mmlu_marketing | 0.8932 |
|
| 74 |
+
| mmlu_medical_genetics | 0.8600 |
|
| 75 |
+
| mmlu_miscellaneous | 0.8072 |
|
| 76 |
+
| mmlu_moral_disputes | 0.6936 |
|
| 77 |
+
| mmlu_moral_scenarios | 0.4838 |
|
| 78 |
+
| mmlu_nutrition | 0.7909 |
|
| 79 |
+
| mmlu_other | 0.7470 |
|
| 80 |
+
| mmlu_philosophy | 0.7042 |
|
| 81 |
+
| mmlu_prehistory | 0.7932 |
|
| 82 |
+
| mmlu_professional_accounting | 0.5816 |
|
| 83 |
+
| mmlu_professional_law | 0.5124 |
|
| 84 |
+
| mmlu_professional_medicine | 0.7904 |
|
| 85 |
+
| mmlu_professional_psychology | 0.7353 |
|
| 86 |
+
| mmlu_public_relations | 0.6818 |
|
| 87 |
+
| mmlu_security_studies | 0.7510 |
|
| 88 |
+
| mmlu_social_sciences | 0.8027 |
|
| 89 |
+
| mmlu_sociology | 0.8657 |
|
| 90 |
+
| mmlu_stem | 0.6974 |
|
| 91 |
+
| mmlu_us_foreign_policy | 0.8800 |
|
| 92 |
+
| mmlu_virology | 0.4940 |
|
| 93 |
+
| mmlu_world_religions | 0.8246 |
|
| 94 |
+
| piqa | 0.7497 |
|
| 95 |
+
|
| 96 |
+
## How to Use
|
| 97 |
+
|
| 98 |
+
### HF Usage
|
| 99 |
+
|
| 100 |
+
**Step 1: Install [AutoRound](https://github.com/intel/auto-round)**
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
pip install auto-round
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
**Step 2: Load and run the quantized model**
|
| 107 |
+
|
| 108 |
+
```python
|
| 109 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 110 |
+
|
| 111 |
+
model_name = "Fara1.5-4B-AutoRound-W4A16-RTN"
|
| 112 |
+
|
| 113 |
+
# load the tokenizer and the model
|
| 114 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 115 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
|
| 116 |
+
|
| 117 |
+
# prepare the model input
|
| 118 |
+
prompt = "Write a quick sort algorithm."
|
| 119 |
+
messages = [{"role": "user", "content": prompt}]
|
| 120 |
+
text = tokenizer.apply_chat_template(
|
| 121 |
+
messages,
|
| 122 |
+
tokenize=False,
|
| 123 |
+
add_generation_prompt=True,
|
| 124 |
+
)
|
| 125 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 126 |
+
|
| 127 |
+
# conduct text completion
|
| 128 |
+
generated_ids = model.generate(**model_inputs, max_new_tokens=512)
|
| 129 |
+
output_ids = generated_ids[0][len(model_inputs.input_ids[0]) :].tolist()
|
| 130 |
+
|
| 131 |
+
content = tokenizer.decode(output_ids, skip_special_tokens=True)
|
| 132 |
+
print("content:", content)
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
### VLLM Usage
|
| 136 |
+
|
| 137 |
+
```bash
|
| 138 |
+
vllm serve Fara1.5-4B-AutoRound-W4A16-RTN \
|
| 139 |
+
--trust-remote-code \
|
| 140 |
+
--dtype bfloat16 \
|
| 141 |
+
--tensor_parallel_size 1
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
If you encounter any issues, feel free to open an issue on the [AutoRound GitHub repo](https://github.com/intel/auto-round/issues) or provide feedback on the [Low-Bit Open LLM Leaderboard](https://huggingface.co/spaces/Intel/low_bit_open_llm_leaderboard).
|
| 145 |
+
|
| 146 |
+
## Ethical Considerations and Limitations
|
| 147 |
+
|
| 148 |
+
The model can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
|
| 149 |
+
Therefore, before deploying any applications of the model, developers should perform safety testing.
|
| 150 |
+
|
| 151 |
+
## Caveats and Recommendations
|
| 152 |
+
|
| 153 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
|
| 154 |
+
Here are a couple of useful links to learn more about Intel's AI software:
|
| 155 |
+
|
| 156 |
+
- [Intel Neural Compressor](https://github.com/intel/neural-compressor)
|
| 157 |
+
- [AutoRound](https://github.com/intel/auto-round)
|
| 158 |
+
|
| 159 |
+
## Disclaimer
|
| 160 |
+
|
| 161 |
+
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
|
| 162 |
+
|
| 163 |
+
## Cite
|
| 164 |
+
|
| 165 |
+
```
|
| 166 |
+
@article{cheng2023optimize,
|
| 167 |
+
title={Optimize weight rounding via signed gradient descent for the quantization of llms},
|
| 168 |
+
author={Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi},
|
| 169 |
+
journal={arXiv preprint arXiv:2309.05516},
|
| 170 |
+
year={2023}
|
| 171 |
+
}
|
| 172 |
+
```
|
| 173 |
+
|
| 174 |
+
[arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)
|
| 175 |
+
|
| 176 |
+
---
|
| 177 |
+
|
| 178 |
+
*This model is part of the [Intel Low-Bit Open LLM Leaderboard](https://huggingface.co/spaces/Intel/low_bit_open_llm_leaderboard) initiative.*
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- set image_count = namespace(value=0) %}
|
| 2 |
+
{%- set video_count = namespace(value=0) %}
|
| 3 |
+
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
| 4 |
+
{%- if content is string %}
|
| 5 |
+
{{- content }}
|
| 6 |
+
{%- elif content is iterable and content is not mapping %}
|
| 7 |
+
{%- for item in content %}
|
| 8 |
+
{%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
|
| 9 |
+
{%- if is_system_content %}
|
| 10 |
+
{{- raise_exception('System message cannot contain images.') }}
|
| 11 |
+
{%- endif %}
|
| 12 |
+
{%- if do_vision_count %}
|
| 13 |
+
{%- set image_count.value = image_count.value + 1 %}
|
| 14 |
+
{%- endif %}
|
| 15 |
+
{%- if add_vision_id %}
|
| 16 |
+
{{- 'Picture ' ~ image_count.value ~ ': ' }}
|
| 17 |
+
{%- endif %}
|
| 18 |
+
{{- '<|vision_start|><|image_pad|><|vision_end|>' }}
|
| 19 |
+
{%- elif 'video' in item or item.type == 'video' %}
|
| 20 |
+
{%- if is_system_content %}
|
| 21 |
+
{{- raise_exception('System message cannot contain videos.') }}
|
| 22 |
+
{%- endif %}
|
| 23 |
+
{%- if do_vision_count %}
|
| 24 |
+
{%- set video_count.value = video_count.value + 1 %}
|
| 25 |
+
{%- endif %}
|
| 26 |
+
{%- if add_vision_id %}
|
| 27 |
+
{{- 'Video ' ~ video_count.value ~ ': ' }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{{- '<|vision_start|><|video_pad|><|vision_end|>' }}
|
| 30 |
+
{%- elif 'text' in item %}
|
| 31 |
+
{{- item.text }}
|
| 32 |
+
{%- else %}
|
| 33 |
+
{{- raise_exception('Unexpected item type in content.') }}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- endfor %}
|
| 36 |
+
{%- elif content is none or content is undefined %}
|
| 37 |
+
{{- '' }}
|
| 38 |
+
{%- else %}
|
| 39 |
+
{{- raise_exception('Unexpected content type.') }}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- endmacro %}
|
| 42 |
+
{%- if not messages %}
|
| 43 |
+
{{- raise_exception('No messages provided.') }}
|
| 44 |
+
{%- endif %}
|
| 45 |
+
{%- if tools and tools is iterable and tools is not mapping %}
|
| 46 |
+
{{- '<|im_start|>system\n' }}
|
| 47 |
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
| 48 |
+
{%- for tool in tools %}
|
| 49 |
+
{{- "\n" }}
|
| 50 |
+
{{- tool | tojson }}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{{- "\n</tools>" }}
|
| 53 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
|
| 54 |
+
{%- if messages[0].role == 'system' %}
|
| 55 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 56 |
+
{%- if content %}
|
| 57 |
+
{{- '\n\n' + content }}
|
| 58 |
+
{%- endif %}
|
| 59 |
+
{%- endif %}
|
| 60 |
+
{{- '<|im_end|>\n' }}
|
| 61 |
+
{%- else %}
|
| 62 |
+
{%- if messages[0].role == 'system' %}
|
| 63 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 64 |
+
{{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
|
| 65 |
+
{%- endif %}
|
| 66 |
+
{%- endif %}
|
| 67 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 68 |
+
{%- for message in messages[::-1] %}
|
| 69 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 70 |
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
| 71 |
+
{%- set content = render_content(message.content, false)|trim %}
|
| 72 |
+
{%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
|
| 73 |
+
{%- set ns.multi_step_tool = false %}
|
| 74 |
+
{%- set ns.last_query_index = index %}
|
| 75 |
+
{%- endif %}
|
| 76 |
+
{%- endif %}
|
| 77 |
+
{%- endfor %}
|
| 78 |
+
{%- if ns.multi_step_tool %}
|
| 79 |
+
{{- raise_exception('No user query found in messages.') }}
|
| 80 |
+
{%- endif %}
|
| 81 |
+
{%- for message in messages %}
|
| 82 |
+
{%- set content = render_content(message.content, true)|trim %}
|
| 83 |
+
{%- if message.role == "system" %}
|
| 84 |
+
{%- if not loop.first %}
|
| 85 |
+
{{- raise_exception('System message must be at the beginning.') }}
|
| 86 |
+
{%- endif %}
|
| 87 |
+
{%- elif message.role == "user" %}
|
| 88 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 89 |
+
{%- elif message.role == "assistant" %}
|
| 90 |
+
{%- set reasoning_content = '' %}
|
| 91 |
+
{%- if message.reasoning_content is string %}
|
| 92 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 93 |
+
{%- else %}
|
| 94 |
+
{%- if '</think>' in content %}
|
| 95 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 96 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 97 |
+
{%- endif %}
|
| 98 |
+
{%- endif %}
|
| 99 |
+
{%- set reasoning_content = reasoning_content|trim %}
|
| 100 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 101 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 102 |
+
{%- else %}
|
| 103 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 104 |
+
{%- endif %}
|
| 105 |
+
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 106 |
+
{%- for tool_call in message.tool_calls %}
|
| 107 |
+
{%- if tool_call.function is defined %}
|
| 108 |
+
{%- set tool_call = tool_call.function %}
|
| 109 |
+
{%- endif %}
|
| 110 |
+
{%- if loop.first %}
|
| 111 |
+
{%- if content|trim %}
|
| 112 |
+
{{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 113 |
+
{%- else %}
|
| 114 |
+
{{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 115 |
+
{%- endif %}
|
| 116 |
+
{%- else %}
|
| 117 |
+
{{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 118 |
+
{%- endif %}
|
| 119 |
+
{%- if tool_call.arguments is defined %}
|
| 120 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 121 |
+
{{- '<parameter=' + args_name + '>\n' }}
|
| 122 |
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
| 123 |
+
{{- args_value }}
|
| 124 |
+
{{- '\n</parameter>\n' }}
|
| 125 |
+
{%- endfor %}
|
| 126 |
+
{%- endif %}
|
| 127 |
+
{{- '</function>\n</tool_call>' }}
|
| 128 |
+
{%- endfor %}
|
| 129 |
+
{%- endif %}
|
| 130 |
+
{{- '<|im_end|>\n' }}
|
| 131 |
+
{%- elif message.role == "tool" %}
|
| 132 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 133 |
+
{{- '<|im_start|>user' }}
|
| 134 |
+
{%- endif %}
|
| 135 |
+
{{- '\n<tool_response>\n' }}
|
| 136 |
+
{{- content }}
|
| 137 |
+
{{- '\n</tool_response>' }}
|
| 138 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 139 |
+
{{- '<|im_end|>\n' }}
|
| 140 |
+
{%- elif loop.last %}
|
| 141 |
+
{{- '<|im_end|>\n' }}
|
| 142 |
+
{%- endif %}
|
| 143 |
+
{%- else %}
|
| 144 |
+
{{- raise_exception('Unexpected message role.') }}
|
| 145 |
+
{%- endif %}
|
| 146 |
+
{%- endfor %}
|
| 147 |
+
{%- if add_generation_prompt %}
|
| 148 |
+
{{- '<|im_start|>assistant\n' }}
|
| 149 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 150 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 151 |
+
{%- else %}
|
| 152 |
+
{{- '<think>\n' }}
|
| 153 |
+
{%- endif %}
|
| 154 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3_5ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"dtype": "bfloat16",
|
| 6 |
+
"image_token_id": 248056,
|
| 7 |
+
"model_type": "qwen3_5",
|
| 8 |
+
"quantization_config": {
|
| 9 |
+
"autoround_version": "0.14.2",
|
| 10 |
+
"bits": 4,
|
| 11 |
+
"block_name_to_quantize": "model.language_model.layers",
|
| 12 |
+
"data_type": "int",
|
| 13 |
+
"enable_quanted_input": false,
|
| 14 |
+
"group_size": 128,
|
| 15 |
+
"iters": 0,
|
| 16 |
+
"low_gpu_mem_usage": true,
|
| 17 |
+
"packing_format": "auto_round:auto_gptq",
|
| 18 |
+
"quant_method": "auto-round",
|
| 19 |
+
"sym": true
|
| 20 |
+
},
|
| 21 |
+
"text_config": {
|
| 22 |
+
"attention_bias": false,
|
| 23 |
+
"attention_dropout": 0.0,
|
| 24 |
+
"attn_output_gate": true,
|
| 25 |
+
"bos_token_id": null,
|
| 26 |
+
"dtype": "bfloat16",
|
| 27 |
+
"eos_token_id": 248044,
|
| 28 |
+
"full_attention_interval": 4,
|
| 29 |
+
"head_dim": 256,
|
| 30 |
+
"hidden_act": "silu",
|
| 31 |
+
"hidden_size": 2560,
|
| 32 |
+
"initializer_range": 0.02,
|
| 33 |
+
"intermediate_size": 9216,
|
| 34 |
+
"layer_types": [
|
| 35 |
+
"linear_attention",
|
| 36 |
+
"linear_attention",
|
| 37 |
+
"linear_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"linear_attention",
|
| 40 |
+
"linear_attention",
|
| 41 |
+
"linear_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"linear_attention",
|
| 44 |
+
"linear_attention",
|
| 45 |
+
"linear_attention",
|
| 46 |
+
"full_attention",
|
| 47 |
+
"linear_attention",
|
| 48 |
+
"linear_attention",
|
| 49 |
+
"linear_attention",
|
| 50 |
+
"full_attention",
|
| 51 |
+
"linear_attention",
|
| 52 |
+
"linear_attention",
|
| 53 |
+
"linear_attention",
|
| 54 |
+
"full_attention",
|
| 55 |
+
"linear_attention",
|
| 56 |
+
"linear_attention",
|
| 57 |
+
"linear_attention",
|
| 58 |
+
"full_attention",
|
| 59 |
+
"linear_attention",
|
| 60 |
+
"linear_attention",
|
| 61 |
+
"linear_attention",
|
| 62 |
+
"full_attention",
|
| 63 |
+
"linear_attention",
|
| 64 |
+
"linear_attention",
|
| 65 |
+
"linear_attention",
|
| 66 |
+
"full_attention"
|
| 67 |
+
],
|
| 68 |
+
"linear_conv_kernel_dim": 4,
|
| 69 |
+
"linear_key_head_dim": 128,
|
| 70 |
+
"linear_num_key_heads": 16,
|
| 71 |
+
"linear_num_value_heads": 32,
|
| 72 |
+
"linear_value_head_dim": 128,
|
| 73 |
+
"mamba_ssm_dtype": "float32",
|
| 74 |
+
"max_position_embeddings": 262144,
|
| 75 |
+
"mlp_only_layers": [],
|
| 76 |
+
"model_type": "qwen3_5_text",
|
| 77 |
+
"mtp_num_hidden_layers": 1,
|
| 78 |
+
"mtp_use_dedicated_embeddings": false,
|
| 79 |
+
"num_attention_heads": 16,
|
| 80 |
+
"num_hidden_layers": 32,
|
| 81 |
+
"num_key_value_heads": 4,
|
| 82 |
+
"pad_token_id": null,
|
| 83 |
+
"partial_rotary_factor": 0.25,
|
| 84 |
+
"rms_norm_eps": 1e-06,
|
| 85 |
+
"rope_parameters": {
|
| 86 |
+
"mrope_interleaved": true,
|
| 87 |
+
"mrope_section": [
|
| 88 |
+
11,
|
| 89 |
+
11,
|
| 90 |
+
10
|
| 91 |
+
],
|
| 92 |
+
"partial_rotary_factor": 0.25,
|
| 93 |
+
"rope_theta": 10000000,
|
| 94 |
+
"rope_type": "default"
|
| 95 |
+
},
|
| 96 |
+
"tie_word_embeddings": true,
|
| 97 |
+
"use_cache": true,
|
| 98 |
+
"vocab_size": 248320
|
| 99 |
+
},
|
| 100 |
+
"tie_word_embeddings": true,
|
| 101 |
+
"transformers_version": "5.14.1",
|
| 102 |
+
"video_token_id": 248057,
|
| 103 |
+
"vision_config": {
|
| 104 |
+
"deepstack_visual_indexes": [],
|
| 105 |
+
"depth": 24,
|
| 106 |
+
"dtype": "bfloat16",
|
| 107 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 108 |
+
"hidden_size": 1024,
|
| 109 |
+
"in_channels": 3,
|
| 110 |
+
"initializer_range": 0.02,
|
| 111 |
+
"intermediate_size": 4096,
|
| 112 |
+
"model_type": "qwen3_5_vision",
|
| 113 |
+
"num_heads": 16,
|
| 114 |
+
"num_position_embeddings": 2304,
|
| 115 |
+
"out_hidden_size": 2560,
|
| 116 |
+
"patch_size": 16,
|
| 117 |
+
"spatial_merge_size": 2,
|
| 118 |
+
"temporal_patch_size": 2
|
| 119 |
+
},
|
| 120 |
+
"vision_end_token_id": 248054,
|
| 121 |
+
"vision_start_token_id": 248053
|
| 122 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": 248044,
|
| 5 |
+
"transformers_version": "5.14.1",
|
| 6 |
+
"use_cache": true
|
| 7 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8c3f43c036ff64f82e1bcd09c8587b68fe4891259d3667a30fd08e833d7e60b1
|
| 3 |
+
size 3794757176
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"do_convert_rgb": true,
|
| 3 |
+
"do_normalize": true,
|
| 4 |
+
"do_rescale": true,
|
| 5 |
+
"do_resize": true,
|
| 6 |
+
"image_mean": [
|
| 7 |
+
0.5,
|
| 8 |
+
0.5,
|
| 9 |
+
0.5
|
| 10 |
+
],
|
| 11 |
+
"image_processor_type": "Qwen2VLImageProcessor",
|
| 12 |
+
"image_std": [
|
| 13 |
+
0.5,
|
| 14 |
+
0.5,
|
| 15 |
+
0.5
|
| 16 |
+
],
|
| 17 |
+
"merge_size": 2,
|
| 18 |
+
"patch_size": 16,
|
| 19 |
+
"resample": 3,
|
| 20 |
+
"rescale_factor": 0.00392156862745098,
|
| 21 |
+
"size": {
|
| 22 |
+
"longest_edge": 12845056,
|
| 23 |
+
"shortest_edge": 3136
|
| 24 |
+
},
|
| 25 |
+
"temporal_patch_size": 2
|
| 26 |
+
}
|
processor_config.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_processor": {
|
| 3 |
+
"do_convert_rgb": true,
|
| 4 |
+
"do_normalize": true,
|
| 5 |
+
"do_rescale": true,
|
| 6 |
+
"do_resize": true,
|
| 7 |
+
"image_mean": [
|
| 8 |
+
0.5,
|
| 9 |
+
0.5,
|
| 10 |
+
0.5
|
| 11 |
+
],
|
| 12 |
+
"image_processor_type": "Qwen2VLImageProcessor",
|
| 13 |
+
"image_std": [
|
| 14 |
+
0.5,
|
| 15 |
+
0.5,
|
| 16 |
+
0.5
|
| 17 |
+
],
|
| 18 |
+
"merge_size": 2,
|
| 19 |
+
"patch_size": 16,
|
| 20 |
+
"resample": 3,
|
| 21 |
+
"rescale_factor": 0.00392156862745098,
|
| 22 |
+
"size": {
|
| 23 |
+
"longest_edge": 12845056,
|
| 24 |
+
"shortest_edge": 3136
|
| 25 |
+
},
|
| 26 |
+
"temporal_patch_size": 2
|
| 27 |
+
},
|
| 28 |
+
"processor_class": "Qwen3VLProcessor",
|
| 29 |
+
"video_processor": {
|
| 30 |
+
"do_convert_rgb": true,
|
| 31 |
+
"do_normalize": true,
|
| 32 |
+
"do_rescale": true,
|
| 33 |
+
"do_resize": true,
|
| 34 |
+
"do_sample_frames": true,
|
| 35 |
+
"fps": 2,
|
| 36 |
+
"image_mean": [
|
| 37 |
+
0.5,
|
| 38 |
+
0.5,
|
| 39 |
+
0.5
|
| 40 |
+
],
|
| 41 |
+
"image_std": [
|
| 42 |
+
0.5,
|
| 43 |
+
0.5,
|
| 44 |
+
0.5
|
| 45 |
+
],
|
| 46 |
+
"max_frames": 768,
|
| 47 |
+
"merge_size": 2,
|
| 48 |
+
"min_frames": 4,
|
| 49 |
+
"patch_size": 16,
|
| 50 |
+
"resample": 3,
|
| 51 |
+
"rescale_factor": 0.00392156862745098,
|
| 52 |
+
"return_metadata": false,
|
| 53 |
+
"size": {
|
| 54 |
+
"longest_edge": 25165824,
|
| 55 |
+
"shortest_edge": 4096
|
| 56 |
+
},
|
| 57 |
+
"temporal_patch_size": 2,
|
| 58 |
+
"video_processor_type": "Qwen3VLVideoProcessor"
|
| 59 |
+
}
|
| 60 |
+
}
|
quantization_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bits": 4,
|
| 3 |
+
"data_type": "int",
|
| 4 |
+
"group_size": 128,
|
| 5 |
+
"sym": true,
|
| 6 |
+
"enable_quanted_input": false,
|
| 7 |
+
"iters": 0,
|
| 8 |
+
"low_gpu_mem_usage": true,
|
| 9 |
+
"autoround_version": "0.14.2",
|
| 10 |
+
"block_name_to_quantize": "model.language_model.layers",
|
| 11 |
+
"quant_method": "auto-round",
|
| 12 |
+
"packing_format": "auto_round:auto_gptq"
|
| 13 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523
|
| 3 |
+
size 19989325
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"audio_bos_token": "<|audio_start|>",
|
| 4 |
+
"audio_eos_token": "<|audio_end|>",
|
| 5 |
+
"audio_token": "<|audio_pad|>",
|
| 6 |
+
"backend": "tokenizers",
|
| 7 |
+
"bos_token": null,
|
| 8 |
+
"clean_up_tokenization_spaces": false,
|
| 9 |
+
"eos_token": "<|im_end|>",
|
| 10 |
+
"errors": "replace",
|
| 11 |
+
"image_token": "<|image_pad|>",
|
| 12 |
+
"is_local": false,
|
| 13 |
+
"local_files_only": false,
|
| 14 |
+
"max_pixels": 12845056,
|
| 15 |
+
"min_pixels": 3136,
|
| 16 |
+
"model_max_length": 262144,
|
| 17 |
+
"model_specific_special_tokens": {
|
| 18 |
+
"audio_bos_token": "<|audio_start|>",
|
| 19 |
+
"audio_eos_token": "<|audio_end|>",
|
| 20 |
+
"audio_token": "<|audio_pad|>",
|
| 21 |
+
"image_token": "<|image_pad|>",
|
| 22 |
+
"video_token": "<|video_pad|>",
|
| 23 |
+
"vision_bos_token": "<|vision_start|>",
|
| 24 |
+
"vision_eos_token": "<|vision_end|>"
|
| 25 |
+
},
|
| 26 |
+
"pad_token": "<|endoftext|>",
|
| 27 |
+
"pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 28 |
+
"processor_class": "Qwen3VLProcessor",
|
| 29 |
+
"split_special_tokens": false,
|
| 30 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 31 |
+
"unk_token": null,
|
| 32 |
+
"video_token": "<|video_pad|>",
|
| 33 |
+
"vision_bos_token": "<|vision_start|>",
|
| 34 |
+
"vision_eos_token": "<|vision_end|>"
|
| 35 |
+
}
|