yujiepan commited on
Commit
3f5f685
·
verified ·
1 Parent(s): fccc86c

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +14 -9
  2. config.json +2 -2
  3. model.safetensors +2 -2
  4. tokenizer.json +2 -2
README.md CHANGED
@@ -13,7 +13,7 @@ Structural comparison with `Qwen/Qwen3.8-27B`:
13
  | Input modalities | Text, image, video | Same |
14
  | Vocabulary | 248,320 | Same; special-token IDs preserved |
15
  | Backbone layers | 64 | 8 |
16
- | Hidden size | 5,120 | 128 |
17
  | Attention Q/KV heads; head dim | 24/4; 256 | 12/2; 128 |
18
  | Attention cycle | 3 linear + 1 full | Same; two complete cycles |
19
  | Linear-attention key/value heads | 16/48 | 2/6 |
@@ -22,12 +22,12 @@ Structural comparison with `Qwen/Qwen3.8-27B`:
22
  | MTP | 1 full-attention layer; shared embeddings | Same |
23
  | Vision layers / hidden size | 27 / 1,152 | 2 / 64 |
24
  | Vision patch / temporal patch / merge | 16 / 2 / 2 | Same |
25
- | Vision output size | 5,120 | 128 |
26
  | Checkpoint format | BF16 | Same |
27
 
28
  | File path | Size |
29
  |------|------|
30
- | model.safetensors | 139.9MB |
31
 
32
 
33
  ### Example usage:
@@ -40,9 +40,11 @@ Structural comparison with `Qwen/Qwen3.8-27B`:
40
 
41
  ```bash
42
  model_id=tiny-random/qwen3.8
43
- SGLANG_JIT_DEEPGEMM_FAST_WARMUP=1 sglang serve \
44
  --model-path $model_id \
45
  --tp-size 2 \
 
 
46
  --speculative-algorithm NEXTN \
47
  --speculative-num-steps 3 \
48
  --speculative-eagle-topk 1 \
@@ -91,7 +93,7 @@ import torch
91
  from huggingface_hub import hf_hub_download
92
  from transformers import AutoConfig, AutoModelForImageTextToText, AutoProcessor, GenerationConfig, set_seed
93
  # Creation helpers: pip install git+https://github.com/yujiepan/tiny-random.git
94
- from tiny_random.qwen_utils import add_qwen_mtp, save_random_qwen_checkpoint
95
 
96
  source_model_id = "Qwen/Qwen3.8-27B"
97
  save_folder = "/tmp/tiny-random/qwen38"
@@ -101,7 +103,7 @@ folder = Path(save_folder)
101
  folder.mkdir(parents=True, exist_ok=True)
102
  raw = json.loads(Path(hf_hub_download(source_model_id, "config.json", revision=source_revision)).read_text())
103
  raw["text_config"].update(
104
- hidden_size=128, head_dim=128, num_hidden_layers=8,
105
  layer_types=(["linear_attention"] * 3 + ["full_attention"]) * 2,
106
  num_attention_heads=12, num_key_value_heads=2,
107
  linear_num_key_heads=2, linear_num_value_heads=6,
@@ -109,7 +111,7 @@ raw["text_config"].update(
109
  intermediate_size=512,
110
  )
111
  raw["text_config"]["rope_parameters"]["mrope_section"] = [6, 5, 5]
112
- raw["vision_config"].update(depth=2, hidden_size=64, intermediate_size=128, num_heads=2, out_hidden_size=128)
113
  (folder / "config.json").write_text(json.dumps(raw, indent=2))
114
  config = AutoConfig.from_pretrained(folder)
115
  model = AutoModelForImageTextToText.from_config(config, dtype=torch.bfloat16)
@@ -117,6 +119,8 @@ add_qwen_mtp(model, model.model.language_model)
117
  save_random_qwen_checkpoint(model, folder)
118
  AutoProcessor.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
119
  GenerationConfig.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
 
 
120
  ```
121
 
122
  </details>
@@ -126,7 +130,7 @@ GenerationConfig.from_pretrained(source_model_id, revision=source_revision).save
126
  <details><summary>Click to expand</summary>
127
 
128
  ```text
129
- Qwen3.8 VL: 8 backbone layers + 1 MTP layer; hidden_size=128
130
  ```
131
 
132
  </details>
@@ -149,4 +153,5 @@ Qwen3.8 VL: 8 backbone layers + 1 MTP layer; hidden_size=128
149
 
150
  ### Change log:
151
 
152
- - 2026-10-23: Initial version.
 
 
13
  | Input modalities | Text, image, video | Same |
14
  | Vocabulary | 248,320 | Same; special-token IDs preserved |
15
  | Backbone layers | 64 | 8 |
16
+ | Hidden size | 5,120 | 16 |
17
  | Attention Q/KV heads; head dim | 24/4; 256 | 12/2; 128 |
18
  | Attention cycle | 3 linear + 1 full | Same; two complete cycles |
19
  | Linear-attention key/value heads | 16/48 | 2/6 |
 
22
  | MTP | 1 full-attention layer; shared embeddings | Same |
23
  | Vision layers / hidden size | 27 / 1,152 | 2 / 64 |
24
  | Vision patch / temporal patch / merge | 16 / 2 / 2 | Same |
25
+ | Vision output size | 5,120 | 16 |
26
  | Checkpoint format | BF16 | Same |
27
 
28
  | File path | Size |
29
  |------|------|
30
+ | model.safetensors | 18.2MB |
31
 
32
 
33
  ### Example usage:
 
40
 
41
  ```bash
42
  model_id=tiny-random/qwen3.8
43
+ sglang serve \
44
  --model-path $model_id \
45
  --tp-size 2 \
46
+ --fp8-gemm-backend triton \
47
+ --moe-runner-backend triton \
48
  --speculative-algorithm NEXTN \
49
  --speculative-num-steps 3 \
50
  --speculative-eagle-topk 1 \
 
93
  from huggingface_hub import hf_hub_download
94
  from transformers import AutoConfig, AutoModelForImageTextToText, AutoProcessor, GenerationConfig, set_seed
95
  # Creation helpers: pip install git+https://github.com/yujiepan/tiny-random.git
96
+ from tiny_random.qwen_utils import add_qwen_mtp, save_random_qwen_checkpoint, compact_qwen_tokenizer, check_qwen_repo_size
97
 
98
  source_model_id = "Qwen/Qwen3.8-27B"
99
  save_folder = "/tmp/tiny-random/qwen38"
 
103
  folder.mkdir(parents=True, exist_ok=True)
104
  raw = json.loads(Path(hf_hub_download(source_model_id, "config.json", revision=source_revision)).read_text())
105
  raw["text_config"].update(
106
+ hidden_size=16, head_dim=128, num_hidden_layers=8,
107
  layer_types=(["linear_attention"] * 3 + ["full_attention"]) * 2,
108
  num_attention_heads=12, num_key_value_heads=2,
109
  linear_num_key_heads=2, linear_num_value_heads=6,
 
111
  intermediate_size=512,
112
  )
113
  raw["text_config"]["rope_parameters"]["mrope_section"] = [6, 5, 5]
114
+ raw["vision_config"].update(depth=2, hidden_size=64, intermediate_size=128, num_heads=2, out_hidden_size=16)
115
  (folder / "config.json").write_text(json.dumps(raw, indent=2))
116
  config = AutoConfig.from_pretrained(folder)
117
  model = AutoModelForImageTextToText.from_config(config, dtype=torch.bfloat16)
 
119
  save_random_qwen_checkpoint(model, folder)
120
  AutoProcessor.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
121
  GenerationConfig.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
122
+ compact_qwen_tokenizer(folder)
123
+ check_qwen_repo_size(folder)
124
  ```
125
 
126
  </details>
 
130
  <details><summary>Click to expand</summary>
131
 
132
  ```text
133
+ Qwen3.8 VL: 8 backbone layers + 1 MTP layer; hidden_size=16
134
  ```
135
 
136
  </details>
 
153
 
154
  ### Change log:
155
 
156
+ - 2026-10-23: Initial version.
157
+ - 2026-10-23: Reduced all repo files below 50 MB; GPU-validated TP=2, MTP and CUDA Graph.
config.json CHANGED
@@ -15,7 +15,7 @@
15
  "full_attention_interval": 4,
16
  "head_dim": 128,
17
  "hidden_act": "silu",
18
- "hidden_size": 128,
19
  "initializer_range": 0.02,
20
  "intermediate_size": 512,
21
  "layer_types": [
@@ -74,7 +74,7 @@
74
  "model_type": "qwen3_5",
75
  "num_heads": 2,
76
  "num_position_embeddings": 2304,
77
- "out_hidden_size": 128,
78
  "patch_size": 16,
79
  "spatial_merge_size": 2,
80
  "temporal_patch_size": 2
 
15
  "full_attention_interval": 4,
16
  "head_dim": 128,
17
  "hidden_act": "silu",
18
+ "hidden_size": 16,
19
  "initializer_range": 0.02,
20
  "intermediate_size": 512,
21
  "layer_types": [
 
74
  "model_type": "qwen3_5",
75
  "num_heads": 2,
76
  "num_position_embeddings": 2304,
77
+ "out_hidden_size": 16,
78
  "patch_size": 16,
79
  "spatial_merge_size": 2,
80
  "temporal_patch_size": 2
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0ad7d04172397ad42753662b4786257103b27440fd2bb64c07663c37da9e5135
3
- size 139932696
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45266a20a08495d89509458cd2caf93f6946e1e34d260a281511c645a6ee6a3a
3
+ size 18219872
tokenizer.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a5cd9732badce41de57e6efce8302930ded1c1188c5f81feb2bd6c24c4a1941f
3
- size 19989339
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d765ac5a92a75f240af39f9358a09a140216dce113e57754c91042ef8b9e4e8
3
+ size 10079700