Add files using upload-large-folder tool
Browse files- .gitattributes +3 -0
- README.md +6 -4
- img_in.mnn +0 -0
- img_in.mnn.weight +2 -2
- text_encoder/te_vl_config.json +18 -0
- text_encoder/te_vl_llm_config.json +47 -0
- text_encoder/visual.mnn +3 -0
- text_encoder/visual.mnn.weight +3 -0
- vae_decoder.mnn +1 -1
- vae_encoder.mnn +3 -0
.gitattributes
CHANGED
|
@@ -40,3 +40,6 @@ txt_in.mnn.weight filter=lfs diff=lfs merge=lfs -text
|
|
| 40 |
vae_decoder.mnn filter=lfs diff=lfs merge=lfs -text
|
| 41 |
text_encoder/llm.mnn.weight filter=lfs diff=lfs merge=lfs -text
|
| 42 |
dit.mnn.weight filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
vae_decoder.mnn filter=lfs diff=lfs merge=lfs -text
|
| 41 |
text_encoder/llm.mnn.weight filter=lfs diff=lfs merge=lfs -text
|
| 42 |
dit.mnn.weight filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
text_encoder/visual.mnn filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
vae_encoder.mnn filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
text_encoder/visual.mnn.weight filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -18,7 +18,8 @@ tags:
|
|
| 18 |
# Qwen-Image-2.1 · MNN (int4) for Android
|
| 19 |
|
| 20 |
[Qwen/Qwen-Image-2.1](https://huggingface.co/Qwen/Qwen-Image-2.1) converted to [MNN](https://github.com/alibaba/MNN)
|
| 21 |
-
for on-device text-to-image at 512×512
|
|
|
|
| 22 |
|
| 23 |
Runtime, Android library and demo app: **[github.com/scsonic/libQwenImage21](https://github.com/scsonic/libQwenImage21)**
|
| 24 |
|
|
@@ -31,9 +32,10 @@ Runtime, Android library and demo app: **[github.com/scsonic/libQwenImage21](htt
|
|
| 31 |
| Path | What | Size |
|
| 32 |
|---|---|---|
|
| 33 |
| `dit.mnn` + `.weight` | 7B single-stream DiT (32 blocks + norm_out/proj_out). Block linears int4 (block 32), small layers int8 | 4.5 GB |
|
| 34 |
-
| `txt_in.mnn`, `img_in.mnn` | text / latent input projections
|
| 35 |
-
| `vae_decoder.mnn` | VAE decoder, 64-ch latent → RGBA, fp16 weights | 0.5 GB |
|
| 36 |
-
| `
|
|
|
|
| 37 |
|
| 38 |
Download:
|
| 39 |
|
|
|
|
| 18 |
# Qwen-Image-2.1 · MNN (int4) for Android
|
| 19 |
|
| 20 |
[Qwen/Qwen-Image-2.1](https://huggingface.co/Qwen/Qwen-Image-2.1) converted to [MNN](https://github.com/alibaba/MNN)
|
| 21 |
+
for on-device **text-to-image and image editing** on Android at about 512×512 pixels (any aspect ratio with sides that
|
| 22 |
+
are multiples of 32, e.g. 512×512, 576×448, 608×416, 672×384), with the OpenCL GPU running the DiT.
|
| 23 |
|
| 24 |
Runtime, Android library and demo app: **[github.com/scsonic/libQwenImage21](https://github.com/scsonic/libQwenImage21)**
|
| 25 |
|
|
|
|
| 32 |
| Path | What | Size |
|
| 33 |
|---|---|---|
|
| 34 |
| `dit.mnn` + `.weight` | 7B single-stream DiT (32 blocks + norm_out/proj_out). Block linears int4 (block 32), small layers int8 | 4.5 GB |
|
| 35 |
+
| `txt_in.mnn`, `img_in.mnn` | text (int8) / latent (fp16) input projections | 36 MB |
|
| 36 |
+
| `vae_decoder.mnn` | VAE decoder, 64-ch latent → RGBA, fp16 weights, dynamic size | 0.5 GB |
|
| 37 |
+
| `vae_encoder.mnn` | VAE encoder for image editing, RGBA → normalized 64-ch latent, fp16 | 0.16 GB |
|
| 38 |
+
| `text_encoder/` | Qwen3-VL-8B-Instruct, MNN int4 (from [taobao-mnn/Qwen3-VL-8B-Instruct-MNN](https://huggingface.co/taobao-mnn/Qwen3-VL-8B-Instruct-MNN)). `te_config.json` runs it text-only; `te_vl_config.json` adds the vision tower (`visual.mnn`) for image editing. Both return the last decoder layer before the final norm | 5.4 GB |
|
| 39 |
|
| 40 |
Download:
|
| 41 |
|
img_in.mnn
CHANGED
|
Binary files a/img_in.mnn and b/img_in.mnn differ
|
|
|
img_in.mnn.weight
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:84ceb8c9ab500f646909606af4ff2a0e8d8deb2f14455f49b2f84e2e50201492
|
| 3 |
+
size 524288
|
text_encoder/te_vl_config.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"llm_model": "llm.mnn",
|
| 3 |
+
"llm_weight": "llm.mnn.weight",
|
| 4 |
+
"embedding_file": "embeddings_int4.bin",
|
| 5 |
+
"visual_model": "visual.mnn",
|
| 6 |
+
"llm_config": "te_vl_llm_config.json",
|
| 7 |
+
"backend_type": "cpu",
|
| 8 |
+
"thread_num": 4,
|
| 9 |
+
"precision": "low",
|
| 10 |
+
"memory": "low",
|
| 11 |
+
"use_template": false,
|
| 12 |
+
"mllm": {
|
| 13 |
+
"backend_type": "cpu",
|
| 14 |
+
"thread_num": 4,
|
| 15 |
+
"precision": "normal",
|
| 16 |
+
"memory": "low"
|
| 17 |
+
}
|
| 18 |
+
}
|
text_encoder/te_vl_llm_config.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"hidden_size": 4096,
|
| 3 |
+
"layer_nums": 36,
|
| 4 |
+
"attention_mask": "float",
|
| 5 |
+
"key_value_shape": [
|
| 6 |
+
2,
|
| 7 |
+
1,
|
| 8 |
+
0,
|
| 9 |
+
8,
|
| 10 |
+
128
|
| 11 |
+
],
|
| 12 |
+
"bos": "",
|
| 13 |
+
"system_prompt_template": "<|im_start|>system\n%s<|im_end|>\n",
|
| 14 |
+
"user_prompt_template": "<|im_start|>user\n%s<|im_end|>\n",
|
| 15 |
+
"assistant_prompt_template": "<|im_start|>assistant\n%s<|im_end|>\n",
|
| 16 |
+
"is_visual": true,
|
| 17 |
+
"attention_type": "full",
|
| 18 |
+
"jinja": {
|
| 19 |
+
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- for message in messages %}\n {%- if message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content_item in message.content %}\n {%- if 'text' in content_item %}\n {{- content_item.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and message.content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
|
| 20 |
+
"eos": "<|im_end|>"
|
| 21 |
+
},
|
| 22 |
+
"image_mean": [
|
| 23 |
+
127.5,
|
| 24 |
+
127.5,
|
| 25 |
+
127.5
|
| 26 |
+
],
|
| 27 |
+
"image_norm": [
|
| 28 |
+
0.00784313725490196,
|
| 29 |
+
0.00784313725490196,
|
| 30 |
+
0.00784313725490196
|
| 31 |
+
],
|
| 32 |
+
"image_size": 420,
|
| 33 |
+
"vision_start": 151652,
|
| 34 |
+
"vision_end": 151653,
|
| 35 |
+
"image_pad": 151655,
|
| 36 |
+
"num_grid_per_side": 48,
|
| 37 |
+
"has_deepstack": true,
|
| 38 |
+
"tie_embeddings": [
|
| 39 |
+
0,
|
| 40 |
+
311164928,
|
| 41 |
+
77791232,
|
| 42 |
+
4,
|
| 43 |
+
64
|
| 44 |
+
],
|
| 45 |
+
"hidden_states": true,
|
| 46 |
+
"hidden_states_output": "/Add_182_output_0"
|
| 47 |
+
}
|
text_encoder/visual.mnn
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f1653348a94c29e56d47529dd461215c80d5380263136adee7945809f407bf7
|
| 3 |
+
size 562048
|
text_encoder/visual.mnn.weight
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d8b1a4886cca9ab8b8c86979f4e5291e126ac930124e9a2361833e7b11301e6
|
| 3 |
+
size 326728744
|
vae_decoder.mnn
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 506595396
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2525485bba44d4d8176d05522fa7e8b4b1080c9e7b7df18dfde7d58e667ff055
|
| 3 |
size 506595396
|
vae_encoder.mnn
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a131ea3a9c822a62842c17ddf0526685d5d8cd842ed13d5500112121df770248
|
| 3 |
+
size 156215404
|