Text Generation
Transformers
Safetensors
qwen3_5_moe
qwen3.5
Mixture of Experts
fp8
quantized
abliterated
compressed-tensors
vllm
conversational
Instructions to use bjk110/Qwen3.5-122B-A10B-abliterated-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bjk110/Qwen3.5-122B-A10B-abliterated-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bjk110/Qwen3.5-122B-A10B-abliterated-FP8") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoProcessor, AutoModelForCausalLM processor = AutoProcessor.from_pretrained("bjk110/Qwen3.5-122B-A10B-abliterated-FP8") model = AutoModelForCausalLM.from_pretrained("bjk110/Qwen3.5-122B-A10B-abliterated-FP8", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bjk110/Qwen3.5-122B-A10B-abliterated-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bjk110/Qwen3.5-122B-A10B-abliterated-FP8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bjk110/Qwen3.5-122B-A10B-abliterated-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/bjk110/Qwen3.5-122B-A10B-abliterated-FP8
- SGLang
How to use bjk110/Qwen3.5-122B-A10B-abliterated-FP8 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 "bjk110/Qwen3.5-122B-A10B-abliterated-FP8" \ --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": "bjk110/Qwen3.5-122B-A10B-abliterated-FP8", "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 "bjk110/Qwen3.5-122B-A10B-abliterated-FP8" \ --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": "bjk110/Qwen3.5-122B-A10B-abliterated-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use bjk110/Qwen3.5-122B-A10B-abliterated-FP8 with Docker Model Runner:
docker model run hf.co/bjk110/Qwen3.5-122B-A10B-abliterated-FP8
Ban commited on
Upload FP8 block-wise quantized model (128x128, weight_scale_inv)
Browse files- .gitattributes +1 -0
- README.md +125 -0
- chat_template.jinja +154 -0
- config.json +367 -0
- generation_config.json +13 -0
- model-00001-of-00039.safetensors +3 -0
- model-00002-of-00039.safetensors +3 -0
- model-00003-of-00039.safetensors +3 -0
- model-00004-of-00039.safetensors +3 -0
- model-00005-of-00039.safetensors +3 -0
- model-00006-of-00039.safetensors +3 -0
- model-00007-of-00039.safetensors +3 -0
- model-00008-of-00039.safetensors +3 -0
- model-00009-of-00039.safetensors +3 -0
- model-00010-of-00039.safetensors +3 -0
- model-00011-of-00039.safetensors +3 -0
- model-00012-of-00039.safetensors +3 -0
- model-00013-of-00039.safetensors +3 -0
- model-00014-of-00039.safetensors +3 -0
- model-00015-of-00039.safetensors +3 -0
- model-00016-of-00039.safetensors +3 -0
- model-00017-of-00039.safetensors +3 -0
- model-00018-of-00039.safetensors +3 -0
- model-00019-of-00039.safetensors +3 -0
- model-00020-of-00039.safetensors +3 -0
- model-00021-of-00039.safetensors +3 -0
- model-00022-of-00039.safetensors +3 -0
- model-00023-of-00039.safetensors +3 -0
- model-00024-of-00039.safetensors +3 -0
- model-00025-of-00039.safetensors +3 -0
- model-00026-of-00039.safetensors +3 -0
- model-00027-of-00039.safetensors +3 -0
- model-00028-of-00039.safetensors +3 -0
- model-00029-of-00039.safetensors +3 -0
- model-00030-of-00039.safetensors +3 -0
- model-00031-of-00039.safetensors +3 -0
- model-00032-of-00039.safetensors +3 -0
- model-00033-of-00039.safetensors +3 -0
- model-00034-of-00039.safetensors +3 -0
- model-00035-of-00039.safetensors +3 -0
- model-00036-of-00039.safetensors +3 -0
- model-00037-of-00039.safetensors +3 -0
- model-00038-of-00039.safetensors +3 -0
- model-00039-of-00039.safetensors +3 -0
- model.safetensors.index.json +0 -0
- preprocessor_config.json +21 -0
- tokenizer.json +3 -0
- tokenizer_config.json +31 -0
- vllm_patches/patch_qwen35_moe_text.py +290 -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,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: wangzhang/Qwen3.5-122B-A10B-abliterated
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
tags:
|
| 5 |
+
- qwen3.5
|
| 6 |
+
- moe
|
| 7 |
+
- fp8
|
| 8 |
+
- quantized
|
| 9 |
+
- abliterated
|
| 10 |
+
- uncensored
|
| 11 |
+
- block-wise-fp8
|
| 12 |
+
license: apache-2.0
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Qwen3.5-122B-A10B-abliterated-FP8
|
| 16 |
+
|
| 17 |
+
[wangzhang/Qwen3.5-122B-A10B-abliterated](https://huggingface.co/wangzhang/Qwen3.5-122B-A10B-abliterated)의
|
| 18 |
+
**FP8 E4M3 block-wise 양자화** 버전입니다.
|
| 19 |
+
|
| 20 |
+
[Qwen/Qwen3.5-122B-A10B-FP8](https://huggingface.co/Qwen/Qwen3.5-122B-A10B-FP8)과 동일한 저장 포맷을 사용합니다.
|
| 21 |
+
|
| 22 |
+
## 모델 정보
|
| 23 |
+
|
| 24 |
+
| 항목 | 값 |
|
| 25 |
+
|------|-----|
|
| 26 |
+
| 원본 모델 | [wangzhang/Qwen3.5-122B-A10B-abliterated](https://huggingface.co/wangzhang/Qwen3.5-122B-A10B-abliterated) |
|
| 27 |
+
| 양자화 | FP8 E4M3, block-wise 128×128, `weight_scale_inv` (bfloat16) |
|
| 28 |
+
| 체크포인트 크기 | **115 GB** (원본 228 GB 대비 50% 감소) |
|
| 29 |
+
| 활성 파라미터 | ~10B (MoE, 256 experts 중 10개 활성) |
|
| 30 |
+
| 전체 파라미터 | 122B |
|
| 31 |
+
| 최대 컨텍스트 | 32,768 tokens |
|
| 32 |
+
| 검열 해제 | ✅ (abliterated, refusal rate 0.5%) |
|
| 33 |
+
| Activation | Dynamic (체크포인트에 미포함) |
|
| 34 |
+
| BF16 유지 대상 | lm_head, embed_tokens, norms, conv1d, router gate, in_proj_a/b |
|
| 35 |
+
|
| 36 |
+
## 사용법
|
| 37 |
+
|
| 38 |
+
### ⚠️ vLLM 패치 필요
|
| 39 |
+
|
| 40 |
+
이 모델은 `qwen3_5_moe_text` (text-only MoE) 아키텍처를 사용합니다.
|
| 41 |
+
vLLM v0.17~v0.18에서는 이 아키텍처가 정식 지원되지 않으므로,
|
| 42 |
+
함께 제공되는 `vllm_patches/patch_qwen35_moe_text.py` 패치를 적용해야 합니다.
|
| 43 |
+
|
| 44 |
+
### 서빙 (vLLM)
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
# 1. 패치 적용 (vLLM 프로세스 시작 전에 실행)
|
| 48 |
+
python vllm_patches/patch_qwen35_moe_text.py
|
| 49 |
+
|
| 50 |
+
# 2. 서빙
|
| 51 |
+
vllm serve /path/to/Qwen3.5-122B-A10B-abliterated-FP8 \
|
| 52 |
+
--tensor-parallel-size 2 \
|
| 53 |
+
--trust-remote-code \
|
| 54 |
+
--enable-chunked-prefill \
|
| 55 |
+
--max-model-len 32768 \
|
| 56 |
+
--reasoning-parser qwen3
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
### Docker에서 패치 자동 적용
|
| 60 |
+
|
| 61 |
+
entrypoint.sh 시작 부분에 추가:
|
| 62 |
+
```bash
|
| 63 |
+
if [ -f /patches/patch_qwen35_moe_text.py ]; then
|
| 64 |
+
python3 /patches/patch_qwen35_moe_text.py || true
|
| 65 |
+
fi
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
docker-compose.yml에 볼륨 마운트:
|
| 69 |
+
```yaml
|
| 70 |
+
volumes:
|
| 71 |
+
- ./vllm_patches:/patches:ro
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## 패치가 해결하는 문제
|
| 75 |
+
|
| 76 |
+
| 문제 | 원인 | 해결 |
|
| 77 |
+
|------|------|------|
|
| 78 |
+
| `Qwen3_5MoeForCausalLM` 미인식 | vLLM registry 미등록 | TextOnlyShim 등록 |
|
| 79 |
+
| Hybrid cache page-size 에러 | text-only CausalLM 경로 버그 | multimodal wrapper 경로 재사용 |
|
| 80 |
+
| Vision encoder 초기화 실패 | wrapper가 vision 강제 초기화 | vision encoder 스킵 |
|
| 81 |
+
| TP2 block_k 에러 | vision hidden_size=1152 참조 | dummy vision config 주입 |
|
| 82 |
+
|
| 83 |
+
vLLM이 `qwen3_5_moe_text`를 정식 지원하면 패치가 불필요해집니다.
|
| 84 |
+
|
| 85 |
+
## 벤치마크 (한국어 QA 12문항, DGX Spark TP=2)
|
| 86 |
+
|
| 87 |
+
| 지표 | 공식 Qwen FP8 | **본 모델** | BF16+Runtime FP8 |
|
| 88 |
+
|------|:---:|:---:|:---:|
|
| 89 |
+
| 완답 | 12/12 | **12/12** | 11/12 |
|
| 90 |
+
| 속도 | 20.3 tok/s | **29.6 tok/s** | 29.3 tok/s |
|
| 91 |
+
| 크기 | 119 GB | **115 GB** | 228 GB |
|
| 92 |
+
| Swap 필요 | No | **No** | Yes (200GB) |
|
| 93 |
+
| 검열 해제 | ❌ | **✅** | ✅ |
|
| 94 |
+
|
| 95 |
+
Runtime FP8(BF16 원본 + `--quantization fp8`)과 동일한 출력 품질이면서,
|
| 96 |
+
체크포인트 크기 50% 감소 + swap 불필요 + 빠른 로딩.
|
| 97 |
+
|
| 98 |
+
## 하드웨어 요구사항
|
| 99 |
+
|
| 100 |
+
| 구성 | GPU 메모리 | 비고 |
|
| 101 |
+
|------|-----------|------|
|
| 102 |
+
| TP=1 | ~115 GB | H100 80GB 불가, GB200 등 |
|
| 103 |
+
| **TP=2** | **~58 GB/GPU** | DGX Spark, H100×2, A100 80GB×2 |
|
| 104 |
+
| TP=4 | ~29 GB/GPU | A100 40GB×4 |
|
| 105 |
+
|
| 106 |
+
## 양자화 방법
|
| 107 |
+
|
| 108 |
+
calibration 없이 BF16 weight를 128×128 block 단위로 직접 FP8 E4M3 변환합니다.
|
| 109 |
+
[fp8-quantizer](https://github.com/JungkwanBan/fp8-quantizer)로 생성.
|
| 110 |
+
|
| 111 |
+
```bash
|
| 112 |
+
python convert_bf16_to_fp8.py \
|
| 113 |
+
--model wangzhang/Qwen3.5-122B-A10B-abliterated \
|
| 114 |
+
--output ./Qwen3.5-122B-A10B-abliterated-FP8
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
## 원본 모델 정보
|
| 118 |
+
|
| 119 |
+
[wangzhang/Qwen3.5-122B-A10B-abliterated](https://huggingface.co/wangzhang/Qwen3.5-122B-A10B-abliterated):
|
| 120 |
+
[Prometheus](https://github.com/wuwangzhang1216/prometheus)를 사용한 검열 해제 버전.
|
| 121 |
+
Refusal rate 0.5% (200개 테스트 중 1개), KL divergence 0.0115.
|
| 122 |
+
|
| 123 |
+
## 라이선스
|
| 124 |
+
|
| 125 |
+
원본 모델의 라이선스를 따릅니다.
|
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,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3_5MoeForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"model_type": "qwen3_5_moe",
|
| 6 |
+
"text_config": {
|
| 7 |
+
"architectures": [
|
| 8 |
+
"Qwen3_5MoeForCausalLM"
|
| 9 |
+
],
|
| 10 |
+
"attention_bias": false,
|
| 11 |
+
"attention_dropout": 0.0,
|
| 12 |
+
"attn_output_gate": true,
|
| 13 |
+
"bos_token_id": null,
|
| 14 |
+
"dtype": "bfloat16",
|
| 15 |
+
"eos_token_id": 248044,
|
| 16 |
+
"full_attention_interval": 4,
|
| 17 |
+
"head_dim": 256,
|
| 18 |
+
"hidden_act": "silu",
|
| 19 |
+
"hidden_size": 3072,
|
| 20 |
+
"initializer_range": 0.02,
|
| 21 |
+
"layer_types": [
|
| 22 |
+
"linear_attention",
|
| 23 |
+
"linear_attention",
|
| 24 |
+
"linear_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"linear_attention",
|
| 27 |
+
"linear_attention",
|
| 28 |
+
"linear_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"linear_attention",
|
| 31 |
+
"linear_attention",
|
| 32 |
+
"linear_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"linear_attention",
|
| 35 |
+
"linear_attention",
|
| 36 |
+
"linear_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"linear_attention",
|
| 39 |
+
"linear_attention",
|
| 40 |
+
"linear_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"linear_attention",
|
| 43 |
+
"linear_attention",
|
| 44 |
+
"linear_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"linear_attention",
|
| 47 |
+
"linear_attention",
|
| 48 |
+
"linear_attention",
|
| 49 |
+
"full_attention",
|
| 50 |
+
"linear_attention",
|
| 51 |
+
"linear_attention",
|
| 52 |
+
"linear_attention",
|
| 53 |
+
"full_attention",
|
| 54 |
+
"linear_attention",
|
| 55 |
+
"linear_attention",
|
| 56 |
+
"linear_attention",
|
| 57 |
+
"full_attention",
|
| 58 |
+
"linear_attention",
|
| 59 |
+
"linear_attention",
|
| 60 |
+
"linear_attention",
|
| 61 |
+
"full_attention",
|
| 62 |
+
"linear_attention",
|
| 63 |
+
"linear_attention",
|
| 64 |
+
"linear_attention",
|
| 65 |
+
"full_attention",
|
| 66 |
+
"linear_attention",
|
| 67 |
+
"linear_attention",
|
| 68 |
+
"linear_attention",
|
| 69 |
+
"full_attention"
|
| 70 |
+
],
|
| 71 |
+
"linear_conv_kernel_dim": 4,
|
| 72 |
+
"linear_key_head_dim": 128,
|
| 73 |
+
"linear_num_key_heads": 16,
|
| 74 |
+
"linear_num_value_heads": 64,
|
| 75 |
+
"linear_value_head_dim": 128,
|
| 76 |
+
"mamba_ssm_dtype": "float32",
|
| 77 |
+
"max_position_embeddings": 262144,
|
| 78 |
+
"mlp_only_layers": [],
|
| 79 |
+
"model_type": "qwen3_5_moe_text",
|
| 80 |
+
"moe_intermediate_size": 1024,
|
| 81 |
+
"mtp_num_hidden_layers": 1,
|
| 82 |
+
"mtp_use_dedicated_embeddings": false,
|
| 83 |
+
"num_attention_heads": 32,
|
| 84 |
+
"num_experts": 256,
|
| 85 |
+
"num_experts_per_tok": 8,
|
| 86 |
+
"num_hidden_layers": 48,
|
| 87 |
+
"num_key_value_heads": 2,
|
| 88 |
+
"output_router_logits": false,
|
| 89 |
+
"pad_token_id": null,
|
| 90 |
+
"partial_rotary_factor": 0.25,
|
| 91 |
+
"rms_norm_eps": 1e-06,
|
| 92 |
+
"rope_parameters": {
|
| 93 |
+
"mrope_interleaved": true,
|
| 94 |
+
"mrope_section": [
|
| 95 |
+
11,
|
| 96 |
+
11,
|
| 97 |
+
10
|
| 98 |
+
],
|
| 99 |
+
"partial_rotary_factor": 0.25,
|
| 100 |
+
"rope_theta": 10000000,
|
| 101 |
+
"rope_type": "default"
|
| 102 |
+
},
|
| 103 |
+
"router_aux_loss_coef": 0.001,
|
| 104 |
+
"shared_expert_intermediate_size": 1024,
|
| 105 |
+
"tie_word_embeddings": false,
|
| 106 |
+
"transformers_version": "5.3.0.dev0",
|
| 107 |
+
"use_cache": true,
|
| 108 |
+
"vocab_size": 248320
|
| 109 |
+
},
|
| 110 |
+
"quantization_config": {
|
| 111 |
+
"quant_method": "fp8",
|
| 112 |
+
"activation_scheme": "dynamic",
|
| 113 |
+
"act_per_tensor": false,
|
| 114 |
+
"modules_to_not_convert": [
|
| 115 |
+
"lm_head",
|
| 116 |
+
"model.language_model.embed_tokens",
|
| 117 |
+
"model.language_model.layers.0.linear_attn.conv1d",
|
| 118 |
+
"model.language_model.layers.0.linear_attn.in_proj_a",
|
| 119 |
+
"model.language_model.layers.0.linear_attn.in_proj_b",
|
| 120 |
+
"model.language_model.layers.0.mlp.gate",
|
| 121 |
+
"model.language_model.layers.0.mlp.shared_expert_gate",
|
| 122 |
+
"model.language_model.layers.1.linear_attn.conv1d",
|
| 123 |
+
"model.language_model.layers.1.linear_attn.in_proj_a",
|
| 124 |
+
"model.language_model.layers.1.linear_attn.in_proj_b",
|
| 125 |
+
"model.language_model.layers.1.mlp.gate",
|
| 126 |
+
"model.language_model.layers.1.mlp.shared_expert_gate",
|
| 127 |
+
"model.language_model.layers.10.linear_attn.conv1d",
|
| 128 |
+
"model.language_model.layers.10.linear_attn.in_proj_a",
|
| 129 |
+
"model.language_model.layers.10.linear_attn.in_proj_b",
|
| 130 |
+
"model.language_model.layers.10.mlp.gate",
|
| 131 |
+
"model.language_model.layers.10.mlp.shared_expert_gate",
|
| 132 |
+
"model.language_model.layers.11.linear_attn.conv1d",
|
| 133 |
+
"model.language_model.layers.11.linear_attn.in_proj_a",
|
| 134 |
+
"model.language_model.layers.11.linear_attn.in_proj_b",
|
| 135 |
+
"model.language_model.layers.11.mlp.gate",
|
| 136 |
+
"model.language_model.layers.11.mlp.shared_expert_gate",
|
| 137 |
+
"model.language_model.layers.12.linear_attn.conv1d",
|
| 138 |
+
"model.language_model.layers.12.linear_attn.in_proj_a",
|
| 139 |
+
"model.language_model.layers.12.linear_attn.in_proj_b",
|
| 140 |
+
"model.language_model.layers.12.mlp.gate",
|
| 141 |
+
"model.language_model.layers.12.mlp.shared_expert_gate",
|
| 142 |
+
"model.language_model.layers.13.linear_attn.conv1d",
|
| 143 |
+
"model.language_model.layers.13.linear_attn.in_proj_a",
|
| 144 |
+
"model.language_model.layers.13.linear_attn.in_proj_b",
|
| 145 |
+
"model.language_model.layers.13.mlp.gate",
|
| 146 |
+
"model.language_model.layers.13.mlp.shared_expert_gate",
|
| 147 |
+
"model.language_model.layers.14.linear_attn.conv1d",
|
| 148 |
+
"model.language_model.layers.14.linear_attn.in_proj_a",
|
| 149 |
+
"model.language_model.layers.14.linear_attn.in_proj_b",
|
| 150 |
+
"model.language_model.layers.14.mlp.gate",
|
| 151 |
+
"model.language_model.layers.14.mlp.shared_expert_gate",
|
| 152 |
+
"model.language_model.layers.15.linear_attn.conv1d",
|
| 153 |
+
"model.language_model.layers.15.linear_attn.in_proj_a",
|
| 154 |
+
"model.language_model.layers.15.linear_attn.in_proj_b",
|
| 155 |
+
"model.language_model.layers.15.mlp.gate",
|
| 156 |
+
"model.language_model.layers.15.mlp.shared_expert_gate",
|
| 157 |
+
"model.language_model.layers.16.linear_attn.conv1d",
|
| 158 |
+
"model.language_model.layers.16.linear_attn.in_proj_a",
|
| 159 |
+
"model.language_model.layers.16.linear_attn.in_proj_b",
|
| 160 |
+
"model.language_model.layers.16.mlp.gate",
|
| 161 |
+
"model.language_model.layers.16.mlp.shared_expert_gate",
|
| 162 |
+
"model.language_model.layers.17.linear_attn.conv1d",
|
| 163 |
+
"model.language_model.layers.17.linear_attn.in_proj_a",
|
| 164 |
+
"model.language_model.layers.17.linear_attn.in_proj_b",
|
| 165 |
+
"model.language_model.layers.17.mlp.gate",
|
| 166 |
+
"model.language_model.layers.17.mlp.shared_expert_gate",
|
| 167 |
+
"model.language_model.layers.18.linear_attn.conv1d",
|
| 168 |
+
"model.language_model.layers.18.linear_attn.in_proj_a",
|
| 169 |
+
"model.language_model.layers.18.linear_attn.in_proj_b",
|
| 170 |
+
"model.language_model.layers.18.mlp.gate",
|
| 171 |
+
"model.language_model.layers.18.mlp.shared_expert_gate",
|
| 172 |
+
"model.language_model.layers.19.linear_attn.conv1d",
|
| 173 |
+
"model.language_model.layers.19.linear_attn.in_proj_a",
|
| 174 |
+
"model.language_model.layers.19.linear_attn.in_proj_b",
|
| 175 |
+
"model.language_model.layers.19.mlp.gate",
|
| 176 |
+
"model.language_model.layers.19.mlp.shared_expert_gate",
|
| 177 |
+
"model.language_model.layers.2.linear_attn.conv1d",
|
| 178 |
+
"model.language_model.layers.2.linear_attn.in_proj_a",
|
| 179 |
+
"model.language_model.layers.2.linear_attn.in_proj_b",
|
| 180 |
+
"model.language_model.layers.2.mlp.gate",
|
| 181 |
+
"model.language_model.layers.2.mlp.shared_expert_gate",
|
| 182 |
+
"model.language_model.layers.20.linear_attn.conv1d",
|
| 183 |
+
"model.language_model.layers.20.linear_attn.in_proj_a",
|
| 184 |
+
"model.language_model.layers.20.linear_attn.in_proj_b",
|
| 185 |
+
"model.language_model.layers.20.mlp.gate",
|
| 186 |
+
"model.language_model.layers.20.mlp.shared_expert_gate",
|
| 187 |
+
"model.language_model.layers.21.linear_attn.conv1d",
|
| 188 |
+
"model.language_model.layers.21.linear_attn.in_proj_a",
|
| 189 |
+
"model.language_model.layers.21.linear_attn.in_proj_b",
|
| 190 |
+
"model.language_model.layers.21.mlp.gate",
|
| 191 |
+
"model.language_model.layers.21.mlp.shared_expert_gate",
|
| 192 |
+
"model.language_model.layers.22.linear_attn.conv1d",
|
| 193 |
+
"model.language_model.layers.22.linear_attn.in_proj_a",
|
| 194 |
+
"model.language_model.layers.22.linear_attn.in_proj_b",
|
| 195 |
+
"model.language_model.layers.22.mlp.gate",
|
| 196 |
+
"model.language_model.layers.22.mlp.shared_expert_gate",
|
| 197 |
+
"model.language_model.layers.23.linear_attn.conv1d",
|
| 198 |
+
"model.language_model.layers.23.linear_attn.in_proj_a",
|
| 199 |
+
"model.language_model.layers.23.linear_attn.in_proj_b",
|
| 200 |
+
"model.language_model.layers.23.mlp.gate",
|
| 201 |
+
"model.language_model.layers.23.mlp.shared_expert_gate",
|
| 202 |
+
"model.language_model.layers.24.linear_attn.conv1d",
|
| 203 |
+
"model.language_model.layers.24.linear_attn.in_proj_a",
|
| 204 |
+
"model.language_model.layers.24.linear_attn.in_proj_b",
|
| 205 |
+
"model.language_model.layers.24.mlp.gate",
|
| 206 |
+
"model.language_model.layers.24.mlp.shared_expert_gate",
|
| 207 |
+
"model.language_model.layers.25.linear_attn.conv1d",
|
| 208 |
+
"model.language_model.layers.25.linear_attn.in_proj_a",
|
| 209 |
+
"model.language_model.layers.25.linear_attn.in_proj_b",
|
| 210 |
+
"model.language_model.layers.25.mlp.gate",
|
| 211 |
+
"model.language_model.layers.25.mlp.shared_expert_gate",
|
| 212 |
+
"model.language_model.layers.26.linear_attn.conv1d",
|
| 213 |
+
"model.language_model.layers.26.linear_attn.in_proj_a",
|
| 214 |
+
"model.language_model.layers.26.linear_attn.in_proj_b",
|
| 215 |
+
"model.language_model.layers.26.mlp.gate",
|
| 216 |
+
"model.language_model.layers.26.mlp.shared_expert_gate",
|
| 217 |
+
"model.language_model.layers.27.linear_attn.conv1d",
|
| 218 |
+
"model.language_model.layers.27.linear_attn.in_proj_a",
|
| 219 |
+
"model.language_model.layers.27.linear_attn.in_proj_b",
|
| 220 |
+
"model.language_model.layers.27.mlp.gate",
|
| 221 |
+
"model.language_model.layers.27.mlp.shared_expert_gate",
|
| 222 |
+
"model.language_model.layers.28.linear_attn.conv1d",
|
| 223 |
+
"model.language_model.layers.28.linear_attn.in_proj_a",
|
| 224 |
+
"model.language_model.layers.28.linear_attn.in_proj_b",
|
| 225 |
+
"model.language_model.layers.28.mlp.gate",
|
| 226 |
+
"model.language_model.layers.28.mlp.shared_expert_gate",
|
| 227 |
+
"model.language_model.layers.29.linear_attn.conv1d",
|
| 228 |
+
"model.language_model.layers.29.linear_attn.in_proj_a",
|
| 229 |
+
"model.language_model.layers.29.linear_attn.in_proj_b",
|
| 230 |
+
"model.language_model.layers.29.mlp.gate",
|
| 231 |
+
"model.language_model.layers.29.mlp.shared_expert_gate",
|
| 232 |
+
"model.language_model.layers.3.linear_attn.conv1d",
|
| 233 |
+
"model.language_model.layers.3.linear_attn.in_proj_a",
|
| 234 |
+
"model.language_model.layers.3.linear_attn.in_proj_b",
|
| 235 |
+
"model.language_model.layers.3.mlp.gate",
|
| 236 |
+
"model.language_model.layers.3.mlp.shared_expert_gate",
|
| 237 |
+
"model.language_model.layers.30.linear_attn.conv1d",
|
| 238 |
+
"model.language_model.layers.30.linear_attn.in_proj_a",
|
| 239 |
+
"model.language_model.layers.30.linear_attn.in_proj_b",
|
| 240 |
+
"model.language_model.layers.30.mlp.gate",
|
| 241 |
+
"model.language_model.layers.30.mlp.shared_expert_gate",
|
| 242 |
+
"model.language_model.layers.31.linear_attn.conv1d",
|
| 243 |
+
"model.language_model.layers.31.linear_attn.in_proj_a",
|
| 244 |
+
"model.language_model.layers.31.linear_attn.in_proj_b",
|
| 245 |
+
"model.language_model.layers.31.mlp.gate",
|
| 246 |
+
"model.language_model.layers.31.mlp.shared_expert_gate",
|
| 247 |
+
"model.language_model.layers.32.linear_attn.conv1d",
|
| 248 |
+
"model.language_model.layers.32.linear_attn.in_proj_a",
|
| 249 |
+
"model.language_model.layers.32.linear_attn.in_proj_b",
|
| 250 |
+
"model.language_model.layers.32.mlp.gate",
|
| 251 |
+
"model.language_model.layers.32.mlp.shared_expert_gate",
|
| 252 |
+
"model.language_model.layers.33.linear_attn.conv1d",
|
| 253 |
+
"model.language_model.layers.33.linear_attn.in_proj_a",
|
| 254 |
+
"model.language_model.layers.33.linear_attn.in_proj_b",
|
| 255 |
+
"model.language_model.layers.33.mlp.gate",
|
| 256 |
+
"model.language_model.layers.33.mlp.shared_expert_gate",
|
| 257 |
+
"model.language_model.layers.34.linear_attn.conv1d",
|
| 258 |
+
"model.language_model.layers.34.linear_attn.in_proj_a",
|
| 259 |
+
"model.language_model.layers.34.linear_attn.in_proj_b",
|
| 260 |
+
"model.language_model.layers.34.mlp.gate",
|
| 261 |
+
"model.language_model.layers.34.mlp.shared_expert_gate",
|
| 262 |
+
"model.language_model.layers.35.linear_attn.conv1d",
|
| 263 |
+
"model.language_model.layers.35.linear_attn.in_proj_a",
|
| 264 |
+
"model.language_model.layers.35.linear_attn.in_proj_b",
|
| 265 |
+
"model.language_model.layers.35.mlp.gate",
|
| 266 |
+
"model.language_model.layers.35.mlp.shared_expert_gate",
|
| 267 |
+
"model.language_model.layers.36.linear_attn.conv1d",
|
| 268 |
+
"model.language_model.layers.36.linear_attn.in_proj_a",
|
| 269 |
+
"model.language_model.layers.36.linear_attn.in_proj_b",
|
| 270 |
+
"model.language_model.layers.36.mlp.gate",
|
| 271 |
+
"model.language_model.layers.36.mlp.shared_expert_gate",
|
| 272 |
+
"model.language_model.layers.37.linear_attn.conv1d",
|
| 273 |
+
"model.language_model.layers.37.linear_attn.in_proj_a",
|
| 274 |
+
"model.language_model.layers.37.linear_attn.in_proj_b",
|
| 275 |
+
"model.language_model.layers.37.mlp.gate",
|
| 276 |
+
"model.language_model.layers.37.mlp.shared_expert_gate",
|
| 277 |
+
"model.language_model.layers.38.linear_attn.conv1d",
|
| 278 |
+
"model.language_model.layers.38.linear_attn.in_proj_a",
|
| 279 |
+
"model.language_model.layers.38.linear_attn.in_proj_b",
|
| 280 |
+
"model.language_model.layers.38.mlp.gate",
|
| 281 |
+
"model.language_model.layers.38.mlp.shared_expert_gate",
|
| 282 |
+
"model.language_model.layers.39.linear_attn.conv1d",
|
| 283 |
+
"model.language_model.layers.39.linear_attn.in_proj_a",
|
| 284 |
+
"model.language_model.layers.39.linear_attn.in_proj_b",
|
| 285 |
+
"model.language_model.layers.39.mlp.gate",
|
| 286 |
+
"model.language_model.layers.39.mlp.shared_expert_gate",
|
| 287 |
+
"model.language_model.layers.4.linear_attn.conv1d",
|
| 288 |
+
"model.language_model.layers.4.linear_attn.in_proj_a",
|
| 289 |
+
"model.language_model.layers.4.linear_attn.in_proj_b",
|
| 290 |
+
"model.language_model.layers.4.mlp.gate",
|
| 291 |
+
"model.language_model.layers.4.mlp.shared_expert_gate",
|
| 292 |
+
"model.language_model.layers.40.linear_attn.conv1d",
|
| 293 |
+
"model.language_model.layers.40.linear_attn.in_proj_a",
|
| 294 |
+
"model.language_model.layers.40.linear_attn.in_proj_b",
|
| 295 |
+
"model.language_model.layers.40.mlp.gate",
|
| 296 |
+
"model.language_model.layers.40.mlp.shared_expert_gate",
|
| 297 |
+
"model.language_model.layers.41.linear_attn.conv1d",
|
| 298 |
+
"model.language_model.layers.41.linear_attn.in_proj_a",
|
| 299 |
+
"model.language_model.layers.41.linear_attn.in_proj_b",
|
| 300 |
+
"model.language_model.layers.41.mlp.gate",
|
| 301 |
+
"model.language_model.layers.41.mlp.shared_expert_gate",
|
| 302 |
+
"model.language_model.layers.42.linear_attn.conv1d",
|
| 303 |
+
"model.language_model.layers.42.linear_attn.in_proj_a",
|
| 304 |
+
"model.language_model.layers.42.linear_attn.in_proj_b",
|
| 305 |
+
"model.language_model.layers.42.mlp.gate",
|
| 306 |
+
"model.language_model.layers.42.mlp.shared_expert_gate",
|
| 307 |
+
"model.language_model.layers.43.linear_attn.conv1d",
|
| 308 |
+
"model.language_model.layers.43.linear_attn.in_proj_a",
|
| 309 |
+
"model.language_model.layers.43.linear_attn.in_proj_b",
|
| 310 |
+
"model.language_model.layers.43.mlp.gate",
|
| 311 |
+
"model.language_model.layers.43.mlp.shared_expert_gate",
|
| 312 |
+
"model.language_model.layers.44.linear_attn.conv1d",
|
| 313 |
+
"model.language_model.layers.44.linear_attn.in_proj_a",
|
| 314 |
+
"model.language_model.layers.44.linear_attn.in_proj_b",
|
| 315 |
+
"model.language_model.layers.44.mlp.gate",
|
| 316 |
+
"model.language_model.layers.44.mlp.shared_expert_gate",
|
| 317 |
+
"model.language_model.layers.45.linear_attn.conv1d",
|
| 318 |
+
"model.language_model.layers.45.linear_attn.in_proj_a",
|
| 319 |
+
"model.language_model.layers.45.linear_attn.in_proj_b",
|
| 320 |
+
"model.language_model.layers.45.mlp.gate",
|
| 321 |
+
"model.language_model.layers.45.mlp.shared_expert_gate",
|
| 322 |
+
"model.language_model.layers.46.linear_attn.conv1d",
|
| 323 |
+
"model.language_model.layers.46.linear_attn.in_proj_a",
|
| 324 |
+
"model.language_model.layers.46.linear_attn.in_proj_b",
|
| 325 |
+
"model.language_model.layers.46.mlp.gate",
|
| 326 |
+
"model.language_model.layers.46.mlp.shared_expert_gate",
|
| 327 |
+
"model.language_model.layers.47.linear_attn.conv1d",
|
| 328 |
+
"model.language_model.layers.47.linear_attn.in_proj_a",
|
| 329 |
+
"model.language_model.layers.47.linear_attn.in_proj_b",
|
| 330 |
+
"model.language_model.layers.47.mlp.gate",
|
| 331 |
+
"model.language_model.layers.47.mlp.shared_expert_gate",
|
| 332 |
+
"model.language_model.layers.5.linear_attn.conv1d",
|
| 333 |
+
"model.language_model.layers.5.linear_attn.in_proj_a",
|
| 334 |
+
"model.language_model.layers.5.linear_attn.in_proj_b",
|
| 335 |
+
"model.language_model.layers.5.mlp.gate",
|
| 336 |
+
"model.language_model.layers.5.mlp.shared_expert_gate",
|
| 337 |
+
"model.language_model.layers.6.linear_attn.conv1d",
|
| 338 |
+
"model.language_model.layers.6.linear_attn.in_proj_a",
|
| 339 |
+
"model.language_model.layers.6.linear_attn.in_proj_b",
|
| 340 |
+
"model.language_model.layers.6.mlp.gate",
|
| 341 |
+
"model.language_model.layers.6.mlp.shared_expert_gate",
|
| 342 |
+
"model.language_model.layers.7.linear_attn.conv1d",
|
| 343 |
+
"model.language_model.layers.7.linear_attn.in_proj_a",
|
| 344 |
+
"model.language_model.layers.7.linear_attn.in_proj_b",
|
| 345 |
+
"model.language_model.layers.7.mlp.gate",
|
| 346 |
+
"model.language_model.layers.7.mlp.shared_expert_gate",
|
| 347 |
+
"model.language_model.layers.8.linear_attn.conv1d",
|
| 348 |
+
"model.language_model.layers.8.linear_attn.in_proj_a",
|
| 349 |
+
"model.language_model.layers.8.linear_attn.in_proj_b",
|
| 350 |
+
"model.language_model.layers.8.mlp.gate",
|
| 351 |
+
"model.language_model.layers.8.mlp.shared_expert_gate",
|
| 352 |
+
"model.language_model.layers.9.linear_attn.conv1d",
|
| 353 |
+
"model.language_model.layers.9.linear_attn.in_proj_a",
|
| 354 |
+
"model.language_model.layers.9.linear_attn.in_proj_b",
|
| 355 |
+
"model.language_model.layers.9.mlp.gate",
|
| 356 |
+
"model.language_model.layers.9.mlp.shared_expert_gate"
|
| 357 |
+
],
|
| 358 |
+
"weight_block_size": [
|
| 359 |
+
128,
|
| 360 |
+
128
|
| 361 |
+
],
|
| 362 |
+
"weight_per_tensor": false
|
| 363 |
+
},
|
| 364 |
+
"tie_word_embeddings": false,
|
| 365 |
+
"transformers_version": "5.3.0.dev0",
|
| 366 |
+
"vision_config": null
|
| 367 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 248044,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
248046,
|
| 6 |
+
248044
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 248044,
|
| 9 |
+
"temperature": 0.6,
|
| 10 |
+
"top_k": 20,
|
| 11 |
+
"top_p": 0.95,
|
| 12 |
+
"transformers_version": "5.3.0.dev0"
|
| 13 |
+
}
|
model-00001-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7fdcd33aa62a4ae22e09e796539f22f9e53bf25c5b1fb7c84ce5ccbcd2ee5bc0
|
| 3 |
+
size 3222147048
|
model-00002-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:30345eb0ec75088a0d4a889a5a958323e849124472c16df67081511bf96517d6
|
| 3 |
+
size 3224375392
|
model-00003-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1315dc3ee572f5015b8d49fba600321556ee73024f15b30bfdbeb47040b9cc38
|
| 3 |
+
size 3224375824
|
model-00004-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fb607e422a16b3c1c64a9c6fc55e4883df88207d6da5db90d58c666a08929af2
|
| 3 |
+
size 3223496976
|
model-00005-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:20cfa407781784c0075a564cae1534db8789f5141b82dd279f59dd0d8ed886f7
|
| 3 |
+
size 3223696816
|
model-00006-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3d767d67648781841f1e39440e02709f91418f9f1a885027106925d4cc493ebb
|
| 3 |
+
size 3224375584
|
model-00007-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:545ddf9f33b5985e08cdba889513b9eebfe9be52da5af2e65bd40f45c264ea73
|
| 3 |
+
size 3223496968
|
model-00008-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:758d4356adee57a428aeaddf1748c2b7e62eb1e60269ac94f760b75ba29ef0a6
|
| 3 |
+
size 3240317256
|
model-00009-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:90866e0e7fe0d1e687dd3448747de481db9f74a5446fce6077483e3bd3e235bd
|
| 3 |
+
size 3223494952
|
model-00010-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3b4de049c020965ffdbde382e09ee7b9b8ba707ca7b2f6416c2bd94fec59012e
|
| 3 |
+
size 3224373040
|
model-00011-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:031208eec81debe188426e60b61ac9309ebe893e32532ee126801662318be473
|
| 3 |
+
size 3224377944
|
model-00012-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97239be745514439521ecfa4de03039546e655ade4335c0737694438fe51f98c
|
| 3 |
+
size 3222824200
|
model-00013-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:579c5f95dfa2e0881b229283495cc3213e49af8bfb26dddafc494dbb22225fbf
|
| 3 |
+
size 3224372800
|
model-00014-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b75530fcf7c15047e462ac41430b2eb17912f451bcef1ba30d2721dc7a0cafe1
|
| 3 |
+
size 3224377936
|
model-00015-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e509ee70d39bba553e52715fe23b876aa0103aa04d1865c7fa1339f9c817a66d
|
| 3 |
+
size 3224377720
|
model-00016-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ce643775786e39c9c4aa9c60e40c439ce9df5f2cf1a103c12e849610381520d
|
| 3 |
+
size 3221936936
|
model-00017-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d23b56ebf8d9df041850cb679f92b43f8e0346941e182760e52b16817cb7b504
|
| 3 |
+
size 3224373056
|
model-00018-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:99581fbe17564558720457dc9501b5e39fc4e58fda9b30673a0a469ccf2d1add
|
| 3 |
+
size 3224377944
|
model-00019-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2d37884a4cb0d5406e906cc543cd03c94f037a81a0301a5947933169bdc10850
|
| 3 |
+
size 3222824256
|
model-00020-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:da5a4b406183759d275d31925ed457f8506ab87d05195302e1c381e689ea6501
|
| 3 |
+
size 3224372824
|
model-00021-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:86f155aa069e31c750158286434371df19096f330909a0805479ededbbfb91ba
|
| 3 |
+
size 3224377936
|
model-00022-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a2484d8027f746da494839533110258680cb50a0641548fc72e9cffad5ab92b2
|
| 3 |
+
size 3222823552
|
model-00023-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:65cba12b6a60a1c5d0c04321e3b33462deb4cd5c80d42a5036dc3db8521055ff
|
| 3 |
+
size 3224372560
|
model-00024-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8501d30258d824336ba7c7d2b9ab16ebd58da778b41c77a9246104f5a6909847
|
| 3 |
+
size 3224377736
|
model-00025-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:414ffa4f6b12c44a3ac23909e2bcc6fa7c422d349736693ce7f8a27b87fe09b4
|
| 3 |
+
size 3224377944
|
model-00026-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6c1632893165ec76e1a8e088847df0e2b021e0f6325efb0012cbb1d15ae64ebb
|
| 3 |
+
size 3222819320
|
model-00027-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6ab61a92de7cca327405b872df1f689b1609f26eac3b80497762e543ae408d28
|
| 3 |
+
size 3224377504
|
model-00028-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a1a8f82367eab9a68c40bf45257028c85331e37cdf4154c4a61b40024d1c543d
|
| 3 |
+
size 3224377936
|
model-00029-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a505ea3535f549a3039fdd244a6386acee315faa5ef16178497259db442247f
|
| 3 |
+
size 3264409712
|
model-00030-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4ca4367e0017a719db470b4390c9b63a51ea661ccb1a39e420ca76d199a99320
|
| 3 |
+
size 3223691272
|
model-00031-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c1c759b411efc03efe79da02eda01ecb59d8643607f941c62e438a0c94fef7bf
|
| 3 |
+
size 3224377496
|
model-00032-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:81862d90448b6369090c58eac26084db2ab1dd054006e580e1e018fbf90bdfcd
|
| 3 |
+
size 3223499024
|
model-00033-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:69d9d070460b75122934a936b7ef0490b1a5da658dbcd005bfad026c53a886cf
|
| 3 |
+
size 3223698408
|
model-00034-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e777d95d3e43fb39a8817adfc89b6b9936cdba093f058a2810d5b77f4a93e52
|
| 3 |
+
size 3224377496
|
model-00035-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:94fb043926dd2ff3e1f6f9ac62deef6c46e0ec20d4661febc8d6a43962d26894
|
| 3 |
+
size 3223499008
|
model-00036-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e720a35a937f310daf4fdb760185b9167d4667a2e8e1f25edc184eda204e1674
|
| 3 |
+
size 3224373464
|
model-00037-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:70523c3e00e96e0164bbe1b357c33348d7a37e353234ac4e52ff42578d803e43
|
| 3 |
+
size 3223703648
|
model-00038-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c9d8eae78544bdde2a7dbad55a58c693d2bc15a1c1811f0d06c6ca07f9bcdfec
|
| 3 |
+
size 3223498824
|
model-00039-of-00039.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9bbd1b92cb0befef58c847070212581ca588e3f43265a1d07fc8b21091990fd5
|
| 3 |
+
size 1153165696
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"size": {
|
| 3 |
+
"longest_edge": 16777216,
|
| 4 |
+
"shortest_edge": 65536
|
| 5 |
+
},
|
| 6 |
+
"patch_size": 16,
|
| 7 |
+
"temporal_patch_size": 2,
|
| 8 |
+
"merge_size": 2,
|
| 9 |
+
"image_mean": [
|
| 10 |
+
0.5,
|
| 11 |
+
0.5,
|
| 12 |
+
0.5
|
| 13 |
+
],
|
| 14 |
+
"image_std": [
|
| 15 |
+
0.5,
|
| 16 |
+
0.5,
|
| 17 |
+
0.5
|
| 18 |
+
],
|
| 19 |
+
"processor_class": "Qwen3VLProcessor",
|
| 20 |
+
"image_processor_type": "Qwen2VLImageProcessorFast"
|
| 21 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:639e352c0f904c1875d448ebed6f6faac005fd3eb58393b7f1fb3ff044e5ca03
|
| 3 |
+
size 19989510
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"model_max_length": 262144,
|
| 14 |
+
"model_specific_special_tokens": {
|
| 15 |
+
"audio_bos_token": "<|audio_start|>",
|
| 16 |
+
"audio_eos_token": "<|audio_end|>",
|
| 17 |
+
"audio_token": "<|audio_pad|>",
|
| 18 |
+
"image_token": "<|image_pad|>",
|
| 19 |
+
"video_token": "<|video_pad|>",
|
| 20 |
+
"vision_bos_token": "<|vision_start|>",
|
| 21 |
+
"vision_eos_token": "<|vision_end|>"
|
| 22 |
+
},
|
| 23 |
+
"pad_token": "<|endoftext|>",
|
| 24 |
+
"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+",
|
| 25 |
+
"split_special_tokens": false,
|
| 26 |
+
"tokenizer_class": "TokenizersBackend",
|
| 27 |
+
"unk_token": null,
|
| 28 |
+
"video_token": "<|video_pad|>",
|
| 29 |
+
"vision_bos_token": "<|vision_start|>",
|
| 30 |
+
"vision_eos_token": "<|vision_end|>"
|
| 31 |
+
}
|
vllm_patches/patch_qwen35_moe_text.py
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
vLLM patch: Qwen3.5 MoE text-only compatibility shim.
|
| 4 |
+
|
| 5 |
+
Creates a text-only subclass of Qwen3_5MoeForConditionalGeneration that:
|
| 6 |
+
- Reuses the wrapper's hybrid cache-spec calculation (fixes page-size bug)
|
| 7 |
+
- Skips vision encoder initialization entirely
|
| 8 |
+
- Sets supports_multimodal = False (prevents multimodal warmup)
|
| 9 |
+
- Registers as Qwen3_5MoeForCausalLM in the model registry
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import re
|
| 13 |
+
import textwrap
|
| 14 |
+
|
| 15 |
+
REGISTRY_PATH = "/usr/local/lib/python3.12/dist-packages/vllm/model_executor/models/registry.py"
|
| 16 |
+
QWEN35_PATH = "/usr/local/lib/python3.12/dist-packages/vllm/model_executor/models/qwen3_5.py"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def patch_registry():
|
| 20 |
+
"""Map Qwen3_5MoeForCausalLM -> Qwen3_5MoeTextOnlyShim."""
|
| 21 |
+
with open(REGISTRY_PATH) as f:
|
| 22 |
+
content = f.read()
|
| 23 |
+
|
| 24 |
+
entry = '"Qwen3_5MoeForCausalLM"'
|
| 25 |
+
if entry in content:
|
| 26 |
+
# Update existing entry
|
| 27 |
+
content = re.sub(
|
| 28 |
+
r'"Qwen3_5MoeForCausalLM": \(\s*"qwen3_5",\s*"[^"]+",\s*\)',
|
| 29 |
+
'"Qwen3_5MoeForCausalLM": (\n "qwen3_5",\n "Qwen3_5MoeTextOnlyShim",\n )',
|
| 30 |
+
content,
|
| 31 |
+
)
|
| 32 |
+
print("[patch] registry: Updated Qwen3_5MoeForCausalLM -> TextOnlyShim")
|
| 33 |
+
else:
|
| 34 |
+
# Add new entry
|
| 35 |
+
target = '"Qwen3_5MoeForConditionalGeneration": (\n "qwen3_5",\n "Qwen3_5MoeForConditionalGeneration",\n ),'
|
| 36 |
+
insert = target + '\n "Qwen3_5MoeForCausalLM": (\n "qwen3_5",\n "Qwen3_5MoeTextOnlyShim",\n ),'
|
| 37 |
+
if target in content:
|
| 38 |
+
content = content.replace(target, insert)
|
| 39 |
+
else:
|
| 40 |
+
lines = content.split('\n')
|
| 41 |
+
for i, line in enumerate(lines):
|
| 42 |
+
if '"Qwen3_5MoeForConditionalGeneration"' in line:
|
| 43 |
+
for j in range(i, min(i+5, len(lines))):
|
| 44 |
+
if lines[j].strip() == '),':
|
| 45 |
+
lines.insert(j+1, ' "Qwen3_5MoeForCausalLM": (')
|
| 46 |
+
lines.insert(j+2, ' "qwen3_5",')
|
| 47 |
+
lines.insert(j+3, ' "Qwen3_5MoeTextOnlyShim",')
|
| 48 |
+
lines.insert(j+4, ' ),')
|
| 49 |
+
content = '\n'.join(lines)
|
| 50 |
+
break
|
| 51 |
+
break
|
| 52 |
+
print("[patch] registry: Added Qwen3_5MoeForCausalLM -> TextOnlyShim")
|
| 53 |
+
|
| 54 |
+
with open(REGISTRY_PATH, 'w') as f:
|
| 55 |
+
f.write(content)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def patch_add_text_only_shim():
|
| 59 |
+
"""Add Qwen3_5MoeTextOnlyShim class to qwen3_5.py."""
|
| 60 |
+
with open(QWEN35_PATH) as f:
|
| 61 |
+
content = f.read()
|
| 62 |
+
|
| 63 |
+
if "Qwen3_5MoeTextOnlyShim" in content:
|
| 64 |
+
print("[patch] qwen3_5: TextOnlyShim already exists")
|
| 65 |
+
return
|
| 66 |
+
|
| 67 |
+
# The shim class: inherits ConditionalGeneration for cache-spec,
|
| 68 |
+
# but overrides __init__ to skip vision, and sets supports_multimodal = False
|
| 69 |
+
shim_code = '''
|
| 70 |
+
|
| 71 |
+
########################################################
|
| 72 |
+
# Text-only compatibility shim
|
| 73 |
+
# Reuses ConditionalGeneration's cache-spec but skips vision
|
| 74 |
+
########################################################
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class Qwen3_5MoeTextOnlyShim(Qwen3_5MoeForConditionalGeneration):
|
| 78 |
+
"""Text-only shim for Qwen3.5 MoE CausalLM checkpoints.
|
| 79 |
+
|
| 80 |
+
Inherits Qwen3_5MoeForConditionalGeneration for hybrid cache-spec
|
| 81 |
+
calculation (fixing the page-size bug in CausalLM path), but:
|
| 82 |
+
- Does NOT initialize vision encoder
|
| 83 |
+
- Does NOT register as multimodal
|
| 84 |
+
- Rejects multimodal input at forward time
|
| 85 |
+
"""
|
| 86 |
+
|
| 87 |
+
# Override: NOT a multimodal model
|
| 88 |
+
supports_multimodal = False
|
| 89 |
+
|
| 90 |
+
def __init__(self, *, vllm_config, prefix: str = "model"):
|
| 91 |
+
import logging
|
| 92 |
+
log = logging.getLogger("qwen3_5_text_only_shim")
|
| 93 |
+
|
| 94 |
+
# Skip the parent's multimodal __init__ entirely
|
| 95 |
+
# Go directly to nn.Module.__init__
|
| 96 |
+
nn.Module.__init__(self)
|
| 97 |
+
|
| 98 |
+
config = vllm_config.model_config.hf_config
|
| 99 |
+
self.config = config
|
| 100 |
+
|
| 101 |
+
# vision_config is now a dummy with safe values (hidden_size=128)
|
| 102 |
+
# created by the patched Qwen3_5MoeConfig.__init__
|
| 103 |
+
vc = getattr(config, "vision_config", None)
|
| 104 |
+
if vc is not None:
|
| 105 |
+
log.info(f"vision_config present: hidden_size={getattr(vc, 'hidden_size', '?')}")
|
| 106 |
+
|
| 107 |
+
# Inject dummy MultiModalConfig so _mark_language_model works
|
| 108 |
+
# All defaults are safe for text-only (mm_encoder_only=False, etc.)
|
| 109 |
+
from vllm.config.multimodal import MultiModalConfig
|
| 110 |
+
if vllm_config.model_config.multimodal_config is None:
|
| 111 |
+
vllm_config.model_config.multimodal_config = MultiModalConfig()
|
| 112 |
+
log.info("Injected dummy MultiModalConfig for text-only shim")
|
| 113 |
+
|
| 114 |
+
self.multimodal_config = vllm_config.model_config.multimodal_config
|
| 115 |
+
self.visual = None
|
| 116 |
+
self.use_data_parallel = False
|
| 117 |
+
self.is_multimodal_pruning_enabled = False
|
| 118 |
+
self._text_only_mode = True
|
| 119 |
+
|
| 120 |
+
log.info("Qwen3_5MoeTextOnlyShim: text-only mode, vision encoder skipped")
|
| 121 |
+
|
| 122 |
+
# Use _mark_language_model to preserve wrapper's cache-spec path
|
| 123 |
+
with self._mark_language_model(vllm_config):
|
| 124 |
+
self.language_model = Qwen3_5MoeForCausalLM(
|
| 125 |
+
vllm_config=vllm_config,
|
| 126 |
+
prefix=maybe_prefix(prefix, "language_model"),
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
self.make_empty_intermediate_tensors = (
|
| 130 |
+
self.language_model.make_empty_intermediate_tensors
|
| 131 |
+
)
|
| 132 |
+
|
| 133 |
+
# set MoE hyperparameters
|
| 134 |
+
self.set_moe_parameters()
|
| 135 |
+
|
| 136 |
+
def forward(self, *args, **kwargs):
|
| 137 |
+
"""Forward: delegate to language_model, reject multimodal input."""
|
| 138 |
+
if kwargs.get("pixel_values") is not None or kwargs.get("image_grid_thw") is not None:
|
| 139 |
+
raise ValueError(
|
| 140 |
+
"Qwen3_5MoeTextOnlyShim does not support multimodal input. "
|
| 141 |
+
"This model was loaded as text-only."
|
| 142 |
+
)
|
| 143 |
+
return self.language_model(*args, **kwargs)
|
| 144 |
+
|
| 145 |
+
def load_weights(self, weights):
|
| 146 |
+
"""Load weights with key remapping for text-only checkpoints."""
|
| 147 |
+
import logging
|
| 148 |
+
log = logging.getLogger("qwen3_5_text_only_shim")
|
| 149 |
+
|
| 150 |
+
def _remap(weights_iter):
|
| 151 |
+
remapped = False
|
| 152 |
+
for name, tensor in weights_iter:
|
| 153 |
+
new_name = name
|
| 154 |
+
# ModelOpt export uses model.language_model.* prefix
|
| 155 |
+
# which matches our module tree (self.language_model.model.*)
|
| 156 |
+
# No remapping needed for ConditionalGeneration path
|
| 157 |
+
# since self.language_model prefix is already "language_model"
|
| 158 |
+
yield new_name, tensor
|
| 159 |
+
|
| 160 |
+
loader = AutoWeightsLoader(self, skip_prefixes=["mtp.", "visual."])
|
| 161 |
+
return loader.load_weights(_remap(weights), mapper=self.hf_to_vllm_mapper)
|
| 162 |
+
|
| 163 |
+
'''
|
| 164 |
+
|
| 165 |
+
# Insert before the final class or at the end of file
|
| 166 |
+
# Find the last class definition to insert after
|
| 167 |
+
insert_pos = content.rfind('\nclass Qwen3_5MoeForConditionalGeneration')
|
| 168 |
+
if insert_pos == -1:
|
| 169 |
+
# Append at end
|
| 170 |
+
content += shim_code
|
| 171 |
+
else:
|
| 172 |
+
# Find the end of Qwen3_5MoeForConditionalGeneration class (next class or EOF)
|
| 173 |
+
# Insert after the entire ConditionalGeneration class
|
| 174 |
+
# Find the set_moe_parameters() call which is the last line of __init__
|
| 175 |
+
end_of_class = content.find('\nclass ', insert_pos + 10)
|
| 176 |
+
if end_of_class == -1:
|
| 177 |
+
content += shim_code
|
| 178 |
+
else:
|
| 179 |
+
# Actually, insert at the very end of the file
|
| 180 |
+
content += shim_code
|
| 181 |
+
|
| 182 |
+
with open(QWEN35_PATH, 'w') as f:
|
| 183 |
+
f.write(content)
|
| 184 |
+
print("[patch] qwen3_5: Added Qwen3_5MoeTextOnlyShim class")
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def patch_processing_info():
|
| 188 |
+
"""Patch ProcessingInfo to handle text-only config gracefully."""
|
| 189 |
+
with open(QWEN35_PATH) as f:
|
| 190 |
+
content = f.read()
|
| 191 |
+
|
| 192 |
+
if "text_only_shim_processing" in content:
|
| 193 |
+
print("[patch] qwen3_5: ProcessingInfo already patched")
|
| 194 |
+
return
|
| 195 |
+
|
| 196 |
+
old = '''class Qwen3_5MoeProcessingInfo(Qwen3VLProcessingInfo):
|
| 197 |
+
def get_hf_config(self):
|
| 198 |
+
return self.ctx.get_hf_config(Qwen3_5MoeConfig)'''
|
| 199 |
+
|
| 200 |
+
new = '''class Qwen3_5MoeProcessingInfo(Qwen3VLProcessingInfo):
|
| 201 |
+
# text_only_shim_processing
|
| 202 |
+
def get_hf_config(self):
|
| 203 |
+
try:
|
| 204 |
+
return self.ctx.get_hf_config(Qwen3_5MoeConfig)
|
| 205 |
+
except TypeError:
|
| 206 |
+
return self.ctx.model_config.hf_config
|
| 207 |
+
|
| 208 |
+
def get_data_parser(self):
|
| 209 |
+
config = self.get_hf_config()
|
| 210 |
+
if not hasattr(config, "vision_config") or config.vision_config is None:
|
| 211 |
+
from vllm.multimodal.parse import MultiModalDataParser
|
| 212 |
+
return MultiModalDataParser()
|
| 213 |
+
return super().get_data_parser()
|
| 214 |
+
|
| 215 |
+
def get_max_image_tokens(self):
|
| 216 |
+
config = self.get_hf_config()
|
| 217 |
+
if not hasattr(config, "vision_config") or config.vision_config is None:
|
| 218 |
+
return 0
|
| 219 |
+
return super().get_max_image_tokens()
|
| 220 |
+
|
| 221 |
+
def get_max_video_tokens(self, seq_len, mm_counts=None):
|
| 222 |
+
config = self.get_hf_config()
|
| 223 |
+
if not hasattr(config, "vision_config") or config.vision_config is None:
|
| 224 |
+
return 0
|
| 225 |
+
return super().get_max_video_tokens(seq_len, mm_counts)
|
| 226 |
+
|
| 227 |
+
def get_image_size_with_most_features(self):
|
| 228 |
+
config = self.get_hf_config()
|
| 229 |
+
if not hasattr(config, "vision_config") or config.vision_config is None:
|
| 230 |
+
return (0, 0)
|
| 231 |
+
return super().get_image_size_with_most_features()'''
|
| 232 |
+
|
| 233 |
+
if old in content:
|
| 234 |
+
content = content.replace(old, new)
|
| 235 |
+
with open(QWEN35_PATH, 'w') as f:
|
| 236 |
+
f.write(content)
|
| 237 |
+
print("[patch] qwen3_5: ProcessingInfo patched")
|
| 238 |
+
else:
|
| 239 |
+
print("[patch] qwen3_5: ProcessingInfo already modified or not found")
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
def patch_config_vision_default():
|
| 243 |
+
"""Prevent Qwen3_5MoeConfig from auto-creating vision_config when None.
|
| 244 |
+
|
| 245 |
+
The original code: if vision_config is None -> create default VisionConfig.
|
| 246 |
+
We change it: if vision_config is None -> keep as None.
|
| 247 |
+
This prevents vision hidden_size=1152 from leaking into FP8 TP2 validation.
|
| 248 |
+
"""
|
| 249 |
+
CONFIG_PATH = "/usr/local/lib/python3.12/dist-packages/vllm/transformers_utils/configs/qwen3_5_moe.py"
|
| 250 |
+
|
| 251 |
+
with open(CONFIG_PATH) as f:
|
| 252 |
+
content = f.read()
|
| 253 |
+
|
| 254 |
+
if "text_only_shim_config" in content:
|
| 255 |
+
print("[patch] config: vision_config default already patched")
|
| 256 |
+
return
|
| 257 |
+
|
| 258 |
+
old = ' elif vision_config is None:\n self.vision_config = self.sub_configs["vision_config"]()'
|
| 259 |
+
# Instead of None, use a dummy with minimal safe values
|
| 260 |
+
# This prevents NoneType errors in multimodal processing code
|
| 261 |
+
# while keeping hidden_size small enough for TP2 block validation
|
| 262 |
+
new = ''' elif vision_config is None:
|
| 263 |
+
# text_only_shim_config: create minimal dummy vision config
|
| 264 |
+
# with safe values that pass TP2 block-wise FP8 validation
|
| 265 |
+
# hidden_size=128 is divisible by block_size=128 and any TP
|
| 266 |
+
self.vision_config = self.sub_configs["vision_config"](
|
| 267 |
+
hidden_size=128, intermediate_size=256, depth=0,
|
| 268 |
+
num_heads=1, patch_size=16, spatial_merge_size=2,
|
| 269 |
+
temporal_patch_size=2, in_channels=3,
|
| 270 |
+
)'''
|
| 271 |
+
|
| 272 |
+
if old in content:
|
| 273 |
+
content = content.replace(old, new)
|
| 274 |
+
with open(CONFIG_PATH, 'w') as f:
|
| 275 |
+
f.write(content)
|
| 276 |
+
print("[patch] config: vision_config default -> None (text-only safe)")
|
| 277 |
+
else:
|
| 278 |
+
print("[patch] config: Could not find vision_config default pattern")
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
if __name__ == "__main__":
|
| 282 |
+
print("=" * 55)
|
| 283 |
+
print("vLLM Patch: Qwen3.5 MoE text-only shim v3")
|
| 284 |
+
print("=" * 55)
|
| 285 |
+
patch_registry()
|
| 286 |
+
patch_add_text_only_shim()
|
| 287 |
+
patch_processing_info()
|
| 288 |
+
patch_config_vision_default()
|
| 289 |
+
print("=" * 55)
|
| 290 |
+
print("Patch complete")
|