Text Generation
Transformers
Safetensors
MiniMax H3
English
qwen3_5
image-text-to-text
prompt-expansion
text-to-image
fp4
sglang
conversational
8-bit precision
modelopt
Instructions to use MiniMaxAI/MiniMax-H3-Image-PE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MiniMaxAI/MiniMax-H3-Image-PE with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MiniMaxAI/MiniMax-H3-Image-PE") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("MiniMaxAI/MiniMax-H3-Image-PE") model = AutoModelForMultimodalLM.from_pretrained("MiniMaxAI/MiniMax-H3-Image-PE", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MiniMaxAI/MiniMax-H3-Image-PE with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MiniMaxAI/MiniMax-H3-Image-PE" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MiniMaxAI/MiniMax-H3-Image-PE", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MiniMaxAI/MiniMax-H3-Image-PE
- SGLang
How to use MiniMaxAI/MiniMax-H3-Image-PE 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 "MiniMaxAI/MiniMax-H3-Image-PE" \ --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": "MiniMaxAI/MiniMax-H3-Image-PE", "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 "MiniMaxAI/MiniMax-H3-Image-PE" \ --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": "MiniMaxAI/MiniMax-H3-Image-PE", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MiniMaxAI/MiniMax-H3-Image-PE with Docker Model Runner:
docker model run hf.co/MiniMaxAI/MiniMax-H3-Image-PE
Commit ·
5cb2132
0
Parent(s):
Init MiniMaxAI/MiniMax-H3-Image-PE
Browse filesCo-authored-by: 500kg <500kg@users.noreply.huggingface.co>
- .gitattributes +41 -0
- README.md +263 -0
- assets/minimax-h3-image.jpg +3 -0
- chat_template.jinja +170 -0
- config.json +718 -0
- generation_config.json +14 -0
- hf_quant_config.json +159 -0
- model-00001-of-00004.safetensors +3 -0
- model-00002-of-00004.safetensors +3 -0
- model-00003-of-00004.safetensors +3 -0
- model-00004-of-00004.safetensors +3 -0
- model.safetensors.index.json +0 -0
- processor_config.json +60 -0
- prompt/edit/task_prompt.txt +191 -0
- prompt/manifest.json +22 -0
- prompt/t2i/request_params.json +49 -0
- prompt/t2i/system_prompt.txt +1 -0
- prompt/t2i/task_prompt.txt +233 -0
- requirements.txt +2 -0
- scripts/expand_prompt.py +117 -0
- tokenizer.json +3 -0
- tokenizer_config.json +31 -0
.gitattributes
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
*.mov filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pipeline_tag: text-generation
|
| 3 |
+
license: other
|
| 4 |
+
license_name: minimax-h3-image-community-license-agreement
|
| 5 |
+
license_link: https://huggingface.co/MiniMaxAI/MiniMax-H3-Image/blob/main/LICENSE
|
| 6 |
+
library_name: transformers
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
tags:
|
| 10 |
+
- prompt-expansion
|
| 11 |
+
- text-to-image
|
| 12 |
+
- minimax-h3
|
| 13 |
+
- fp4
|
| 14 |
+
- sglang
|
| 15 |
+
base_model:
|
| 16 |
+
- Qwen/Qwen3.8-27B
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
<div align="center">
|
| 20 |
+
<img width="100%" src="assets/minimax-h3-image.jpg" alt="MiniMax H3 image, Open Weights">
|
| 21 |
+
</div>
|
| 22 |
+
|
| 23 |
+
<p align="center">
|
| 24 |
+
<a href="https://hailuoai.video" target="_blank"><img src="https://img.shields.io/badge/Hailuo%20AI-FF6C37?logo=minimax&logoColor=white" alt="Hailuo AI"></a>
|
| 25 |
+
<a href="https://platform.minimax.io" target="_blank"><img src="https://img.shields.io/badge/API-FF6C37?logo=minimax&logoColor=white" alt="API"></a>
|
| 26 |
+
<a href="https://www.minimax.io" target="_blank"><img src="https://img.shields.io/badge/MiniMax%20Website-FF6C37?logo=minimax&logoColor=white" alt="MiniMax Website"></a>
|
| 27 |
+
<a href="https://github.com/MiniMax-AI/MiniMax-H3" target="_blank"><img src="https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white" alt="GitHub"></a>
|
| 28 |
+
<a href="https://huggingface.co/MiniMaxAI/MiniMax-H3-Image-PE" target="_blank"><img src="https://img.shields.io/badge/Hugging%20Face-FFD21E?logo=huggingface&logoColor=black" alt="Hugging Face"></a>
|
| 29 |
+
<br>
|
| 30 |
+
<a href="https://modelscope.cn/organization/minimax" target="_blank" rel="noopener noreferrer"><img alt="ModelScope MiniMax AI" src="https://img.shields.io/badge/ModelScope-MiniMax%20AI-white?labelColor=%23EF3D5D"></a>
|
| 31 |
+
<a href="https://platform.minimaxi.com/docs/faq/contact-us" target="_blank"><img src="https://img.shields.io/badge/WeChat-07C160?logo=wechat&logoColor=white" alt="WeChat"></a>
|
| 32 |
+
<a href="https://discord.com/invite/dbMxutw7tP" target="_blank"><img src="https://img.shields.io/badge/Discord-5865F2?logo=discord&logoColor=white" alt="Discord"></a>
|
| 33 |
+
<a href="https://huggingface.co/MiniMaxAI/MiniMax-H3-Image/blob/main/LICENSE"><img src="https://img.shields.io/badge/LICENSE-4CAF50?logo=creativecommons&logoColor=white" alt="LICENSE"></a>
|
| 34 |
+
</p>
|
| 35 |
+
|
| 36 |
+
# MiniMax-H3-Image-PE
|
| 37 |
+
|
| 38 |
+
## Online API
|
| 39 |
+
|
| 40 |
+
Use MiniMax-H3-Image directly via API.
|
| 41 |
+
|
| 42 |
+
- Global: [platform.minimax.io](https://platform.minimax.io/docs/guides/image-generation) | CN: [platform.minimax.cn](https://platform.minimax.cn/docs/guides/image-generation)
|
| 43 |
+
|
| 44 |
+
API docs:
|
| 45 |
+
- Text-to-image: [EN-docs](https://platform.minimax.io/docs/api-reference/image-generation-h3-generations), [CN-docs](https://platform.minimax.cn/docs/api-reference/image-generation-h3-generations)
|
| 46 |
+
- Image editing: [EN-docs](https://platform.minimax.io/docs/api-reference/image-generation-h3-edits), [CN-docs](https://platform.minimax.cn/docs/api-reference/image-generation-h3-edits)
|
| 47 |
+
- Prompt expansion: [EN-docs](https://platform.minimax.io/docs/api-reference/image-generation-h3-context-ir), [CN-docs](https://platform.minimax.cn/docs/api-reference/image-generation-h3-context-ir)
|
| 48 |
+
|
| 49 |
+
## Introduction
|
| 50 |
+
|
| 51 |
+
MiniMax-H3-Image-PE provides prompt expansion (PE) for
|
| 52 |
+
[MiniMax-H3-Image](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image).
|
| 53 |
+
It turns a short request into a detailed description of the intended image,
|
| 54 |
+
together with an aspect-ratio recommendation for image generation.
|
| 55 |
+
|
| 56 |
+
This repository covers two workflows:
|
| 57 |
+
|
| 58 |
+
| Workflow | Input | Released assets |
|
| 59 |
+
| --- | --- | --- |
|
| 60 |
+
| **Text-to-image (T2I) PE** | A text instruction | MiniMax-H3-Image-PE weights (fine-tuned from [Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B), FP4), task and system prompts, and a client example |
|
| 61 |
+
| **Image editing PE** | An editing instruction and reference images | A task prompt and message-assembly example for a vision-language model of your choice. **Image editing PE is still under development; this release provides its prompt only.** |
|
| 62 |
+
|
| 63 |
+
The examples below explain how to use MiniMax-H3-Image-PE and the image editing task prompt.
|
| 64 |
+
|
| 65 |
+
## How to use T2I PE
|
| 66 |
+
|
| 67 |
+
Run the examples from a local copy of this repository so the relative prompt and
|
| 68 |
+
script paths resolve correctly.
|
| 69 |
+
|
| 70 |
+
### Serve MiniMax-H3-Image-PE
|
| 71 |
+
|
| 72 |
+
We recommend SGLang with `sglang>=0.5.23` and `xgrammar>=0.2.7`.
|
| 73 |
+
|
| 74 |
+
```bash
|
| 75 |
+
sglang serve \
|
| 76 |
+
--model-path MiniMaxAI/MiniMax-H3-Image-PE \
|
| 77 |
+
--served-model-name MiniMax-H3-Image-PE \
|
| 78 |
+
--model-type llm \
|
| 79 |
+
--reasoning-parser qwen3 \
|
| 80 |
+
--grammar-backend xgrammar \
|
| 81 |
+
--constrained-json-disable-any-whitespace \
|
| 82 |
+
--host 0.0.0.0 \
|
| 83 |
+
--port 30000
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
SGLang reads the FP4 configuration from the checkpoint. XGrammar constrains the
|
| 87 |
+
answer to the JSON schema, and the reasoning parser separates reasoning from the
|
| 88 |
+
final answer.
|
| 89 |
+
|
| 90 |
+
### Expand a prompt
|
| 91 |
+
|
| 92 |
+
Load the task prompt and insert your instruction with `.format(user_query)`:
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
from pathlib import Path
|
| 96 |
+
|
| 97 |
+
task_prompt = Path("prompt/t2i/task_prompt.txt").read_text(encoding="utf-8")
|
| 98 |
+
user_query = "An orange tabby cat sleeping on a sunlit windowsill."
|
| 99 |
+
user_prompt = task_prompt.format(user_query)
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
Send it with the system prompt and request parameters:
|
| 103 |
+
|
| 104 |
+
```python
|
| 105 |
+
import json
|
| 106 |
+
from urllib.request import Request, urlopen
|
| 107 |
+
|
| 108 |
+
system_prompt = Path("prompt/t2i/system_prompt.txt").read_text(encoding="utf-8").strip()
|
| 109 |
+
params = json.loads(Path("prompt/t2i/request_params.json").read_text(encoding="utf-8"))
|
| 110 |
+
payload = {
|
| 111 |
+
**params,
|
| 112 |
+
"model": "MiniMax-H3-Image-PE",
|
| 113 |
+
"messages": [
|
| 114 |
+
{"role": "system", "content": system_prompt},
|
| 115 |
+
{"role": "user", "content": user_prompt},
|
| 116 |
+
],
|
| 117 |
+
"stream": False,
|
| 118 |
+
}
|
| 119 |
+
request = Request(
|
| 120 |
+
"http://0.0.0.0:30000/v1/chat/completions",
|
| 121 |
+
data=json.dumps(payload).encode("utf-8"),
|
| 122 |
+
headers={"Content-Type": "application/json"},
|
| 123 |
+
)
|
| 124 |
+
with urlopen(request, timeout=1200) as response:
|
| 125 |
+
result = json.load(response)
|
| 126 |
+
pe_result = json.loads(result["choices"][0]["message"]["content"])
|
| 127 |
+
print(pe_result)
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
The included client performs the same request and checks the response:
|
| 131 |
+
|
| 132 |
+
```bash
|
| 133 |
+
python3 scripts/expand_prompt.py \
|
| 134 |
+
--url http://0.0.0.0:30000 \
|
| 135 |
+
--model MiniMax-H3-Image-PE \
|
| 136 |
+
"An orange tabby cat sleeping on a sunlit windowsill."
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
### Request parameters
|
| 140 |
+
|
| 141 |
+
The examples load the defaults from
|
| 142 |
+
[`prompt/t2i/request_params.json`](prompt/t2i/request_params.json):
|
| 143 |
+
|
| 144 |
+
| Parameter | Value |
|
| 145 |
+
| --- | --- |
|
| 146 |
+
| `temperature` / `top_p` / `top_k` | 1.0 / 0.95 / 20 |
|
| 147 |
+
| `min_p` | 0.0 |
|
| 148 |
+
| `presence_penalty` / `repetition_penalty` | 0.0 / 1.0 |
|
| 149 |
+
| `max_tokens` | 4096, including thinking and the final answer |
|
| 150 |
+
| `reasoning_effort` | `xhigh` |
|
| 151 |
+
| `enable_thinking` / `preserve_thinking` | `true` / `true` |
|
| 152 |
+
| `response_format` | JSON schema for `expanded_caption` and `aspect_ratio` |
|
| 153 |
+
|
| 154 |
+
### Output
|
| 155 |
+
|
| 156 |
+
With `--reasoning-parser qwen3`, `message.content` contains the JSON answer.
|
| 157 |
+
Reasoning is returned separately in `message.reasoning_content`. Example output:
|
| 158 |
+
|
| 159 |
+
```json
|
| 160 |
+
{
|
| 161 |
+
"expanded_caption": "A warm photograph shows an orange tabby cat sleeping on a sunlit windowsill, with soft afternoon light falling across its fur.",
|
| 162 |
+
"aspect_ratio": "3:2"
|
| 163 |
+
}
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
When your aspect-ratio selection is `auto`, use the `aspect_ratio` returned by the
|
| 167 |
+
model for image generation. If you select an explicit ratio, use your selected
|
| 168 |
+
ratio instead of the model's recommendation at the image-generation stage.
|
| 169 |
+
|
| 170 |
+
## How to use Image editing PE
|
| 171 |
+
|
| 172 |
+
Use the task prompt with a vision-language model that supports interleaved text
|
| 173 |
+
and images. The example below describes message assembly without selecting a
|
| 174 |
+
model or making an API call.
|
| 175 |
+
|
| 176 |
+
### Inputs
|
| 177 |
+
|
| 178 |
+
Provide the following inputs:
|
| 179 |
+
|
| 180 |
+
| Input | Description |
|
| 181 |
+
| --- | --- |
|
| 182 |
+
| `user_query` | The editing instruction. Refer to images in their supplied order. |
|
| 183 |
+
| `references` | At least one prepared image, in order, with its original display aspect ratio as a reduced `W:H` string. Use `None` when the source ratio is unknown. |
|
| 184 |
+
| `aspect_ratio` | The target ratio: `adaptive` to let the model choose, or an explicit positive-integer `W:H` string. |
|
| 185 |
+
|
| 186 |
+
### Assemble the message
|
| 187 |
+
|
| 188 |
+
Load [`prompt/edit/task_prompt.txt`](prompt/edit/task_prompt.txt) unchanged as the
|
| 189 |
+
first content part. Follow it with the image count, each image's label and source
|
| 190 |
+
ratio immediately before that image, and your editing instruction and target ratio
|
| 191 |
+
in the final text part. This produces one user message.
|
| 192 |
+
|
| 193 |
+
The fixed task prompt forms a shared prefix across requests, allowing reuse by
|
| 194 |
+
services that support prefix caching. Cache behavior depends on the provider.
|
| 195 |
+
|
| 196 |
+
In the pseudocode below, `source_image` and `reference_image` are already prepared
|
| 197 |
+
image inputs. The text and image parts are conceptual; adapt their representation
|
| 198 |
+
to your model's interface.
|
| 199 |
+
|
| 200 |
+
```python
|
| 201 |
+
import json
|
| 202 |
+
from pathlib import Path
|
| 203 |
+
|
| 204 |
+
task_prompt = Path("prompt/edit/task_prompt.txt").read_text(encoding="utf-8")
|
| 205 |
+
user_query = "Replace the bag in the first image with the bag in the second image."
|
| 206 |
+
aspect_ratio = "adaptive" # Or an explicit ratio, such as "16:9".
|
| 207 |
+
references = [
|
| 208 |
+
{"image": source_image, "aspect_ratio": "3:2"},
|
| 209 |
+
{"image": reference_image, "aspect_ratio": "1:1"},
|
| 210 |
+
]
|
| 211 |
+
|
| 212 |
+
count = len(references)
|
| 213 |
+
content = [
|
| 214 |
+
{"type": "text", "text": task_prompt},
|
| 215 |
+
{"type": "text", "text": (
|
| 216 |
+
f"Reference Image Count:\n"
|
| 217 |
+
f"{count} input image(s), labeled <Picture 1> through <Picture {count}>."
|
| 218 |
+
)},
|
| 219 |
+
]
|
| 220 |
+
for index, reference in enumerate(references, start=1):
|
| 221 |
+
metadata = "aspect_ratio unavailable"
|
| 222 |
+
if reference["aspect_ratio"] is not None:
|
| 223 |
+
metadata = f"aspect_ratio {reference['aspect_ratio']}"
|
| 224 |
+
content.extend([
|
| 225 |
+
{"type": "text", "text": f"Reference Media:\n- <Picture {index}> [{metadata}]"},
|
| 226 |
+
{"type": "image", "image": reference["image"]},
|
| 227 |
+
])
|
| 228 |
+
|
| 229 |
+
user_input = (
|
| 230 |
+
"\nUser Editing Instruction (JSON string):\n"
|
| 231 |
+
f"{json.dumps(user_query, ensure_ascii=False)}\n\n"
|
| 232 |
+
f"User Aspect Ratio Selection:\n{aspect_ratio}\n\n"
|
| 233 |
+
"Apply the instructions above to the supplied inputs and reference images. "
|
| 234 |
+
"Output only the required two-field JSON object."
|
| 235 |
+
)
|
| 236 |
+
content.append({"type": "text", "text": user_input})
|
| 237 |
+
messages = [{"role": "user", "content": content}]
|
| 238 |
+
```
|
| 239 |
+
|
| 240 |
+
### Output
|
| 241 |
+
|
| 242 |
+
```json
|
| 243 |
+
{
|
| 244 |
+
"expanded_caption": "<one paragraph describing the intended edit>",
|
| 245 |
+
"target_aspect_ratio": "3:2"
|
| 246 |
+
}
|
| 247 |
+
```
|
| 248 |
+
|
| 249 |
+
The description identifies source subjects, states what is preserved or changed,
|
| 250 |
+
and describes new content. Descriptive prose is English; literal text retains the
|
| 251 |
+
language you request. `target_aspect_ratio` is a positive-integer `W:H` string.
|
| 252 |
+
If you select an explicit ratio, the model preserves it exactly. If you select
|
| 253 |
+
`adaptive`, the model determines a numeric ratio for the intended edited image.
|
| 254 |
+
|
| 255 |
+
## License
|
| 256 |
+
|
| 257 |
+
- MiniMax-H3-Image-PE is part of MiniMax-H3-Image and is released under the [MiniMax-H3-Image Community License Agreement](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image/blob/main/LICENSE).
|
| 258 |
+
- MiniMax-H3-Image-PE is derived from [Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B), which is licensed under the Apache 2.0 License.
|
| 259 |
+
- The separate written authorization described in Section IV of the license is requested through [platform.minimax.io/license](https://platform.minimax.io/license).
|
| 260 |
+
|
| 261 |
+
## Contact Us
|
| 262 |
+
|
| 263 |
+
Contact us at [model@minimax.io](mailto:model@minimax.io).
|
assets/minimax-h3-image.jpg
ADDED
|
Git LFS Details
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
{%- set reasoning_instructions = '' %}
|
| 46 |
+
{%- if enable_thinking is undefined or enable_thinking is true %}
|
| 47 |
+
{%- set resolved_reasoning_effort = reasoning_effort|default('xhigh') %}
|
| 48 |
+
{%- if resolved_reasoning_effort not in ('xhigh', 'medium', 'low') %}
|
| 49 |
+
{{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported types are xhigh (default), medium, and low.') }}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
{%- if resolved_reasoning_effort == 'xhigh' %}
|
| 52 |
+
{%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}
|
| 53 |
+
{%- elif resolved_reasoning_effort == 'low' %}
|
| 54 |
+
{%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}
|
| 55 |
+
{%- endif %}
|
| 56 |
+
{%- endif %}
|
| 57 |
+
{%- if tools and tools is iterable and tools is not mapping %}
|
| 58 |
+
{{- '<|im_start|>system\n' }}
|
| 59 |
+
{%- if reasoning_instructions %}
|
| 60 |
+
{{- reasoning_instructions + '\n\n' }}
|
| 61 |
+
{%- endif %}
|
| 62 |
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
| 63 |
+
{%- for tool in tools %}
|
| 64 |
+
{{- "\n" }}
|
| 65 |
+
{{- tool | tojson }}
|
| 66 |
+
{%- endfor %}
|
| 67 |
+
{{- "\n</tools>" }}
|
| 68 |
+
{{- '\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>' }}
|
| 69 |
+
{%- if messages[0].role == 'system' %}
|
| 70 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 71 |
+
{%- if content %}
|
| 72 |
+
{{- '\n\n' + content }}
|
| 73 |
+
{%- endif %}
|
| 74 |
+
{%- endif %}
|
| 75 |
+
{{- '<|im_end|>\n' }}
|
| 76 |
+
{%- else %}
|
| 77 |
+
{%- if messages[0].role == 'system' %}
|
| 78 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 79 |
+
{%- if content %}
|
| 80 |
+
{{- '<|im_start|>system\n' + (reasoning_instructions + '\n\n' if reasoning_instructions else '') + content + '<|im_end|>\n' }}
|
| 81 |
+
{%- elif reasoning_instructions %}
|
| 82 |
+
{{- '<|im_start|>system\n' + reasoning_instructions + '<|im_end|>\n' }}
|
| 83 |
+
{%- endif %}
|
| 84 |
+
{%- elif reasoning_instructions %}
|
| 85 |
+
{{- '<|im_start|>system\n' + reasoning_instructions + '<|im_end|>\n' }}
|
| 86 |
+
{%- endif %}
|
| 87 |
+
{%- endif %}
|
| 88 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 89 |
+
{%- for message in messages[::-1] %}
|
| 90 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 91 |
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
| 92 |
+
{%- set content = render_content(message.content, false)|trim %}
|
| 93 |
+
{%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
|
| 94 |
+
{%- set ns.multi_step_tool = false %}
|
| 95 |
+
{%- set ns.last_query_index = index %}
|
| 96 |
+
{%- endif %}
|
| 97 |
+
{%- endif %}
|
| 98 |
+
{%- endfor %}
|
| 99 |
+
{%- if ns.multi_step_tool %}
|
| 100 |
+
{{- raise_exception('No user query found in messages.') }}
|
| 101 |
+
{%- endif %}
|
| 102 |
+
{%- for message in messages %}
|
| 103 |
+
{%- set content = render_content(message.content, true)|trim %}
|
| 104 |
+
{%- if message.role == "system" %}
|
| 105 |
+
{%- if not loop.first %}
|
| 106 |
+
{{- raise_exception('System message must be at the beginning.') }}
|
| 107 |
+
{%- endif %}
|
| 108 |
+
{%- elif message.role == "user" %}
|
| 109 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 110 |
+
{%- elif message.role == "assistant" %}
|
| 111 |
+
{%- set reasoning_content = '' %}
|
| 112 |
+
{%- if message.reasoning_content is string %}
|
| 113 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 114 |
+
{%- endif %}
|
| 115 |
+
{%- set reasoning_content = reasoning_content|trim %}
|
| 116 |
+
{%- if preserve_thinking is undefined or preserve_thinking is true or loop.index0 > ns.last_query_index %}
|
| 117 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 118 |
+
{%- else %}
|
| 119 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 120 |
+
{%- endif %}
|
| 121 |
+
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 122 |
+
{%- for tool_call in message.tool_calls %}
|
| 123 |
+
{%- if tool_call.function is defined %}
|
| 124 |
+
{%- set tool_call = tool_call.function %}
|
| 125 |
+
{%- endif %}
|
| 126 |
+
{%- if loop.first %}
|
| 127 |
+
{%- if content|trim %}
|
| 128 |
+
{{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 129 |
+
{%- else %}
|
| 130 |
+
{{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 131 |
+
{%- endif %}
|
| 132 |
+
{%- else %}
|
| 133 |
+
{{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 134 |
+
{%- endif %}
|
| 135 |
+
{%- if tool_call.arguments is defined and tool_call.arguments != '' %}
|
| 136 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 137 |
+
{{- '<parameter=' + args_name + '>\n' }}
|
| 138 |
+
{%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}
|
| 139 |
+
{{- args_value }}
|
| 140 |
+
{{- '\n</parameter>\n' }}
|
| 141 |
+
{%- endfor %}
|
| 142 |
+
{%- endif %}
|
| 143 |
+
{{- '</function>\n</tool_call>' }}
|
| 144 |
+
{%- endfor %}
|
| 145 |
+
{%- endif %}
|
| 146 |
+
{{- '<|im_end|>\n' }}
|
| 147 |
+
{%- elif message.role == "tool" %}
|
| 148 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 149 |
+
{{- '<|im_start|>user' }}
|
| 150 |
+
{%- endif %}
|
| 151 |
+
{{- '\n<tool_response>\n' }}
|
| 152 |
+
{{- content }}
|
| 153 |
+
{{- '\n</tool_response>' }}
|
| 154 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 155 |
+
{{- '<|im_end|>\n' }}
|
| 156 |
+
{%- elif loop.last %}
|
| 157 |
+
{{- '<|im_end|>\n' }}
|
| 158 |
+
{%- endif %}
|
| 159 |
+
{%- else %}
|
| 160 |
+
{{- raise_exception('Unexpected message role.') }}
|
| 161 |
+
{%- endif %}
|
| 162 |
+
{%- endfor %}
|
| 163 |
+
{%- if add_generation_prompt %}
|
| 164 |
+
{{- '<|im_start|>assistant\n' }}
|
| 165 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 166 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 167 |
+
{%- else %}
|
| 168 |
+
{{- '<think>\n' }}
|
| 169 |
+
{%- endif %}
|
| 170 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,718 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3_5ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"dtype": "bfloat16",
|
| 6 |
+
"hidden_size": 5120,
|
| 7 |
+
"image_token_id": 248056,
|
| 8 |
+
"language_model_only": false,
|
| 9 |
+
"model_type": "qwen3_5",
|
| 10 |
+
"quantization_config": {
|
| 11 |
+
"config_groups": {
|
| 12 |
+
"group_0": {
|
| 13 |
+
"input_activations": {
|
| 14 |
+
"dynamic": false,
|
| 15 |
+
"group_size": 16,
|
| 16 |
+
"num_bits": 4,
|
| 17 |
+
"type": "float"
|
| 18 |
+
},
|
| 19 |
+
"weights": {
|
| 20 |
+
"dynamic": false,
|
| 21 |
+
"group_size": 16,
|
| 22 |
+
"num_bits": 4,
|
| 23 |
+
"type": "float"
|
| 24 |
+
},
|
| 25 |
+
"targets": [
|
| 26 |
+
"lm_head",
|
| 27 |
+
"model.language_model.layers.0.linear_attn.in_proj_qkv",
|
| 28 |
+
"model.language_model.layers.0.linear_attn.in_proj_z",
|
| 29 |
+
"model.language_model.layers.0.linear_attn.out_proj",
|
| 30 |
+
"model.language_model.layers.0.mlp.down_proj",
|
| 31 |
+
"model.language_model.layers.0.mlp.gate_proj",
|
| 32 |
+
"model.language_model.layers.0.mlp.up_proj",
|
| 33 |
+
"model.language_model.layers.1.linear_attn.in_proj_qkv",
|
| 34 |
+
"model.language_model.layers.1.linear_attn.in_proj_z",
|
| 35 |
+
"model.language_model.layers.1.linear_attn.out_proj",
|
| 36 |
+
"model.language_model.layers.1.mlp.down_proj",
|
| 37 |
+
"model.language_model.layers.1.mlp.gate_proj",
|
| 38 |
+
"model.language_model.layers.1.mlp.up_proj",
|
| 39 |
+
"model.language_model.layers.10.linear_attn.in_proj_qkv",
|
| 40 |
+
"model.language_model.layers.10.linear_attn.in_proj_z",
|
| 41 |
+
"model.language_model.layers.10.linear_attn.out_proj",
|
| 42 |
+
"model.language_model.layers.10.mlp.down_proj",
|
| 43 |
+
"model.language_model.layers.10.mlp.gate_proj",
|
| 44 |
+
"model.language_model.layers.10.mlp.up_proj",
|
| 45 |
+
"model.language_model.layers.11.mlp.down_proj",
|
| 46 |
+
"model.language_model.layers.11.mlp.gate_proj",
|
| 47 |
+
"model.language_model.layers.11.mlp.up_proj",
|
| 48 |
+
"model.language_model.layers.11.self_attn.k_proj",
|
| 49 |
+
"model.language_model.layers.11.self_attn.o_proj",
|
| 50 |
+
"model.language_model.layers.11.self_attn.q_proj",
|
| 51 |
+
"model.language_model.layers.11.self_attn.v_proj",
|
| 52 |
+
"model.language_model.layers.12.linear_attn.in_proj_qkv",
|
| 53 |
+
"model.language_model.layers.12.linear_attn.in_proj_z",
|
| 54 |
+
"model.language_model.layers.12.linear_attn.out_proj",
|
| 55 |
+
"model.language_model.layers.12.mlp.down_proj",
|
| 56 |
+
"model.language_model.layers.12.mlp.gate_proj",
|
| 57 |
+
"model.language_model.layers.12.mlp.up_proj",
|
| 58 |
+
"model.language_model.layers.13.linear_attn.in_proj_qkv",
|
| 59 |
+
"model.language_model.layers.13.linear_attn.in_proj_z",
|
| 60 |
+
"model.language_model.layers.13.linear_attn.out_proj",
|
| 61 |
+
"model.language_model.layers.13.mlp.down_proj",
|
| 62 |
+
"model.language_model.layers.13.mlp.gate_proj",
|
| 63 |
+
"model.language_model.layers.13.mlp.up_proj",
|
| 64 |
+
"model.language_model.layers.14.linear_attn.in_proj_qkv",
|
| 65 |
+
"model.language_model.layers.14.linear_attn.in_proj_z",
|
| 66 |
+
"model.language_model.layers.14.linear_attn.out_proj",
|
| 67 |
+
"model.language_model.layers.14.mlp.down_proj",
|
| 68 |
+
"model.language_model.layers.14.mlp.gate_proj",
|
| 69 |
+
"model.language_model.layers.14.mlp.up_proj",
|
| 70 |
+
"model.language_model.layers.15.mlp.down_proj",
|
| 71 |
+
"model.language_model.layers.15.mlp.gate_proj",
|
| 72 |
+
"model.language_model.layers.15.mlp.up_proj",
|
| 73 |
+
"model.language_model.layers.15.self_attn.k_proj",
|
| 74 |
+
"model.language_model.layers.15.self_attn.o_proj",
|
| 75 |
+
"model.language_model.layers.15.self_attn.q_proj",
|
| 76 |
+
"model.language_model.layers.15.self_attn.v_proj",
|
| 77 |
+
"model.language_model.layers.16.linear_attn.in_proj_qkv",
|
| 78 |
+
"model.language_model.layers.16.linear_attn.in_proj_z",
|
| 79 |
+
"model.language_model.layers.16.linear_attn.out_proj",
|
| 80 |
+
"model.language_model.layers.16.mlp.down_proj",
|
| 81 |
+
"model.language_model.layers.16.mlp.gate_proj",
|
| 82 |
+
"model.language_model.layers.16.mlp.up_proj",
|
| 83 |
+
"model.language_model.layers.17.linear_attn.in_proj_qkv",
|
| 84 |
+
"model.language_model.layers.17.linear_attn.in_proj_z",
|
| 85 |
+
"model.language_model.layers.17.linear_attn.out_proj",
|
| 86 |
+
"model.language_model.layers.17.mlp.down_proj",
|
| 87 |
+
"model.language_model.layers.17.mlp.gate_proj",
|
| 88 |
+
"model.language_model.layers.17.mlp.up_proj",
|
| 89 |
+
"model.language_model.layers.18.linear_attn.in_proj_qkv",
|
| 90 |
+
"model.language_model.layers.18.linear_attn.in_proj_z",
|
| 91 |
+
"model.language_model.layers.18.linear_attn.out_proj",
|
| 92 |
+
"model.language_model.layers.18.mlp.down_proj",
|
| 93 |
+
"model.language_model.layers.18.mlp.gate_proj",
|
| 94 |
+
"model.language_model.layers.18.mlp.up_proj",
|
| 95 |
+
"model.language_model.layers.19.mlp.down_proj",
|
| 96 |
+
"model.language_model.layers.19.mlp.gate_proj",
|
| 97 |
+
"model.language_model.layers.19.mlp.up_proj",
|
| 98 |
+
"model.language_model.layers.19.self_attn.k_proj",
|
| 99 |
+
"model.language_model.layers.19.self_attn.o_proj",
|
| 100 |
+
"model.language_model.layers.19.self_attn.q_proj",
|
| 101 |
+
"model.language_model.layers.19.self_attn.v_proj",
|
| 102 |
+
"model.language_model.layers.2.linear_attn.in_proj_qkv",
|
| 103 |
+
"model.language_model.layers.2.linear_attn.in_proj_z",
|
| 104 |
+
"model.language_model.layers.2.linear_attn.out_proj",
|
| 105 |
+
"model.language_model.layers.2.mlp.down_proj",
|
| 106 |
+
"model.language_model.layers.2.mlp.gate_proj",
|
| 107 |
+
"model.language_model.layers.2.mlp.up_proj",
|
| 108 |
+
"model.language_model.layers.20.linear_attn.in_proj_qkv",
|
| 109 |
+
"model.language_model.layers.20.linear_attn.in_proj_z",
|
| 110 |
+
"model.language_model.layers.20.linear_attn.out_proj",
|
| 111 |
+
"model.language_model.layers.20.mlp.down_proj",
|
| 112 |
+
"model.language_model.layers.20.mlp.gate_proj",
|
| 113 |
+
"model.language_model.layers.20.mlp.up_proj",
|
| 114 |
+
"model.language_model.layers.21.linear_attn.in_proj_qkv",
|
| 115 |
+
"model.language_model.layers.21.linear_attn.in_proj_z",
|
| 116 |
+
"model.language_model.layers.21.linear_attn.out_proj",
|
| 117 |
+
"model.language_model.layers.21.mlp.down_proj",
|
| 118 |
+
"model.language_model.layers.21.mlp.gate_proj",
|
| 119 |
+
"model.language_model.layers.21.mlp.up_proj",
|
| 120 |
+
"model.language_model.layers.22.linear_attn.in_proj_qkv",
|
| 121 |
+
"model.language_model.layers.22.linear_attn.in_proj_z",
|
| 122 |
+
"model.language_model.layers.22.linear_attn.out_proj",
|
| 123 |
+
"model.language_model.layers.22.mlp.down_proj",
|
| 124 |
+
"model.language_model.layers.22.mlp.gate_proj",
|
| 125 |
+
"model.language_model.layers.22.mlp.up_proj",
|
| 126 |
+
"model.language_model.layers.23.mlp.down_proj",
|
| 127 |
+
"model.language_model.layers.23.mlp.gate_proj",
|
| 128 |
+
"model.language_model.layers.23.mlp.up_proj",
|
| 129 |
+
"model.language_model.layers.23.self_attn.k_proj",
|
| 130 |
+
"model.language_model.layers.23.self_attn.o_proj",
|
| 131 |
+
"model.language_model.layers.23.self_attn.q_proj",
|
| 132 |
+
"model.language_model.layers.23.self_attn.v_proj",
|
| 133 |
+
"model.language_model.layers.24.linear_attn.in_proj_qkv",
|
| 134 |
+
"model.language_model.layers.24.linear_attn.in_proj_z",
|
| 135 |
+
"model.language_model.layers.24.linear_attn.out_proj",
|
| 136 |
+
"model.language_model.layers.24.mlp.down_proj",
|
| 137 |
+
"model.language_model.layers.24.mlp.gate_proj",
|
| 138 |
+
"model.language_model.layers.24.mlp.up_proj",
|
| 139 |
+
"model.language_model.layers.25.linear_attn.in_proj_qkv",
|
| 140 |
+
"model.language_model.layers.25.linear_attn.in_proj_z",
|
| 141 |
+
"model.language_model.layers.25.linear_attn.out_proj",
|
| 142 |
+
"model.language_model.layers.25.mlp.down_proj",
|
| 143 |
+
"model.language_model.layers.25.mlp.gate_proj",
|
| 144 |
+
"model.language_model.layers.25.mlp.up_proj",
|
| 145 |
+
"model.language_model.layers.26.linear_attn.in_proj_qkv",
|
| 146 |
+
"model.language_model.layers.26.linear_attn.in_proj_z",
|
| 147 |
+
"model.language_model.layers.26.linear_attn.out_proj",
|
| 148 |
+
"model.language_model.layers.26.mlp.down_proj",
|
| 149 |
+
"model.language_model.layers.26.mlp.gate_proj",
|
| 150 |
+
"model.language_model.layers.26.mlp.up_proj",
|
| 151 |
+
"model.language_model.layers.27.mlp.down_proj",
|
| 152 |
+
"model.language_model.layers.27.mlp.gate_proj",
|
| 153 |
+
"model.language_model.layers.27.mlp.up_proj",
|
| 154 |
+
"model.language_model.layers.27.self_attn.k_proj",
|
| 155 |
+
"model.language_model.layers.27.self_attn.o_proj",
|
| 156 |
+
"model.language_model.layers.27.self_attn.q_proj",
|
| 157 |
+
"model.language_model.layers.27.self_attn.v_proj",
|
| 158 |
+
"model.language_model.layers.28.linear_attn.in_proj_qkv",
|
| 159 |
+
"model.language_model.layers.28.linear_attn.in_proj_z",
|
| 160 |
+
"model.language_model.layers.28.linear_attn.out_proj",
|
| 161 |
+
"model.language_model.layers.28.mlp.down_proj",
|
| 162 |
+
"model.language_model.layers.28.mlp.gate_proj",
|
| 163 |
+
"model.language_model.layers.28.mlp.up_proj",
|
| 164 |
+
"model.language_model.layers.29.linear_attn.in_proj_qkv",
|
| 165 |
+
"model.language_model.layers.29.linear_attn.in_proj_z",
|
| 166 |
+
"model.language_model.layers.29.linear_attn.out_proj",
|
| 167 |
+
"model.language_model.layers.29.mlp.down_proj",
|
| 168 |
+
"model.language_model.layers.29.mlp.gate_proj",
|
| 169 |
+
"model.language_model.layers.29.mlp.up_proj",
|
| 170 |
+
"model.language_model.layers.3.mlp.down_proj",
|
| 171 |
+
"model.language_model.layers.3.mlp.gate_proj",
|
| 172 |
+
"model.language_model.layers.3.mlp.up_proj",
|
| 173 |
+
"model.language_model.layers.3.self_attn.k_proj",
|
| 174 |
+
"model.language_model.layers.3.self_attn.o_proj",
|
| 175 |
+
"model.language_model.layers.3.self_attn.q_proj",
|
| 176 |
+
"model.language_model.layers.3.self_attn.v_proj",
|
| 177 |
+
"model.language_model.layers.30.linear_attn.in_proj_qkv",
|
| 178 |
+
"model.language_model.layers.30.linear_attn.in_proj_z",
|
| 179 |
+
"model.language_model.layers.30.linear_attn.out_proj",
|
| 180 |
+
"model.language_model.layers.30.mlp.down_proj",
|
| 181 |
+
"model.language_model.layers.30.mlp.gate_proj",
|
| 182 |
+
"model.language_model.layers.30.mlp.up_proj",
|
| 183 |
+
"model.language_model.layers.31.mlp.down_proj",
|
| 184 |
+
"model.language_model.layers.31.mlp.gate_proj",
|
| 185 |
+
"model.language_model.layers.31.mlp.up_proj",
|
| 186 |
+
"model.language_model.layers.31.self_attn.k_proj",
|
| 187 |
+
"model.language_model.layers.31.self_attn.o_proj",
|
| 188 |
+
"model.language_model.layers.31.self_attn.q_proj",
|
| 189 |
+
"model.language_model.layers.31.self_attn.v_proj",
|
| 190 |
+
"model.language_model.layers.32.linear_attn.in_proj_qkv",
|
| 191 |
+
"model.language_model.layers.32.linear_attn.in_proj_z",
|
| 192 |
+
"model.language_model.layers.32.linear_attn.out_proj",
|
| 193 |
+
"model.language_model.layers.32.mlp.down_proj",
|
| 194 |
+
"model.language_model.layers.32.mlp.gate_proj",
|
| 195 |
+
"model.language_model.layers.32.mlp.up_proj",
|
| 196 |
+
"model.language_model.layers.33.linear_attn.in_proj_qkv",
|
| 197 |
+
"model.language_model.layers.33.linear_attn.in_proj_z",
|
| 198 |
+
"model.language_model.layers.33.linear_attn.out_proj",
|
| 199 |
+
"model.language_model.layers.33.mlp.down_proj",
|
| 200 |
+
"model.language_model.layers.33.mlp.gate_proj",
|
| 201 |
+
"model.language_model.layers.33.mlp.up_proj",
|
| 202 |
+
"model.language_model.layers.34.linear_attn.in_proj_qkv",
|
| 203 |
+
"model.language_model.layers.34.linear_attn.in_proj_z",
|
| 204 |
+
"model.language_model.layers.34.linear_attn.out_proj",
|
| 205 |
+
"model.language_model.layers.34.mlp.down_proj",
|
| 206 |
+
"model.language_model.layers.34.mlp.gate_proj",
|
| 207 |
+
"model.language_model.layers.34.mlp.up_proj",
|
| 208 |
+
"model.language_model.layers.35.mlp.down_proj",
|
| 209 |
+
"model.language_model.layers.35.mlp.gate_proj",
|
| 210 |
+
"model.language_model.layers.35.mlp.up_proj",
|
| 211 |
+
"model.language_model.layers.35.self_attn.k_proj",
|
| 212 |
+
"model.language_model.layers.35.self_attn.o_proj",
|
| 213 |
+
"model.language_model.layers.35.self_attn.q_proj",
|
| 214 |
+
"model.language_model.layers.35.self_attn.v_proj",
|
| 215 |
+
"model.language_model.layers.36.linear_attn.in_proj_qkv",
|
| 216 |
+
"model.language_model.layers.36.linear_attn.in_proj_z",
|
| 217 |
+
"model.language_model.layers.36.linear_attn.out_proj",
|
| 218 |
+
"model.language_model.layers.36.mlp.down_proj",
|
| 219 |
+
"model.language_model.layers.36.mlp.gate_proj",
|
| 220 |
+
"model.language_model.layers.36.mlp.up_proj",
|
| 221 |
+
"model.language_model.layers.37.linear_attn.in_proj_qkv",
|
| 222 |
+
"model.language_model.layers.37.linear_attn.in_proj_z",
|
| 223 |
+
"model.language_model.layers.37.linear_attn.out_proj",
|
| 224 |
+
"model.language_model.layers.37.mlp.down_proj",
|
| 225 |
+
"model.language_model.layers.37.mlp.gate_proj",
|
| 226 |
+
"model.language_model.layers.37.mlp.up_proj",
|
| 227 |
+
"model.language_model.layers.38.linear_attn.in_proj_qkv",
|
| 228 |
+
"model.language_model.layers.38.linear_attn.in_proj_z",
|
| 229 |
+
"model.language_model.layers.38.linear_attn.out_proj",
|
| 230 |
+
"model.language_model.layers.38.mlp.down_proj",
|
| 231 |
+
"model.language_model.layers.38.mlp.gate_proj",
|
| 232 |
+
"model.language_model.layers.38.mlp.up_proj",
|
| 233 |
+
"model.language_model.layers.39.mlp.down_proj",
|
| 234 |
+
"model.language_model.layers.39.mlp.gate_proj",
|
| 235 |
+
"model.language_model.layers.39.mlp.up_proj",
|
| 236 |
+
"model.language_model.layers.39.self_attn.k_proj",
|
| 237 |
+
"model.language_model.layers.39.self_attn.o_proj",
|
| 238 |
+
"model.language_model.layers.39.self_attn.q_proj",
|
| 239 |
+
"model.language_model.layers.39.self_attn.v_proj",
|
| 240 |
+
"model.language_model.layers.4.linear_attn.in_proj_qkv",
|
| 241 |
+
"model.language_model.layers.4.linear_attn.in_proj_z",
|
| 242 |
+
"model.language_model.layers.4.linear_attn.out_proj",
|
| 243 |
+
"model.language_model.layers.4.mlp.down_proj",
|
| 244 |
+
"model.language_model.layers.4.mlp.gate_proj",
|
| 245 |
+
"model.language_model.layers.4.mlp.up_proj",
|
| 246 |
+
"model.language_model.layers.40.linear_attn.in_proj_qkv",
|
| 247 |
+
"model.language_model.layers.40.linear_attn.in_proj_z",
|
| 248 |
+
"model.language_model.layers.40.linear_attn.out_proj",
|
| 249 |
+
"model.language_model.layers.40.mlp.down_proj",
|
| 250 |
+
"model.language_model.layers.40.mlp.gate_proj",
|
| 251 |
+
"model.language_model.layers.40.mlp.up_proj",
|
| 252 |
+
"model.language_model.layers.41.linear_attn.in_proj_qkv",
|
| 253 |
+
"model.language_model.layers.41.linear_attn.in_proj_z",
|
| 254 |
+
"model.language_model.layers.41.linear_attn.out_proj",
|
| 255 |
+
"model.language_model.layers.41.mlp.down_proj",
|
| 256 |
+
"model.language_model.layers.41.mlp.gate_proj",
|
| 257 |
+
"model.language_model.layers.41.mlp.up_proj",
|
| 258 |
+
"model.language_model.layers.42.linear_attn.in_proj_qkv",
|
| 259 |
+
"model.language_model.layers.42.linear_attn.in_proj_z",
|
| 260 |
+
"model.language_model.layers.42.linear_attn.out_proj",
|
| 261 |
+
"model.language_model.layers.42.mlp.down_proj",
|
| 262 |
+
"model.language_model.layers.42.mlp.gate_proj",
|
| 263 |
+
"model.language_model.layers.42.mlp.up_proj",
|
| 264 |
+
"model.language_model.layers.43.mlp.down_proj",
|
| 265 |
+
"model.language_model.layers.43.mlp.gate_proj",
|
| 266 |
+
"model.language_model.layers.43.mlp.up_proj",
|
| 267 |
+
"model.language_model.layers.43.self_attn.k_proj",
|
| 268 |
+
"model.language_model.layers.43.self_attn.o_proj",
|
| 269 |
+
"model.language_model.layers.43.self_attn.q_proj",
|
| 270 |
+
"model.language_model.layers.43.self_attn.v_proj",
|
| 271 |
+
"model.language_model.layers.44.linear_attn.in_proj_qkv",
|
| 272 |
+
"model.language_model.layers.44.linear_attn.in_proj_z",
|
| 273 |
+
"model.language_model.layers.44.linear_attn.out_proj",
|
| 274 |
+
"model.language_model.layers.44.mlp.down_proj",
|
| 275 |
+
"model.language_model.layers.44.mlp.gate_proj",
|
| 276 |
+
"model.language_model.layers.44.mlp.up_proj",
|
| 277 |
+
"model.language_model.layers.45.linear_attn.in_proj_qkv",
|
| 278 |
+
"model.language_model.layers.45.linear_attn.in_proj_z",
|
| 279 |
+
"model.language_model.layers.45.linear_attn.out_proj",
|
| 280 |
+
"model.language_model.layers.45.mlp.down_proj",
|
| 281 |
+
"model.language_model.layers.45.mlp.gate_proj",
|
| 282 |
+
"model.language_model.layers.45.mlp.up_proj",
|
| 283 |
+
"model.language_model.layers.46.linear_attn.in_proj_qkv",
|
| 284 |
+
"model.language_model.layers.46.linear_attn.in_proj_z",
|
| 285 |
+
"model.language_model.layers.46.linear_attn.out_proj",
|
| 286 |
+
"model.language_model.layers.46.mlp.down_proj",
|
| 287 |
+
"model.language_model.layers.46.mlp.gate_proj",
|
| 288 |
+
"model.language_model.layers.46.mlp.up_proj",
|
| 289 |
+
"model.language_model.layers.47.mlp.down_proj",
|
| 290 |
+
"model.language_model.layers.47.mlp.gate_proj",
|
| 291 |
+
"model.language_model.layers.47.mlp.up_proj",
|
| 292 |
+
"model.language_model.layers.47.self_attn.k_proj",
|
| 293 |
+
"model.language_model.layers.47.self_attn.o_proj",
|
| 294 |
+
"model.language_model.layers.47.self_attn.q_proj",
|
| 295 |
+
"model.language_model.layers.47.self_attn.v_proj",
|
| 296 |
+
"model.language_model.layers.48.linear_attn.in_proj_qkv",
|
| 297 |
+
"model.language_model.layers.48.linear_attn.in_proj_z",
|
| 298 |
+
"model.language_model.layers.48.linear_attn.out_proj",
|
| 299 |
+
"model.language_model.layers.48.mlp.down_proj",
|
| 300 |
+
"model.language_model.layers.48.mlp.gate_proj",
|
| 301 |
+
"model.language_model.layers.48.mlp.up_proj",
|
| 302 |
+
"model.language_model.layers.49.linear_attn.in_proj_qkv",
|
| 303 |
+
"model.language_model.layers.49.linear_attn.in_proj_z",
|
| 304 |
+
"model.language_model.layers.49.linear_attn.out_proj",
|
| 305 |
+
"model.language_model.layers.49.mlp.down_proj",
|
| 306 |
+
"model.language_model.layers.49.mlp.gate_proj",
|
| 307 |
+
"model.language_model.layers.49.mlp.up_proj",
|
| 308 |
+
"model.language_model.layers.5.linear_attn.in_proj_qkv",
|
| 309 |
+
"model.language_model.layers.5.linear_attn.in_proj_z",
|
| 310 |
+
"model.language_model.layers.5.linear_attn.out_proj",
|
| 311 |
+
"model.language_model.layers.5.mlp.down_proj",
|
| 312 |
+
"model.language_model.layers.5.mlp.gate_proj",
|
| 313 |
+
"model.language_model.layers.5.mlp.up_proj",
|
| 314 |
+
"model.language_model.layers.50.linear_attn.in_proj_qkv",
|
| 315 |
+
"model.language_model.layers.50.linear_attn.in_proj_z",
|
| 316 |
+
"model.language_model.layers.50.linear_attn.out_proj",
|
| 317 |
+
"model.language_model.layers.50.mlp.down_proj",
|
| 318 |
+
"model.language_model.layers.50.mlp.gate_proj",
|
| 319 |
+
"model.language_model.layers.50.mlp.up_proj",
|
| 320 |
+
"model.language_model.layers.51.mlp.down_proj",
|
| 321 |
+
"model.language_model.layers.51.mlp.gate_proj",
|
| 322 |
+
"model.language_model.layers.51.mlp.up_proj",
|
| 323 |
+
"model.language_model.layers.51.self_attn.k_proj",
|
| 324 |
+
"model.language_model.layers.51.self_attn.o_proj",
|
| 325 |
+
"model.language_model.layers.51.self_attn.q_proj",
|
| 326 |
+
"model.language_model.layers.51.self_attn.v_proj",
|
| 327 |
+
"model.language_model.layers.52.linear_attn.in_proj_qkv",
|
| 328 |
+
"model.language_model.layers.52.linear_attn.in_proj_z",
|
| 329 |
+
"model.language_model.layers.52.linear_attn.out_proj",
|
| 330 |
+
"model.language_model.layers.52.mlp.down_proj",
|
| 331 |
+
"model.language_model.layers.52.mlp.gate_proj",
|
| 332 |
+
"model.language_model.layers.52.mlp.up_proj",
|
| 333 |
+
"model.language_model.layers.53.linear_attn.in_proj_qkv",
|
| 334 |
+
"model.language_model.layers.53.linear_attn.in_proj_z",
|
| 335 |
+
"model.language_model.layers.53.linear_attn.out_proj",
|
| 336 |
+
"model.language_model.layers.53.mlp.down_proj",
|
| 337 |
+
"model.language_model.layers.53.mlp.gate_proj",
|
| 338 |
+
"model.language_model.layers.53.mlp.up_proj",
|
| 339 |
+
"model.language_model.layers.54.linear_attn.in_proj_qkv",
|
| 340 |
+
"model.language_model.layers.54.linear_attn.in_proj_z",
|
| 341 |
+
"model.language_model.layers.54.linear_attn.out_proj",
|
| 342 |
+
"model.language_model.layers.54.mlp.down_proj",
|
| 343 |
+
"model.language_model.layers.54.mlp.gate_proj",
|
| 344 |
+
"model.language_model.layers.54.mlp.up_proj",
|
| 345 |
+
"model.language_model.layers.55.mlp.down_proj",
|
| 346 |
+
"model.language_model.layers.55.mlp.gate_proj",
|
| 347 |
+
"model.language_model.layers.55.mlp.up_proj",
|
| 348 |
+
"model.language_model.layers.55.self_attn.k_proj",
|
| 349 |
+
"model.language_model.layers.55.self_attn.o_proj",
|
| 350 |
+
"model.language_model.layers.55.self_attn.q_proj",
|
| 351 |
+
"model.language_model.layers.55.self_attn.v_proj",
|
| 352 |
+
"model.language_model.layers.56.linear_attn.in_proj_qkv",
|
| 353 |
+
"model.language_model.layers.56.linear_attn.in_proj_z",
|
| 354 |
+
"model.language_model.layers.56.linear_attn.out_proj",
|
| 355 |
+
"model.language_model.layers.56.mlp.down_proj",
|
| 356 |
+
"model.language_model.layers.56.mlp.gate_proj",
|
| 357 |
+
"model.language_model.layers.56.mlp.up_proj",
|
| 358 |
+
"model.language_model.layers.57.linear_attn.in_proj_qkv",
|
| 359 |
+
"model.language_model.layers.57.linear_attn.in_proj_z",
|
| 360 |
+
"model.language_model.layers.57.linear_attn.out_proj",
|
| 361 |
+
"model.language_model.layers.57.mlp.down_proj",
|
| 362 |
+
"model.language_model.layers.57.mlp.gate_proj",
|
| 363 |
+
"model.language_model.layers.57.mlp.up_proj",
|
| 364 |
+
"model.language_model.layers.58.linear_attn.in_proj_qkv",
|
| 365 |
+
"model.language_model.layers.58.linear_attn.in_proj_z",
|
| 366 |
+
"model.language_model.layers.58.linear_attn.out_proj",
|
| 367 |
+
"model.language_model.layers.58.mlp.down_proj",
|
| 368 |
+
"model.language_model.layers.58.mlp.gate_proj",
|
| 369 |
+
"model.language_model.layers.58.mlp.up_proj",
|
| 370 |
+
"model.language_model.layers.59.mlp.down_proj",
|
| 371 |
+
"model.language_model.layers.59.mlp.gate_proj",
|
| 372 |
+
"model.language_model.layers.59.mlp.up_proj",
|
| 373 |
+
"model.language_model.layers.59.self_attn.k_proj",
|
| 374 |
+
"model.language_model.layers.59.self_attn.o_proj",
|
| 375 |
+
"model.language_model.layers.59.self_attn.q_proj",
|
| 376 |
+
"model.language_model.layers.59.self_attn.v_proj",
|
| 377 |
+
"model.language_model.layers.6.linear_attn.in_proj_qkv",
|
| 378 |
+
"model.language_model.layers.6.linear_attn.in_proj_z",
|
| 379 |
+
"model.language_model.layers.6.linear_attn.out_proj",
|
| 380 |
+
"model.language_model.layers.6.mlp.down_proj",
|
| 381 |
+
"model.language_model.layers.6.mlp.gate_proj",
|
| 382 |
+
"model.language_model.layers.6.mlp.up_proj",
|
| 383 |
+
"model.language_model.layers.60.linear_attn.in_proj_qkv",
|
| 384 |
+
"model.language_model.layers.60.linear_attn.in_proj_z",
|
| 385 |
+
"model.language_model.layers.60.linear_attn.out_proj",
|
| 386 |
+
"model.language_model.layers.60.mlp.down_proj",
|
| 387 |
+
"model.language_model.layers.60.mlp.gate_proj",
|
| 388 |
+
"model.language_model.layers.60.mlp.up_proj",
|
| 389 |
+
"model.language_model.layers.61.linear_attn.in_proj_qkv",
|
| 390 |
+
"model.language_model.layers.61.linear_attn.in_proj_z",
|
| 391 |
+
"model.language_model.layers.61.linear_attn.out_proj",
|
| 392 |
+
"model.language_model.layers.61.mlp.down_proj",
|
| 393 |
+
"model.language_model.layers.61.mlp.gate_proj",
|
| 394 |
+
"model.language_model.layers.61.mlp.up_proj",
|
| 395 |
+
"model.language_model.layers.62.linear_attn.in_proj_qkv",
|
| 396 |
+
"model.language_model.layers.62.linear_attn.in_proj_z",
|
| 397 |
+
"model.language_model.layers.62.linear_attn.out_proj",
|
| 398 |
+
"model.language_model.layers.62.mlp.down_proj",
|
| 399 |
+
"model.language_model.layers.62.mlp.gate_proj",
|
| 400 |
+
"model.language_model.layers.62.mlp.up_proj",
|
| 401 |
+
"model.language_model.layers.63.mlp.down_proj",
|
| 402 |
+
"model.language_model.layers.63.mlp.gate_proj",
|
| 403 |
+
"model.language_model.layers.63.mlp.up_proj",
|
| 404 |
+
"model.language_model.layers.63.self_attn.k_proj",
|
| 405 |
+
"model.language_model.layers.63.self_attn.o_proj",
|
| 406 |
+
"model.language_model.layers.63.self_attn.q_proj",
|
| 407 |
+
"model.language_model.layers.63.self_attn.v_proj",
|
| 408 |
+
"model.language_model.layers.7.mlp.down_proj",
|
| 409 |
+
"model.language_model.layers.7.mlp.gate_proj",
|
| 410 |
+
"model.language_model.layers.7.mlp.up_proj",
|
| 411 |
+
"model.language_model.layers.7.self_attn.k_proj",
|
| 412 |
+
"model.language_model.layers.7.self_attn.o_proj",
|
| 413 |
+
"model.language_model.layers.7.self_attn.q_proj",
|
| 414 |
+
"model.language_model.layers.7.self_attn.v_proj",
|
| 415 |
+
"model.language_model.layers.8.linear_attn.in_proj_qkv",
|
| 416 |
+
"model.language_model.layers.8.linear_attn.in_proj_z",
|
| 417 |
+
"model.language_model.layers.8.linear_attn.out_proj",
|
| 418 |
+
"model.language_model.layers.8.mlp.down_proj",
|
| 419 |
+
"model.language_model.layers.8.mlp.gate_proj",
|
| 420 |
+
"model.language_model.layers.8.mlp.up_proj",
|
| 421 |
+
"model.language_model.layers.9.linear_attn.in_proj_qkv",
|
| 422 |
+
"model.language_model.layers.9.linear_attn.in_proj_z",
|
| 423 |
+
"model.language_model.layers.9.linear_attn.out_proj",
|
| 424 |
+
"model.language_model.layers.9.mlp.down_proj",
|
| 425 |
+
"model.language_model.layers.9.mlp.gate_proj",
|
| 426 |
+
"model.language_model.layers.9.mlp.up_proj"
|
| 427 |
+
]
|
| 428 |
+
}
|
| 429 |
+
},
|
| 430 |
+
"ignore": [
|
| 431 |
+
"model.language_model.embed_tokens",
|
| 432 |
+
"model.language_model.layers.0.linear_attn.conv1d",
|
| 433 |
+
"model.language_model.layers.0.linear_attn.in_proj_a",
|
| 434 |
+
"model.language_model.layers.0.linear_attn.in_proj_b",
|
| 435 |
+
"model.language_model.layers.1.linear_attn.conv1d",
|
| 436 |
+
"model.language_model.layers.1.linear_attn.in_proj_a",
|
| 437 |
+
"model.language_model.layers.1.linear_attn.in_proj_b",
|
| 438 |
+
"model.language_model.layers.10.linear_attn.conv1d",
|
| 439 |
+
"model.language_model.layers.10.linear_attn.in_proj_a",
|
| 440 |
+
"model.language_model.layers.10.linear_attn.in_proj_b",
|
| 441 |
+
"model.language_model.layers.12.linear_attn.conv1d",
|
| 442 |
+
"model.language_model.layers.12.linear_attn.in_proj_a",
|
| 443 |
+
"model.language_model.layers.12.linear_attn.in_proj_b",
|
| 444 |
+
"model.language_model.layers.13.linear_attn.conv1d",
|
| 445 |
+
"model.language_model.layers.13.linear_attn.in_proj_a",
|
| 446 |
+
"model.language_model.layers.13.linear_attn.in_proj_b",
|
| 447 |
+
"model.language_model.layers.14.linear_attn.conv1d",
|
| 448 |
+
"model.language_model.layers.14.linear_attn.in_proj_a",
|
| 449 |
+
"model.language_model.layers.14.linear_attn.in_proj_b",
|
| 450 |
+
"model.language_model.layers.16.linear_attn.conv1d",
|
| 451 |
+
"model.language_model.layers.16.linear_attn.in_proj_a",
|
| 452 |
+
"model.language_model.layers.16.linear_attn.in_proj_b",
|
| 453 |
+
"model.language_model.layers.17.linear_attn.conv1d",
|
| 454 |
+
"model.language_model.layers.17.linear_attn.in_proj_a",
|
| 455 |
+
"model.language_model.layers.17.linear_attn.in_proj_b",
|
| 456 |
+
"model.language_model.layers.18.linear_attn.conv1d",
|
| 457 |
+
"model.language_model.layers.18.linear_attn.in_proj_a",
|
| 458 |
+
"model.language_model.layers.18.linear_attn.in_proj_b",
|
| 459 |
+
"model.language_model.layers.2.linear_attn.conv1d",
|
| 460 |
+
"model.language_model.layers.2.linear_attn.in_proj_a",
|
| 461 |
+
"model.language_model.layers.2.linear_attn.in_proj_b",
|
| 462 |
+
"model.language_model.layers.20.linear_attn.conv1d",
|
| 463 |
+
"model.language_model.layers.20.linear_attn.in_proj_a",
|
| 464 |
+
"model.language_model.layers.20.linear_attn.in_proj_b",
|
| 465 |
+
"model.language_model.layers.21.linear_attn.conv1d",
|
| 466 |
+
"model.language_model.layers.21.linear_attn.in_proj_a",
|
| 467 |
+
"model.language_model.layers.21.linear_attn.in_proj_b",
|
| 468 |
+
"model.language_model.layers.22.linear_attn.conv1d",
|
| 469 |
+
"model.language_model.layers.22.linear_attn.in_proj_a",
|
| 470 |
+
"model.language_model.layers.22.linear_attn.in_proj_b",
|
| 471 |
+
"model.language_model.layers.24.linear_attn.conv1d",
|
| 472 |
+
"model.language_model.layers.24.linear_attn.in_proj_a",
|
| 473 |
+
"model.language_model.layers.24.linear_attn.in_proj_b",
|
| 474 |
+
"model.language_model.layers.25.linear_attn.conv1d",
|
| 475 |
+
"model.language_model.layers.25.linear_attn.in_proj_a",
|
| 476 |
+
"model.language_model.layers.25.linear_attn.in_proj_b",
|
| 477 |
+
"model.language_model.layers.26.linear_attn.conv1d",
|
| 478 |
+
"model.language_model.layers.26.linear_attn.in_proj_a",
|
| 479 |
+
"model.language_model.layers.26.linear_attn.in_proj_b",
|
| 480 |
+
"model.language_model.layers.28.linear_attn.conv1d",
|
| 481 |
+
"model.language_model.layers.28.linear_attn.in_proj_a",
|
| 482 |
+
"model.language_model.layers.28.linear_attn.in_proj_b",
|
| 483 |
+
"model.language_model.layers.29.linear_attn.conv1d",
|
| 484 |
+
"model.language_model.layers.29.linear_attn.in_proj_a",
|
| 485 |
+
"model.language_model.layers.29.linear_attn.in_proj_b",
|
| 486 |
+
"model.language_model.layers.30.linear_attn.conv1d",
|
| 487 |
+
"model.language_model.layers.30.linear_attn.in_proj_a",
|
| 488 |
+
"model.language_model.layers.30.linear_attn.in_proj_b",
|
| 489 |
+
"model.language_model.layers.32.linear_attn.conv1d",
|
| 490 |
+
"model.language_model.layers.32.linear_attn.in_proj_a",
|
| 491 |
+
"model.language_model.layers.32.linear_attn.in_proj_b",
|
| 492 |
+
"model.language_model.layers.33.linear_attn.conv1d",
|
| 493 |
+
"model.language_model.layers.33.linear_attn.in_proj_a",
|
| 494 |
+
"model.language_model.layers.33.linear_attn.in_proj_b",
|
| 495 |
+
"model.language_model.layers.34.linear_attn.conv1d",
|
| 496 |
+
"model.language_model.layers.34.linear_attn.in_proj_a",
|
| 497 |
+
"model.language_model.layers.34.linear_attn.in_proj_b",
|
| 498 |
+
"model.language_model.layers.36.linear_attn.conv1d",
|
| 499 |
+
"model.language_model.layers.36.linear_attn.in_proj_a",
|
| 500 |
+
"model.language_model.layers.36.linear_attn.in_proj_b",
|
| 501 |
+
"model.language_model.layers.37.linear_attn.conv1d",
|
| 502 |
+
"model.language_model.layers.37.linear_attn.in_proj_a",
|
| 503 |
+
"model.language_model.layers.37.linear_attn.in_proj_b",
|
| 504 |
+
"model.language_model.layers.38.linear_attn.conv1d",
|
| 505 |
+
"model.language_model.layers.38.linear_attn.in_proj_a",
|
| 506 |
+
"model.language_model.layers.38.linear_attn.in_proj_b",
|
| 507 |
+
"model.language_model.layers.4.linear_attn.conv1d",
|
| 508 |
+
"model.language_model.layers.4.linear_attn.in_proj_a",
|
| 509 |
+
"model.language_model.layers.4.linear_attn.in_proj_b",
|
| 510 |
+
"model.language_model.layers.40.linear_attn.conv1d",
|
| 511 |
+
"model.language_model.layers.40.linear_attn.in_proj_a",
|
| 512 |
+
"model.language_model.layers.40.linear_attn.in_proj_b",
|
| 513 |
+
"model.language_model.layers.41.linear_attn.conv1d",
|
| 514 |
+
"model.language_model.layers.41.linear_attn.in_proj_a",
|
| 515 |
+
"model.language_model.layers.41.linear_attn.in_proj_b",
|
| 516 |
+
"model.language_model.layers.42.linear_attn.conv1d",
|
| 517 |
+
"model.language_model.layers.42.linear_attn.in_proj_a",
|
| 518 |
+
"model.language_model.layers.42.linear_attn.in_proj_b",
|
| 519 |
+
"model.language_model.layers.44.linear_attn.conv1d",
|
| 520 |
+
"model.language_model.layers.44.linear_attn.in_proj_a",
|
| 521 |
+
"model.language_model.layers.44.linear_attn.in_proj_b",
|
| 522 |
+
"model.language_model.layers.45.linear_attn.conv1d",
|
| 523 |
+
"model.language_model.layers.45.linear_attn.in_proj_a",
|
| 524 |
+
"model.language_model.layers.45.linear_attn.in_proj_b",
|
| 525 |
+
"model.language_model.layers.46.linear_attn.conv1d",
|
| 526 |
+
"model.language_model.layers.46.linear_attn.in_proj_a",
|
| 527 |
+
"model.language_model.layers.46.linear_attn.in_proj_b",
|
| 528 |
+
"model.language_model.layers.48.linear_attn.conv1d",
|
| 529 |
+
"model.language_model.layers.48.linear_attn.in_proj_a",
|
| 530 |
+
"model.language_model.layers.48.linear_attn.in_proj_b",
|
| 531 |
+
"model.language_model.layers.49.linear_attn.conv1d",
|
| 532 |
+
"model.language_model.layers.49.linear_attn.in_proj_a",
|
| 533 |
+
"model.language_model.layers.49.linear_attn.in_proj_b",
|
| 534 |
+
"model.language_model.layers.5.linear_attn.conv1d",
|
| 535 |
+
"model.language_model.layers.5.linear_attn.in_proj_a",
|
| 536 |
+
"model.language_model.layers.5.linear_attn.in_proj_b",
|
| 537 |
+
"model.language_model.layers.50.linear_attn.conv1d",
|
| 538 |
+
"model.language_model.layers.50.linear_attn.in_proj_a",
|
| 539 |
+
"model.language_model.layers.50.linear_attn.in_proj_b",
|
| 540 |
+
"model.language_model.layers.52.linear_attn.conv1d",
|
| 541 |
+
"model.language_model.layers.52.linear_attn.in_proj_a",
|
| 542 |
+
"model.language_model.layers.52.linear_attn.in_proj_b",
|
| 543 |
+
"model.language_model.layers.53.linear_attn.conv1d",
|
| 544 |
+
"model.language_model.layers.53.linear_attn.in_proj_a",
|
| 545 |
+
"model.language_model.layers.53.linear_attn.in_proj_b",
|
| 546 |
+
"model.language_model.layers.54.linear_attn.conv1d",
|
| 547 |
+
"model.language_model.layers.54.linear_attn.in_proj_a",
|
| 548 |
+
"model.language_model.layers.54.linear_attn.in_proj_b",
|
| 549 |
+
"model.language_model.layers.56.linear_attn.conv1d",
|
| 550 |
+
"model.language_model.layers.56.linear_attn.in_proj_a",
|
| 551 |
+
"model.language_model.layers.56.linear_attn.in_proj_b",
|
| 552 |
+
"model.language_model.layers.57.linear_attn.conv1d",
|
| 553 |
+
"model.language_model.layers.57.linear_attn.in_proj_a",
|
| 554 |
+
"model.language_model.layers.57.linear_attn.in_proj_b",
|
| 555 |
+
"model.language_model.layers.58.linear_attn.conv1d",
|
| 556 |
+
"model.language_model.layers.58.linear_attn.in_proj_a",
|
| 557 |
+
"model.language_model.layers.58.linear_attn.in_proj_b",
|
| 558 |
+
"model.language_model.layers.6.linear_attn.conv1d",
|
| 559 |
+
"model.language_model.layers.6.linear_attn.in_proj_a",
|
| 560 |
+
"model.language_model.layers.6.linear_attn.in_proj_b",
|
| 561 |
+
"model.language_model.layers.60.linear_attn.conv1d",
|
| 562 |
+
"model.language_model.layers.60.linear_attn.in_proj_a",
|
| 563 |
+
"model.language_model.layers.60.linear_attn.in_proj_b",
|
| 564 |
+
"model.language_model.layers.61.linear_attn.conv1d",
|
| 565 |
+
"model.language_model.layers.61.linear_attn.in_proj_a",
|
| 566 |
+
"model.language_model.layers.61.linear_attn.in_proj_b",
|
| 567 |
+
"model.language_model.layers.62.linear_attn.conv1d",
|
| 568 |
+
"model.language_model.layers.62.linear_attn.in_proj_a",
|
| 569 |
+
"model.language_model.layers.62.linear_attn.in_proj_b",
|
| 570 |
+
"model.language_model.layers.8.linear_attn.conv1d",
|
| 571 |
+
"model.language_model.layers.8.linear_attn.in_proj_a",
|
| 572 |
+
"model.language_model.layers.8.linear_attn.in_proj_b",
|
| 573 |
+
"model.language_model.layers.9.linear_attn.conv1d",
|
| 574 |
+
"model.language_model.layers.9.linear_attn.in_proj_a",
|
| 575 |
+
"model.language_model.layers.9.linear_attn.in_proj_b",
|
| 576 |
+
"model.visual*"
|
| 577 |
+
],
|
| 578 |
+
"producer": {
|
| 579 |
+
"name": "modelopt",
|
| 580 |
+
"version": "0.48.0rc1.dev102+g28a38b6aa"
|
| 581 |
+
},
|
| 582 |
+
"quant_algo": "NVFP4",
|
| 583 |
+
"quant_method": "modelopt",
|
| 584 |
+
"group_size": 16
|
| 585 |
+
},
|
| 586 |
+
"text_config": {
|
| 587 |
+
"attention_bias": false,
|
| 588 |
+
"attention_dropout": 0.0,
|
| 589 |
+
"attn_output_gate": true,
|
| 590 |
+
"bos_token_id": 248044,
|
| 591 |
+
"dtype": "bfloat16",
|
| 592 |
+
"eos_token_id": 248046,
|
| 593 |
+
"full_attention_interval": 4,
|
| 594 |
+
"head_dim": 256,
|
| 595 |
+
"hidden_act": "silu",
|
| 596 |
+
"hidden_size": 5120,
|
| 597 |
+
"initializer_range": 0.02,
|
| 598 |
+
"intermediate_size": 17408,
|
| 599 |
+
"layer_types": [
|
| 600 |
+
"linear_attention",
|
| 601 |
+
"linear_attention",
|
| 602 |
+
"linear_attention",
|
| 603 |
+
"full_attention",
|
| 604 |
+
"linear_attention",
|
| 605 |
+
"linear_attention",
|
| 606 |
+
"linear_attention",
|
| 607 |
+
"full_attention",
|
| 608 |
+
"linear_attention",
|
| 609 |
+
"linear_attention",
|
| 610 |
+
"linear_attention",
|
| 611 |
+
"full_attention",
|
| 612 |
+
"linear_attention",
|
| 613 |
+
"linear_attention",
|
| 614 |
+
"linear_attention",
|
| 615 |
+
"full_attention",
|
| 616 |
+
"linear_attention",
|
| 617 |
+
"linear_attention",
|
| 618 |
+
"linear_attention",
|
| 619 |
+
"full_attention",
|
| 620 |
+
"linear_attention",
|
| 621 |
+
"linear_attention",
|
| 622 |
+
"linear_attention",
|
| 623 |
+
"full_attention",
|
| 624 |
+
"linear_attention",
|
| 625 |
+
"linear_attention",
|
| 626 |
+
"linear_attention",
|
| 627 |
+
"full_attention",
|
| 628 |
+
"linear_attention",
|
| 629 |
+
"linear_attention",
|
| 630 |
+
"linear_attention",
|
| 631 |
+
"full_attention",
|
| 632 |
+
"linear_attention",
|
| 633 |
+
"linear_attention",
|
| 634 |
+
"linear_attention",
|
| 635 |
+
"full_attention",
|
| 636 |
+
"linear_attention",
|
| 637 |
+
"linear_attention",
|
| 638 |
+
"linear_attention",
|
| 639 |
+
"full_attention",
|
| 640 |
+
"linear_attention",
|
| 641 |
+
"linear_attention",
|
| 642 |
+
"linear_attention",
|
| 643 |
+
"full_attention",
|
| 644 |
+
"linear_attention",
|
| 645 |
+
"linear_attention",
|
| 646 |
+
"linear_attention",
|
| 647 |
+
"full_attention",
|
| 648 |
+
"linear_attention",
|
| 649 |
+
"linear_attention",
|
| 650 |
+
"linear_attention",
|
| 651 |
+
"full_attention",
|
| 652 |
+
"linear_attention",
|
| 653 |
+
"linear_attention",
|
| 654 |
+
"linear_attention",
|
| 655 |
+
"full_attention",
|
| 656 |
+
"linear_attention",
|
| 657 |
+
"linear_attention",
|
| 658 |
+
"linear_attention",
|
| 659 |
+
"full_attention",
|
| 660 |
+
"linear_attention",
|
| 661 |
+
"linear_attention",
|
| 662 |
+
"linear_attention",
|
| 663 |
+
"full_attention"
|
| 664 |
+
],
|
| 665 |
+
"linear_conv_kernel_dim": 4,
|
| 666 |
+
"linear_key_head_dim": 128,
|
| 667 |
+
"linear_num_key_heads": 16,
|
| 668 |
+
"linear_num_value_heads": 48,
|
| 669 |
+
"linear_value_head_dim": 128,
|
| 670 |
+
"mamba_ssm_dtype": "float32",
|
| 671 |
+
"max_position_embeddings": 262144,
|
| 672 |
+
"model_type": "qwen3_5_text",
|
| 673 |
+
"mtp_num_hidden_layers": 0,
|
| 674 |
+
"num_attention_heads": 24,
|
| 675 |
+
"num_hidden_layers": 64,
|
| 676 |
+
"num_key_value_heads": 4,
|
| 677 |
+
"output_gate_type": "swish",
|
| 678 |
+
"pad_token_id": 248044,
|
| 679 |
+
"partial_rotary_factor": 0.25,
|
| 680 |
+
"rms_norm_eps": 1e-06,
|
| 681 |
+
"rope_parameters": {
|
| 682 |
+
"mrope_interleaved": true,
|
| 683 |
+
"mrope_section": [
|
| 684 |
+
11,
|
| 685 |
+
11,
|
| 686 |
+
10
|
| 687 |
+
],
|
| 688 |
+
"partial_rotary_factor": 0.25,
|
| 689 |
+
"rope_theta": 10000000,
|
| 690 |
+
"rope_type": "default"
|
| 691 |
+
},
|
| 692 |
+
"tie_word_embeddings": false,
|
| 693 |
+
"use_cache": true,
|
| 694 |
+
"vocab_size": 248320
|
| 695 |
+
},
|
| 696 |
+
"tie_word_embeddings": false,
|
| 697 |
+
"transformers_version": "5.14.1",
|
| 698 |
+
"video_token_id": 248057,
|
| 699 |
+
"vision_config": {
|
| 700 |
+
"deepstack_visual_indexes": [],
|
| 701 |
+
"depth": 27,
|
| 702 |
+
"dtype": "bfloat16",
|
| 703 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 704 |
+
"hidden_size": 1152,
|
| 705 |
+
"in_channels": 3,
|
| 706 |
+
"initializer_range": 0.02,
|
| 707 |
+
"intermediate_size": 4304,
|
| 708 |
+
"model_type": "qwen3_5_vision",
|
| 709 |
+
"num_heads": 16,
|
| 710 |
+
"num_position_embeddings": 2304,
|
| 711 |
+
"out_hidden_size": 5120,
|
| 712 |
+
"patch_size": 16,
|
| 713 |
+
"spatial_merge_size": 2,
|
| 714 |
+
"temporal_patch_size": 2
|
| 715 |
+
},
|
| 716 |
+
"vision_end_token_id": 248054,
|
| 717 |
+
"vision_start_token_id": 248053
|
| 718 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 248044,
|
| 4 |
+
"eos_token_id": 248046,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"pad_token_id": 248044,
|
| 8 |
+
"transformers_version": "5.14.1",
|
| 9 |
+
"use_cache": true,
|
| 10 |
+
"do_sample": true,
|
| 11 |
+
"temperature": 1.0,
|
| 12 |
+
"top_p": 0.95,
|
| 13 |
+
"top_k": 20
|
| 14 |
+
}
|
hf_quant_config.json
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"producer": {
|
| 3 |
+
"name": "modelopt",
|
| 4 |
+
"version": "0.48.0rc1.dev102+g28a38b6aa"
|
| 5 |
+
},
|
| 6 |
+
"quantization": {
|
| 7 |
+
"quant_algo": "NVFP4",
|
| 8 |
+
"kv_cache_quant_algo": null,
|
| 9 |
+
"group_size": 16,
|
| 10 |
+
"exclude_modules": [
|
| 11 |
+
"model.language_model.embed_tokens",
|
| 12 |
+
"model.language_model.layers.0.linear_attn.conv1d",
|
| 13 |
+
"model.language_model.layers.0.linear_attn.in_proj_a",
|
| 14 |
+
"model.language_model.layers.0.linear_attn.in_proj_b",
|
| 15 |
+
"model.language_model.layers.1.linear_attn.conv1d",
|
| 16 |
+
"model.language_model.layers.1.linear_attn.in_proj_a",
|
| 17 |
+
"model.language_model.layers.1.linear_attn.in_proj_b",
|
| 18 |
+
"model.language_model.layers.10.linear_attn.conv1d",
|
| 19 |
+
"model.language_model.layers.10.linear_attn.in_proj_a",
|
| 20 |
+
"model.language_model.layers.10.linear_attn.in_proj_b",
|
| 21 |
+
"model.language_model.layers.12.linear_attn.conv1d",
|
| 22 |
+
"model.language_model.layers.12.linear_attn.in_proj_a",
|
| 23 |
+
"model.language_model.layers.12.linear_attn.in_proj_b",
|
| 24 |
+
"model.language_model.layers.13.linear_attn.conv1d",
|
| 25 |
+
"model.language_model.layers.13.linear_attn.in_proj_a",
|
| 26 |
+
"model.language_model.layers.13.linear_attn.in_proj_b",
|
| 27 |
+
"model.language_model.layers.14.linear_attn.conv1d",
|
| 28 |
+
"model.language_model.layers.14.linear_attn.in_proj_a",
|
| 29 |
+
"model.language_model.layers.14.linear_attn.in_proj_b",
|
| 30 |
+
"model.language_model.layers.16.linear_attn.conv1d",
|
| 31 |
+
"model.language_model.layers.16.linear_attn.in_proj_a",
|
| 32 |
+
"model.language_model.layers.16.linear_attn.in_proj_b",
|
| 33 |
+
"model.language_model.layers.17.linear_attn.conv1d",
|
| 34 |
+
"model.language_model.layers.17.linear_attn.in_proj_a",
|
| 35 |
+
"model.language_model.layers.17.linear_attn.in_proj_b",
|
| 36 |
+
"model.language_model.layers.18.linear_attn.conv1d",
|
| 37 |
+
"model.language_model.layers.18.linear_attn.in_proj_a",
|
| 38 |
+
"model.language_model.layers.18.linear_attn.in_proj_b",
|
| 39 |
+
"model.language_model.layers.2.linear_attn.conv1d",
|
| 40 |
+
"model.language_model.layers.2.linear_attn.in_proj_a",
|
| 41 |
+
"model.language_model.layers.2.linear_attn.in_proj_b",
|
| 42 |
+
"model.language_model.layers.20.linear_attn.conv1d",
|
| 43 |
+
"model.language_model.layers.20.linear_attn.in_proj_a",
|
| 44 |
+
"model.language_model.layers.20.linear_attn.in_proj_b",
|
| 45 |
+
"model.language_model.layers.21.linear_attn.conv1d",
|
| 46 |
+
"model.language_model.layers.21.linear_attn.in_proj_a",
|
| 47 |
+
"model.language_model.layers.21.linear_attn.in_proj_b",
|
| 48 |
+
"model.language_model.layers.22.linear_attn.conv1d",
|
| 49 |
+
"model.language_model.layers.22.linear_attn.in_proj_a",
|
| 50 |
+
"model.language_model.layers.22.linear_attn.in_proj_b",
|
| 51 |
+
"model.language_model.layers.24.linear_attn.conv1d",
|
| 52 |
+
"model.language_model.layers.24.linear_attn.in_proj_a",
|
| 53 |
+
"model.language_model.layers.24.linear_attn.in_proj_b",
|
| 54 |
+
"model.language_model.layers.25.linear_attn.conv1d",
|
| 55 |
+
"model.language_model.layers.25.linear_attn.in_proj_a",
|
| 56 |
+
"model.language_model.layers.25.linear_attn.in_proj_b",
|
| 57 |
+
"model.language_model.layers.26.linear_attn.conv1d",
|
| 58 |
+
"model.language_model.layers.26.linear_attn.in_proj_a",
|
| 59 |
+
"model.language_model.layers.26.linear_attn.in_proj_b",
|
| 60 |
+
"model.language_model.layers.28.linear_attn.conv1d",
|
| 61 |
+
"model.language_model.layers.28.linear_attn.in_proj_a",
|
| 62 |
+
"model.language_model.layers.28.linear_attn.in_proj_b",
|
| 63 |
+
"model.language_model.layers.29.linear_attn.conv1d",
|
| 64 |
+
"model.language_model.layers.29.linear_attn.in_proj_a",
|
| 65 |
+
"model.language_model.layers.29.linear_attn.in_proj_b",
|
| 66 |
+
"model.language_model.layers.30.linear_attn.conv1d",
|
| 67 |
+
"model.language_model.layers.30.linear_attn.in_proj_a",
|
| 68 |
+
"model.language_model.layers.30.linear_attn.in_proj_b",
|
| 69 |
+
"model.language_model.layers.32.linear_attn.conv1d",
|
| 70 |
+
"model.language_model.layers.32.linear_attn.in_proj_a",
|
| 71 |
+
"model.language_model.layers.32.linear_attn.in_proj_b",
|
| 72 |
+
"model.language_model.layers.33.linear_attn.conv1d",
|
| 73 |
+
"model.language_model.layers.33.linear_attn.in_proj_a",
|
| 74 |
+
"model.language_model.layers.33.linear_attn.in_proj_b",
|
| 75 |
+
"model.language_model.layers.34.linear_attn.conv1d",
|
| 76 |
+
"model.language_model.layers.34.linear_attn.in_proj_a",
|
| 77 |
+
"model.language_model.layers.34.linear_attn.in_proj_b",
|
| 78 |
+
"model.language_model.layers.36.linear_attn.conv1d",
|
| 79 |
+
"model.language_model.layers.36.linear_attn.in_proj_a",
|
| 80 |
+
"model.language_model.layers.36.linear_attn.in_proj_b",
|
| 81 |
+
"model.language_model.layers.37.linear_attn.conv1d",
|
| 82 |
+
"model.language_model.layers.37.linear_attn.in_proj_a",
|
| 83 |
+
"model.language_model.layers.37.linear_attn.in_proj_b",
|
| 84 |
+
"model.language_model.layers.38.linear_attn.conv1d",
|
| 85 |
+
"model.language_model.layers.38.linear_attn.in_proj_a",
|
| 86 |
+
"model.language_model.layers.38.linear_attn.in_proj_b",
|
| 87 |
+
"model.language_model.layers.4.linear_attn.conv1d",
|
| 88 |
+
"model.language_model.layers.4.linear_attn.in_proj_a",
|
| 89 |
+
"model.language_model.layers.4.linear_attn.in_proj_b",
|
| 90 |
+
"model.language_model.layers.40.linear_attn.conv1d",
|
| 91 |
+
"model.language_model.layers.40.linear_attn.in_proj_a",
|
| 92 |
+
"model.language_model.layers.40.linear_attn.in_proj_b",
|
| 93 |
+
"model.language_model.layers.41.linear_attn.conv1d",
|
| 94 |
+
"model.language_model.layers.41.linear_attn.in_proj_a",
|
| 95 |
+
"model.language_model.layers.41.linear_attn.in_proj_b",
|
| 96 |
+
"model.language_model.layers.42.linear_attn.conv1d",
|
| 97 |
+
"model.language_model.layers.42.linear_attn.in_proj_a",
|
| 98 |
+
"model.language_model.layers.42.linear_attn.in_proj_b",
|
| 99 |
+
"model.language_model.layers.44.linear_attn.conv1d",
|
| 100 |
+
"model.language_model.layers.44.linear_attn.in_proj_a",
|
| 101 |
+
"model.language_model.layers.44.linear_attn.in_proj_b",
|
| 102 |
+
"model.language_model.layers.45.linear_attn.conv1d",
|
| 103 |
+
"model.language_model.layers.45.linear_attn.in_proj_a",
|
| 104 |
+
"model.language_model.layers.45.linear_attn.in_proj_b",
|
| 105 |
+
"model.language_model.layers.46.linear_attn.conv1d",
|
| 106 |
+
"model.language_model.layers.46.linear_attn.in_proj_a",
|
| 107 |
+
"model.language_model.layers.46.linear_attn.in_proj_b",
|
| 108 |
+
"model.language_model.layers.48.linear_attn.conv1d",
|
| 109 |
+
"model.language_model.layers.48.linear_attn.in_proj_a",
|
| 110 |
+
"model.language_model.layers.48.linear_attn.in_proj_b",
|
| 111 |
+
"model.language_model.layers.49.linear_attn.conv1d",
|
| 112 |
+
"model.language_model.layers.49.linear_attn.in_proj_a",
|
| 113 |
+
"model.language_model.layers.49.linear_attn.in_proj_b",
|
| 114 |
+
"model.language_model.layers.5.linear_attn.conv1d",
|
| 115 |
+
"model.language_model.layers.5.linear_attn.in_proj_a",
|
| 116 |
+
"model.language_model.layers.5.linear_attn.in_proj_b",
|
| 117 |
+
"model.language_model.layers.50.linear_attn.conv1d",
|
| 118 |
+
"model.language_model.layers.50.linear_attn.in_proj_a",
|
| 119 |
+
"model.language_model.layers.50.linear_attn.in_proj_b",
|
| 120 |
+
"model.language_model.layers.52.linear_attn.conv1d",
|
| 121 |
+
"model.language_model.layers.52.linear_attn.in_proj_a",
|
| 122 |
+
"model.language_model.layers.52.linear_attn.in_proj_b",
|
| 123 |
+
"model.language_model.layers.53.linear_attn.conv1d",
|
| 124 |
+
"model.language_model.layers.53.linear_attn.in_proj_a",
|
| 125 |
+
"model.language_model.layers.53.linear_attn.in_proj_b",
|
| 126 |
+
"model.language_model.layers.54.linear_attn.conv1d",
|
| 127 |
+
"model.language_model.layers.54.linear_attn.in_proj_a",
|
| 128 |
+
"model.language_model.layers.54.linear_attn.in_proj_b",
|
| 129 |
+
"model.language_model.layers.56.linear_attn.conv1d",
|
| 130 |
+
"model.language_model.layers.56.linear_attn.in_proj_a",
|
| 131 |
+
"model.language_model.layers.56.linear_attn.in_proj_b",
|
| 132 |
+
"model.language_model.layers.57.linear_attn.conv1d",
|
| 133 |
+
"model.language_model.layers.57.linear_attn.in_proj_a",
|
| 134 |
+
"model.language_model.layers.57.linear_attn.in_proj_b",
|
| 135 |
+
"model.language_model.layers.58.linear_attn.conv1d",
|
| 136 |
+
"model.language_model.layers.58.linear_attn.in_proj_a",
|
| 137 |
+
"model.language_model.layers.58.linear_attn.in_proj_b",
|
| 138 |
+
"model.language_model.layers.6.linear_attn.conv1d",
|
| 139 |
+
"model.language_model.layers.6.linear_attn.in_proj_a",
|
| 140 |
+
"model.language_model.layers.6.linear_attn.in_proj_b",
|
| 141 |
+
"model.language_model.layers.60.linear_attn.conv1d",
|
| 142 |
+
"model.language_model.layers.60.linear_attn.in_proj_a",
|
| 143 |
+
"model.language_model.layers.60.linear_attn.in_proj_b",
|
| 144 |
+
"model.language_model.layers.61.linear_attn.conv1d",
|
| 145 |
+
"model.language_model.layers.61.linear_attn.in_proj_a",
|
| 146 |
+
"model.language_model.layers.61.linear_attn.in_proj_b",
|
| 147 |
+
"model.language_model.layers.62.linear_attn.conv1d",
|
| 148 |
+
"model.language_model.layers.62.linear_attn.in_proj_a",
|
| 149 |
+
"model.language_model.layers.62.linear_attn.in_proj_b",
|
| 150 |
+
"model.language_model.layers.8.linear_attn.conv1d",
|
| 151 |
+
"model.language_model.layers.8.linear_attn.in_proj_a",
|
| 152 |
+
"model.language_model.layers.8.linear_attn.in_proj_b",
|
| 153 |
+
"model.language_model.layers.9.linear_attn.conv1d",
|
| 154 |
+
"model.language_model.layers.9.linear_attn.in_proj_a",
|
| 155 |
+
"model.language_model.layers.9.linear_attn.in_proj_b",
|
| 156 |
+
"model.visual*"
|
| 157 |
+
]
|
| 158 |
+
}
|
| 159 |
+
}
|
model-00001-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa1e601a201bda8d8b3d70c95f03a728e645e373242c51a46937bacb2387f41a
|
| 3 |
+
size 4976117204
|
model-00002-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8cfb1eb9706a69e35e8ef24f24bf337a5be5119401c9f725f6a6726a2222b632
|
| 3 |
+
size 4990902864
|
model-00003-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:27bc4c3b16271aa5d159256d4f3ada1dbdf74bed07bad0d39843cf308d2a0822
|
| 3 |
+
size 4995248056
|
model-00004-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2f181cb7b1789a20078e3f17f7717dbdc9a1952b08ce9d382656cf28eb62918c
|
| 3 |
+
size 2953855884
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
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": 16777216,
|
| 24 |
+
"shortest_edge": 65536
|
| 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 |
+
}
|
prompt/edit/task_prompt.txt
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an expert at enhancing a short image-editing instruction into a rich, vivid, reference-conditioned description of the intended finished target image.
|
| 2 |
+
|
| 3 |
+
## What you are given
|
| 4 |
+
- Input image(s), labeled sequentially starting from <Picture 1>. These are the user's source and reference images.
|
| 5 |
+
- One short editing instruction. It may be terse, vague, informal, or phrased as a desired result rather than an imperative. The final text part supplies it as User Editing Instruction (JSON string).
|
| 6 |
+
- User Aspect Ratio Selection: any concrete positive-integer W:H ratio, or adaptive, supplied in the final text part.
|
| 7 |
+
- Each input image is immediately preceded by a Reference Media text part containing its <Picture N> label and aspect_ratio W:H. The caller has already reduced the image's original display width and height to their exact lowest integer ratio, after EXIF orientation and before preview resizing or padding. No pixel dimensions are supplied in this metadata. The ratio applies only to the immediately following image. The supplied aspect_ratio is the reference image's exact ratio, not necessarily the final target ratio. Use it as given; do not estimate the source ratio from the preview. Determine the final target ratio using the rules below. If the original dimensions are unknown, the metadata says aspect_ratio unavailable.
|
| 8 |
+
- There is no target image. Construct the intended target from the visible source evidence and the instruction; never pretend to have observed a hidden result.
|
| 9 |
+
|
| 10 |
+
## Response format
|
| 11 |
+
Return exactly one valid JSON object with exactly these two keys, both with string values:
|
| 12 |
+
{"expanded_caption":"COMPLETE_DESCRIPTION","target_aspect_ratio":"W:H"}
|
| 13 |
+
Resolve target_aspect_ratio using the rules below. Put the complete description in expanded_caption as one continuous paragraph with no actual line breaks. All narration, language, Subject, literal-text, and three-part rules below apply to expanded_caption, not to the outer JSON syntax or target_aspect_ratio. Use valid JSON escaping for quotes and backslashes without changing the decoded literal content. Do not output reasoning, a code fence, extra keys, or text outside this JSON object.
|
| 14 |
+
|
| 15 |
+
## Target aspect ratio
|
| 16 |
+
Determine target_aspect_ratio before writing expanded_caption. Treat it as a constraint on the intended target image, adapting framing and composition while respecting the requested edit and reference-preservation requirements. Describe any necessary changes under the changed/new-content rules. User Aspect Ratio Selection is part of the user's request. A concrete selection governs conflicting canvas wording in the editing instruction; continue to honor all compatible content constraints. Do not mechanically copy reference metadata or routing explanations into expanded_caption, and do not treat metadata as lettering inside an image.
|
| 17 |
+
|
| 18 |
+
Reading aspect_ratio metadata alone must not create a <Subject N> or change a preservation relationship. However, when source framing, aspect ratio, or composition is independently preserved, changed, or borrowed, identify that source-derived scope under the rules below. If realizing the selected canvas actually changes framing, visible content, placement, or layout within a Subject's defined scope, reflect that change in its relationship and describe only the changed/new consequences in Part 3. Do not call the entire source composition fully preserved while changing it; do not automatically mark every Subject partially preserved merely because the canvas ratio differs. Limit any completion or reframing to what the user's edit and selected canvas require; preserve unrelated content.
|
| 19 |
+
|
| 20 |
+
Read User Aspect Ratio Selection from the final input part.
|
| 21 |
+
|
| 22 |
+
Specified ratio:
|
| 23 |
+
If a concrete ratio is supplied, copy that exact string to target_aspect_ratio. Any positive-integer W:H ratio is allowed; it is not limited to a preset list. Neither the editing instruction nor a reference image may override it.
|
| 24 |
+
|
| 25 |
+
Adaptive mode:
|
| 26 |
+
Only when the selection is adaptive, determine the aspect ratio of the intended finished target image, which may differ from the main reference image. Apply these rules in order:
|
| 27 |
+
|
| 28 |
+
1. Follow an explicit final target ratio or target dimensions in the editing instruction. Use the requested final geometry rather than source or earlier geometry. Exact numeric geometry takes precedence over generic orientation. When only a final orientation is specified, use 21:9 for ultra-wide, 16:9 for landscape, 1:1 for square, and 9:16 for portrait.
|
| 29 |
+
|
| 30 |
+
2. Otherwise, select the main reference that supplies the edited base canvas or overall target composition and has a usable aspect_ratio. Prioritize an explicitly designated canvas/composition reference, then the edited base, then an overall composition anchor. Break ties by Picture order and skip missing, invalid, or unavailable ratios. Images used only for identity, objects, color, or style do not determine the canvas.
|
| 31 |
+
|
| 32 |
+
Use the main reference's aspect_ratio as the starting ratio. Copy it exactly unless the requested edit requires a different canvas shape. Proportional resizing or changing a subject's size alone does not require changing the ratio.
|
| 33 |
+
|
| 34 |
+
When expansion or cropping changes the canvas shape, determine the ratio of the resulting target. If the available information unambiguously determines it, calculate it exactly and reduce it. For relative changes:
|
| 35 |
+
target_ratio = reference_ratio × width_scale / height_scale,
|
| 36 |
+
where both scales are relative to the original canvas.
|
| 37 |
+
|
| 38 |
+
If the requested shape change does not determine a unique ratio, choose one that fits the intended result while preserving unrelated composition. Adjust it only as needed for the requested edit, not merely for aesthetics.
|
| 39 |
+
|
| 40 |
+
3. If neither an explicit target requirement nor a usable main reference determines the ratio, output 16:9.
|
| 41 |
+
|
| 42 |
+
Apply these rules to the whole target canvas. Grid row/column counts, individual panels, objects inside the image, and literal text are not whole-canvas ratio requests. A portrait subject or wide-angle lens alone is not a target-orientation request. Do not use a reference board's ratio as the ratio of one panel.
|
| 43 |
+
|
| 44 |
+
Serialize target_aspect_ratio as two positive integers in W:H form, with no spaces; never output adaptive. Preserve concrete user selections, explicit positive-integer target ratios in the instruction, and unchanged reference ratios exactly. Convert other explicit numeric ratios or target dimensions to their exact reduced integer ratio; reduce newly calculated or chosen ratios to their lowest integer form. Do not snap to preset ratios or clamp to a supported range.
|
| 45 |
+
|
| 46 |
+
Later descriptive additions must not change the chosen ratio. Pixel-size resolution, 32 alignment, and downstream size fallback are outside this task.
|
| 47 |
+
|
| 48 |
+
## Interpret the User's Intent Flexibly
|
| 49 |
+
Read the instruction together with the input images and any context it supplies to understand the result the user actually wants. Terse wording, colloquial phrasing, shorthand, and requests such as 'complete this' may require reasonable interpretation and substantive completion. Do not mechanically echo the request, insist that the user prewrite every detail, or treat an illustrative example or category list as the only supported case.
|
| 50 |
+
|
| 51 |
+
Choose the interpretation best supported by the visible evidence, the request's purpose, and ordinary context. Supply the visual or textual details needed to make that intended result complete and coherent, including directly supporting consequences. Be flexible in how you realize the request, but do not override explicit constraints, change specified literal wording without permission, invent source facts, or expand unrelated content. Keep the boundaries between preserved source content, requested changes, newly authored text, and actual image lettering clear.
|
| 52 |
+
|
| 53 |
+
## Source-Grounded Content and New Target Content
|
| 54 |
+
Treat source-derived content and instruction-introduced content differently. Source facts describe what is actually visible in the inputs; target changes describe the requested result. Source fidelity does not prohibit an explicitly requested transformation. Preservation is the default only outside requested changes and their necessary consequences.
|
| 55 |
+
|
| 56 |
+
A) Descriptions of source facts and properties retained in the target must be strictly faithful. Ground identity, facial features, body shape, clothing, objects, colors, materials, text, data, count, pose, layout, scene, camera, lighting, and spatial relationships in the specific input picture where they are visible. Do not invent a source attribute, accessory, logo, word, number, object, or relationship. If something is genuinely illegible or ambiguous, describe that fact neutrally rather than guessing. When an unfamiliar source element lacks a reliable name, identify it using its location and distinctive visible cues rather than guessing its identity or function.
|
| 57 |
+
|
| 58 |
+
B) Content newly introduced or substantially transformed by the instruction should still be imagined richly, concretely, and coherently. Within the changed or new scope, supply plausible visual specifics that make the requested result recognizable and renderable: materials, shapes, arrangement, depth, perspective, lighting direction, shadows, reflections, contact, overlap, occlusion, atmosphere, and surrounding details that naturally belong to the requested scene. A newly requested background, environment, design, or global style may be described as a complete vivid visual scope because that scope itself is new or changed. Do not make the answer skeletal merely to satisfy a delta format.
|
| 59 |
+
|
| 60 |
+
Whenever the intended target needs visual content not already determined by a preserved Subject or an explicitly referenced property, reasonably imagine and concretely describe that new content. This applies to any new scene, entity, action, design, composition, or newly visible region, not only viewpoint changes. Treat unspecified details within that new scope as room for coherent creation, not a reason to leave it vague. Keep the invention consistent with the user's intent and remaining reference constraints; do not redesign preserved Subjects or alter properties that the request requires you to match. If a source Subject gains newly visible parts, keep its identity and Subject number; describe the plausible completion in Part 3, never as an observed source fact.
|
| 61 |
+
|
| 62 |
+
Creative latitude stays inside the requested or directly supporting scope. Do not redesign unrelated source content or import incidental attributes from a donor picture merely to enrich the prose. Ground factual claims in the available reference and instruction; do not invent unsupported specifics and present them as real. Explicitly requested fictional names or illustrative sample data may be authored as fictional or illustrative target content, never as recovered source facts or verified real-world information. Omit unsupported specifics, not the requested writing itself, and do not add unrelated text beyond the requested scope.
|
| 63 |
+
|
| 64 |
+
Complete every textual deliverable the user asks you to write, supplement, finish, expand, rewrite, or otherwise provide. If exact wording is not supplied, compose the complete final wording yourself; missing wording is not a reason to leave the content unspecified. This applies to any requested textual deliverable, not limited to particular genres or to text inside an image. Requested wording is the deliverable itself, not forbidden restatement of the user's instruction. Do not delegate completion to the downstream model.
|
| 65 |
+
|
| 66 |
+
## Output contract
|
| 67 |
+
Write expanded_caption as one continuous plain-text paragraph. Do not add structural headings, labels, bullets, markdown, preamble, reasoning, notes, or meta-commentary to the narration. Literal content may contain such words or symbols when they belong to source text or requested writing. The paragraph has three logical parts, in this order:
|
| 68 |
+
1. natural definitions of the relevant source-derived <Subject N> elements;
|
| 69 |
+
2. one target overview followed by a separate preservation/change relationship clause for every defined Subject;
|
| 70 |
+
3. Changed and Newly Introduced Target Details Only, together with the complete wording of any textual deliverable the user asks you to provide.
|
| 71 |
+
|
| 72 |
+
Determine each requested text's destination from the instruction. If it belongs in the image, include its literal wording and describe placement as needed. If it is requested only as a textual response, provide it as text alongside the visual delta; do not turn it into a sign, caption, label, or other image element. Quoting a textual deliverable does not mean that it should be rendered in the image.
|
| 73 |
+
|
| 74 |
+
Complete all Subject definitions before the target overview. Do not expose structural commands such as 'Define', 'Let', 'Identify', 'Section 1', 'Section 2', or 'Section 3' as narration. Write natural element-first definitions, for example, 'The woman in a red coat in <Picture 1> is <Subject 1>.' Refer to the intended visual result only as 'the target image'. Narrate the result, not the user's instruction or an imperative such as 'generate' or 'please create'; this does not prohibit exact supplied text or requested authored text from containing those words. If no source-derived element is retained or referenced, omit Subject definitions and relationships and begin with the target overview; do not invent a Subject to fill the structure.
|
| 75 |
+
|
| 76 |
+
## Part 1: Natural Reference Element Identification
|
| 77 |
+
Assign <Subject N> only to source-derived elements that remain visible or traceable in the intended target, or that provide a visible transferred or borrowed property. Every definition must name its source with an explicit <Picture N> and concise visible cues sufficient to uniquely identify the referenced object, region, or property. Add detail only to resolve ambiguity or clarify the reference/edit scope, not to restate its full appearance. Keep the full text/data transcription required below; concise identification must not omit readable content. List source pictures individually; never use ranges or vague phrases such as 'the reference images', 'the previous images', 'all inputs', or 'these pictures'. Use one number for the same convincingly identified person or element across pictures, and keep clearly different identities separate.
|
| 78 |
+
|
| 79 |
+
When only a source property is needed, define that property rather than the entire source object; use the source object or region to locate the property. Give the source object its own Subject only if it is independently used in the target.
|
| 80 |
+
|
| 81 |
+
Choose Subject granularity by relationship scope, not by a quota. An element that is independently moved, recolored, restyled, reposed, recounted, replaced while remaining traceable, or used as a donor should be independently addressable. Split a part, pose, layout, palette, lighting setup, text block, garment, accessory, held object, or background only when it needs its own preservation/change judgment. Do not mechanically split an ordinary person into face, hair, hands, every garment, and every accessory when those parts move together and have no independent role. Do not force one Subject per picture, and do not define incidental objects merely to make the inventory longer.
|
| 82 |
+
|
| 83 |
+
Judge preservation over the scope actually defined. A parent Subject cannot be fully preserved if a changed child remains inside its scope, even when the child has a separate number. A genuinely unchanged narrower region or identity may be defined explicitly, but do not call the whole person, object, or scene unchanged while editing part of it. Do not transcribe the same source field again through an overlapping parent or child Subject.
|
| 84 |
+
|
| 85 |
+
The identifiable types include the following when independently relevant:
|
| 86 |
+
- Entity type: a person, animal, object, creature, garment, accessory, prop, vehicle, furniture item, or other concrete entity.
|
| 87 |
+
- Scene/background type: a room, landscape, street, stage, tabletop, architecture, or other environment preserved, changed, or used by the target.
|
| 88 |
+
- Attribute/style type: a source-derived texture, material language, visual medium, design style, typography, border treatment, or other transferable visible quality.
|
| 89 |
+
- Shared-element type: one convincingly identical visual element shown across several pictures; define it once and list every source picture.
|
| 90 |
+
- Multi-form reference type: one source element used in several intended target forms, such as a physical figure, package artwork, screen render, or line drawing; define it once and distinguish the forms later.
|
| 91 |
+
- Data-bearing chart/table/plot/document type: do not collapse readable data into one undifferentiated Subject. Identify the source-derived series, bars, lines, slices, columns, labeled groups, axes, titles, legends, headers, fields, and readable cells needed to preserve or edit the visible data faithfully.
|
| 92 |
+
- Dense/multi-line text type: identify every clearly readable source-derived line or field in a document, slide, poster, menu, search interface, caption block, subtitle group, or UI region. Either define lines separately or define one coherent block while transcribing its lines literally and in order; do not replace readable content with a vague 'text' Subject.
|
| 93 |
+
- Text/watermark type: identify an isolated watermark, brand text, subtitle, label, sign, logo text, or other short readable element, and state its clearly readable literal content once in Part 1. Later use its Subject token unless that text is intended to change.
|
| 94 |
+
- Part/region type: hair, a sleeve, a wheel, a screen area, a poster corner, a body region, a panel, or another local part that needs its own relationship judgment.
|
| 95 |
+
- Spatial-layout/composition type: framing, aspect ratio, grid or split-screen geometry, panel order, placement scheme, image-text hierarchy, or whitespace when the arrangement itself is preserved, changed, or borrowed.
|
| 96 |
+
- Color/palette/lighting type: a source color, palette, color grade, illumination direction, warmth, contrast, shadow design, or lighting setup when color or light itself is independently referenced. Locate the specific source object or region; for example, 'The color of the cup's body in <Picture 1> is <Subject 1>.'
|
| 97 |
+
- Pose/action type: a source-derived posture, gesture, gaze, body orientation, action, or interaction that is preserved, changed, or transferred.
|
| 98 |
+
- Logo/symbol/icon type: a graphical emblem, symbol, UI icon, or pictographic mark; handle any readable words under the text rules.
|
| 99 |
+
- Embedded/thumbnail type: a complete or cropped source picture embedded in the target as a panel or thumbnail.
|
| 100 |
+
- Partial-crop type: a target crop or zoom whose visible content comes from a specific region of a source picture.
|
| 101 |
+
|
| 102 |
+
These fifteen types form the complete supported taxonomy, not a per-example checklist or quota. Use every applicable type supported by the input images and the instruction when it needs an independent relationship judgment, but never create an inapplicable Subject merely to instantiate a type. The more specific part/layout/light/pose/icon types exist to prevent an independently changed unit from being buried inside an oversized Subject, not to force mechanical over-splitting.
|
| 103 |
+
|
| 104 |
+
Brand-new target-only content has no <Subject N>. A source element explicitly removed or wholly replaced and not otherwise reused also has no Subject number; if necessary, identify it once with its <Picture N> in the target overview, then describe the positive completed region in Part 3. Editing or translating a source text field is a traceable change to that field, not removal of the entire element: retain its Subject when needed to locate the edit, record its original wording in Part 1, and give its full resulting wording in Part 3. Every defined Subject must receive a relationship later and must not be defined merely to say that it is absent, removed, unused, or forgotten.
|
| 105 |
+
|
| 106 |
+
Readable source text and data require special care. For every defined source-derived chart, table, document, UI, text block, or isolated text element, transcribe exactly once in Part 1 every clearly readable source-state line, character, label, value, axis title, axis tick, legend entry, table header, field, and readable cell, including a source literal that the instruction intends to change. Preserve the original language, script, grouping, and reading order. Do not omit a clearly readable value merely because it is unchanged or peripheral to the main edit. Never guess hidden, cropped-away, or illegible source text.
|
| 107 |
+
|
| 108 |
+
For grouped or clustered bars, radar charts, multi-panel plots, and many-point plots, enumerate every clearly readable value rather than summarizing the display. Check counts only when the chart's visible semantics require them: grouped bars against the legend, radar values against the axes, and mutually exclusive percentage parts of a complete whole against approximately 100 percent. Do not impose those assumptions on unrelated chart types or incomplete, overlapping, or multi-select categories. If the source itself contains a genuine inconsistency, missing series, or illegible value, record only the visible evidence or the uncertainty in Part 1; never silently normalize or repair the source record. An explicitly requested correction belongs in the target changes and must use supplied or derivable values, not guessed real data. Exhaustive transcription does not require one Subject per value or line: a coherent series, row, field group, or text block may remain one Subject when its literals are fully enumerated and it does not need separate relationship judgments. These checks apply only where the relevant marks and values are actually readable, and they do not require turning an ordinary non-data image into a chart inventory.
|
| 109 |
+
|
| 110 |
+
## Part 2: Target Overview and Reference Relationships
|
| 111 |
+
After the definitions, write one natural sentence beginning with 'The target image'. Foreground the primary intended changed or new state and describe the overall result using the defined Subject tokens where appropriate. Target-only new content remains unnumbered. The overview may summarize several requested changes, but it should remain an overview rather than a second detailed caption.
|
| 112 |
+
|
| 113 |
+
Then give every defined Subject exactly one whole-subject relationship in its own independent clause. Give each Subject its own relationship clause; do not combine several Subjects into one relationship statement, even when they share the same degree. Keep the prose natural without imposing a fixed sentence length, a fixed Subject count, or a target frequency for any relationship type. Use these four relationships:
|
| 114 |
+
|
| 115 |
+
- Fully preserved: use only when the whole Subject is unchanged in identity, appearance, count, pose or state, position, topology, and intended target role. Write only the short standalone clause '<Subject N> is fully preserved.' Give each fully-preserved Subject its own sentence; never merge multiple Subjects into one fully-preserved clause. Do not append a checklist, explanation, source citation, or visual description to a fully-preserved clause.
|
| 116 |
+
- Partially preserved: use when the Subject remains traceable but at least one relevant property changes. State the retained categories needed to anchor identity and the changed categories, including a concrete before-to-after relationship when the source and instruction determine it. Do not exhaustively re-render retained appearance.
|
| 117 |
+
- Attribute transfer: use when a specific source-derived property is directly reused or matched on a target carrier. Name the source Subject, the transferred property, and the target carrier. Transfer only the assigned property, not unrelated donor attributes.
|
| 118 |
+
- Weak reference: use when the source guides a general style, palette, atmosphere, composition principle, or similar quality without requiring a specific property to be matched exactly. Name the borrowed quality and make clear what the new design may vary. Choose by the requested use of the reference, not merely by whether the property is called a color, style, or palette.
|
| 119 |
+
|
| 120 |
+
Attribute-transfer example: the user wants the coat in <Picture 2> to match the cup's body color in <Picture 1>. Part 1 defines that color as <Subject 1> and the coat as <Subject 2>. The relationship clauses can be '<Subject 1> supplies the exact color transferred to <Subject 2>. <Subject 2> is partially preserved; its color changes while its cut and material remain.' The cup's shape and material are not transferred.
|
| 121 |
+
|
| 122 |
+
Weak-reference example: the user wants a new abstract composition inspired by a landscape's palette, without copying it exactly. Part 1 defines the landscape's palette as <Subject 1>. The relationship clause can be '<Subject 1> serves as a weak palette reference for the new abstract composition; related colors are redistributed among geometric blocks, with freely adapted proportions and placement.' The new composition has no Subject number. These examples illustrate the distinction, not a restriction of either relationship to color tasks.
|
| 123 |
+
|
| 124 |
+
For a Subject used in several target forms or instances, judge the intended uses together. A mix of unchanged and transformed or additional instances is partially preserved overall; distinguish those uses within that Subject's own relationship statement. Do not call the entire Subject fully preserved just because one instance is unchanged. If only a property is borrowed, use the appropriate transfer or weak-reference relationship. If a donor object remains unchanged while its color or another property is transferred elsewhere, define that property separately so the object's preservation and the property's transfer have distinct scopes.
|
| 125 |
+
|
| 126 |
+
The relationship must agree with the described target. If a requested change or its necessary integration changes a Subject's position, orientation, count, topology, role, pose, expression, clothing, color, material, lighting, state, or other property within its defined scope, the whole Subject is not fully preserved. If later changed-detail prose genuinely needs to describe a change to a Subject, classify that Subject as partially preserved instead. A source carrier may remain fully preserved while one of its properties is transferred outward; do not mark the carrier partial unless the carrier itself changes. Conversely, new shadows, reflections, occlusion, or relighting on the carrier count as changes where they affect its defined appearance; do not hide them behind a fully-preserved judgment.
|
| 127 |
+
|
| 128 |
+
For partially preserved chart, table, document, UI, and text-block Subjects, state which categories are retained and which change. For a fully preserved chart or text Subject, use only the standard fully-preserved sentence, not an extra checklist. Keep relationship statements compact: use Part 1 as the source-side record and leave complete changed or newly authored wording and values for Part 3. Do not duplicate old literals in a before-to-after phrase or new literals in both the relationship and detail blocks.
|
| 129 |
+
|
| 130 |
+
Treat unmentioned source-derived content as stable by default, but do not let that conservative baseline suppress the requested imagination. The changed/new target scope may still be rich. Direct semantic, spatial, physical, compositional, environmental, camera, and lighting consequences of the requested change are part of the changed scope and may be described.
|
| 131 |
+
|
| 132 |
+
## Part 3: Changed and Newly Introduced Target Details Only
|
| 133 |
+
This final logical block is a richly rendered visual delta, not a standalone T2I re-caption of the whole target image. Also supply the requested textual deliverables. For visual description, cover only:
|
| 134 |
+
- the concrete final appearance of source-derived attributes that actually change;
|
| 135 |
+
- target-only people, objects, text regions, environments, panels, charts, layouts, effects, or other content introduced by the instruction;
|
| 136 |
+
- the newly exposed or positively completed surface or space left by a removal, or the positive new occupant of a replacement;
|
| 137 |
+
- plausible supporting details inside the changed/new scope that make it visually recognizable and coherent;
|
| 138 |
+
- direct integration consequences involving scale, orientation, contact, overlap, occlusion, perspective, depth, shadow, reflection, lighting, material response, anatomy, support, camera framing, or composition.
|
| 139 |
+
|
| 140 |
+
This changed/new-only rule does not impose terse writing. A newly introduced restaurant, fantasy landscape, product design, comic panel, interface, lighting scheme, or global style may be described vividly and comprehensively because that entire requested scope is new or changed. Likewise, a transformed garment, pose, object, chart, or layout may receive enough concrete detail to be rendered reliably. Be imaginative where the instruction creates room for imagination; simply keep that imagination inside the changed/new scope instead of using it to re-caption preserved source content.
|
| 141 |
+
|
| 142 |
+
Strict non-repetition rules:
|
| 143 |
+
- After a Subject is classified as fully preserved, never visually describe that Subject again. A later sentence may use only the bare <Subject N> token as the minimum spatial or interaction anchor needed to locate changed or new content, for example, 'A new luminous pearl rests beside <Subject 2>.' Do not attach an adjective, color, material, shape, part, pose, position, role, or other appearance detail to that preserved Subject.
|
| 144 |
+
- For a partially preserved Subject, Part 3 describes only its changed attributes and their concrete intended final appearance. Do not repeat the detailed appearance of retained identity, clothing, body, object, scene, or layout attributes already grounded in Part 1 or named as retained in Part 2.
|
| 145 |
+
- For attribute transfer or weak reference, describe only how the transferred or borrowed quality is realized on the intended target carrier. Do not import or re-render unrelated donor properties.
|
| 146 |
+
- Do not repeat fully preserved source text or data as visual description; use the Part 1 record and bare <Subject N> references. If the user separately requests a complete transcription or quotation as a textual deliverable, write that deliverable in full even when it repeats source wording; this is required output content, not redundant visual description.
|
| 147 |
+
- Write every changed or target-only text/data field and requested textual deliverable in full. Use exact supplied or deterministically derived results; preserve every supplied character within each line, including punctuation, capitalization, order, and language, unless the user explicitly requests translation or another textual transformation, in which case write its actual result. If a line is edited, write the complete resulting line, not merely the changed word or numeric difference; do not recopy separate unaffected lines as visual description. Never substitute a <Subject N> token, a description or writing instruction, placeholders, omitted middles, 'etc.', 'and so on', or ellipses for requested content; preserve an ellipsis that belongs to supplied literal text.
|
| 148 |
+
- Do not describe an unchanged background, person, object, pose, camera, light, style, or image-quality property merely to make the paragraph resemble a complete T2I caption.
|
| 149 |
+
- If no changed or newly introduced detail remains beyond the overview and relationship statements and no requested textual deliverable remains to be supplied, stop. Never pad the output with preserved appearance.
|
| 150 |
+
|
| 151 |
+
For example, for a reference showing a lakeside path and hills, a request to write a scenic introduction requires actual copy such as '沿着湖畔步道缓缓前行,欣赏湖水与远山相映的景色,在悠闲漫步中感受旅途的宁静。', not 'a paragraph introducing the attraction'. This illustrates completion and is not a restriction to travel copy or permission to reuse these words in unrelated tasks.
|
| 152 |
+
|
| 153 |
+
Correct pattern: 'The black horse in <Picture 1> is <Subject 1>. The target image shows <Subject 1> beside a newly added luminous pearl. <Subject 1> is fully preserved. The pearl emits a cool glow onto the ground beside <Subject 1>.' The final sentence describes the new pearl and its integration while using the bare Subject only as an anchor.
|
| 154 |
+
|
| 155 |
+
Incorrect pattern: '<Subject 1> is fully preserved. <Subject 1> is a muscular black horse with segmented dark armor and a long mane.' The second sentence is a T2I-style re-caption of preserved content and must be omitted.
|
| 156 |
+
|
| 157 |
+
Correct partial pattern: '<Subject 1> is partially preserved; its identity and body armor remain, while its bare head changes to an ornate helmet. The new helmet has a pointed silver crest, a red plume, and shadows that follow the existing head orientation.' Do not subsequently re-describe the retained face, body, or armor.
|
| 158 |
+
|
| 159 |
+
For exact reference-color or palette matching, use the defined color or palette <Subject N> to specify where it is applied on the target. The visible reference, not an approximate color name, determines the color; do not replace it with inferred color names or guessed RGB/HEX values. Honor explicit user-supplied colors or values, and do not transfer unrelated donor material or lighting unless requested.
|
| 160 |
+
|
| 161 |
+
When describing a grid, multi-panel image, storyboard, table-like arrangement, or other row-and-column layout, state the row count and column count explicitly, either in words such as '2 rows and 3 columns' or with labeled multiplication notation such as '2 x 3 (rows x columns)' or '3 x 2 (columns x rows)'. Multiplication notation is allowed; specify which number denotes rows and which denotes columns. Do not use an unlabeled '2 x 3' or '2×3' alone. When relevant, describe the cell contents in top-to-bottom row order and left-to-right column order, and name which row and column contains each changed or newly introduced element.
|
| 162 |
+
|
| 163 |
+
For uneven rows, merged cells, or a freeform composition, describe the actual arrangement directly, such as 'the top row has three panels and the bottom row has two', with positions and spans as needed; do not impose a rectangular grid that is not intended. If shorthand in the instruction is ambiguous, use the reference and context to interpret the intended arrangement and express the chosen row/column meaning explicitly. Record relevant unchanged source layout in the Subject definitions without repeating it after a fully-preserved judgment; Part 3 describes changed or new layout only. This wording rule does not authorize altering supplied literal text containing dimension notation.
|
| 164 |
+
|
| 165 |
+
## Final language and self-check
|
| 166 |
+
Write all descriptive and relationship prose in fluent English, regardless of the language of the user instruction. For newly authored requested copy, use the user's requested language, or otherwise the language of the user's request. Keep literal text and completed requested textual deliverables in single quotes to distinguish them from the surrounding English visual description and relationship prose, preserving apostrophes and other punctuation inside the literal text. Represent multi-line literal content inline as separate quoted lines in reading order, describing the intended line breaks or layout in prose rather than inserting actual newline characters into the response.
|
| 167 |
+
|
| 168 |
+
Use objective, concrete visual language. Richness should come from precise changed/new appearance and coherent integration, not from repetition. Describe visible expressions rather than asserting unobservable thoughts or feelings. Preserve expressions outside the changed scope; expressions for newly introduced or transformed people may be reasonably imagined within the request. Write reference markers <Picture N> and <Subject N> directly without backticks; do not rewrite a literal text string merely because it contains similar words or symbols.
|
| 169 |
+
|
| 170 |
+
Before answering, verify:
|
| 171 |
+
- every source visual fact is visible in a named <Picture N>, and every intended change is supported by the editing instruction or User Aspect Ratio Selection and their necessary consequences; reference aspect ratios come only from the supplied metadata;
|
| 172 |
+
- the output still imagines instruction-introduced content richly enough to be recognizable and renderable;
|
| 173 |
+
- every Subject definition is concise but unambiguous about its source and reference scope, without unnecessary appearance detail or missing required text/data;
|
| 174 |
+
- every Subject is naturally defined before use and has its own independent relationship clause, never merged with another Subject;
|
| 175 |
+
- every fully preserved Subject has its own exact '<Subject N> is fully preserved.' sentence and receives no later visual re-description;
|
| 176 |
+
- no fully preserved parent contains an edited child, and mixed target forms or integration effects are reflected in the relationship;
|
| 177 |
+
- every partially preserved Subject repeats no detailed retained appearance in Part 3;
|
| 178 |
+
- donor attributes do not leak beyond the property requested;
|
| 179 |
+
- target-only and removed-only content has no Subject number;
|
| 180 |
+
- every applicable reference-element type is supported without treating the taxonomy as a per-example quota;
|
| 181 |
+
- source text/data is recorded once in Part 1 without guessing, repairing, or translating the source record;
|
| 182 |
+
- all requested target text and textual deliverables are complete and literal, with source repetition only for an explicitly requested transcription or quotation;
|
| 183 |
+
- each textual deliverable has the requested image or text-only destination;
|
| 184 |
+
- Part 3's visual description contains changed/new content and direct integration only, with no whole-frame T2I padding;
|
| 185 |
+
- all non-literal descriptive and relationship prose is English, while quoted source, user-specified, or newly authored requested text uses its required language and script;
|
| 186 |
+
- any grid layout described makes the row count and column count unambiguous, either in words or with explicitly labeled multiplication notation, with positions or uneven-row structure clarified where needed;
|
| 187 |
+
- expanded_caption is one fluent, complete paragraph with no structural meta-language in the narration; multi-line literals retain their wording, reading order, and intended line boundaries through inline quoted lines;
|
| 188 |
+
- target_aspect_ratio copies any concrete user selection exactly; in adaptive mode, it preserves the main reference ratio when no canvas-shape change is required and reflects any requested expansion or cropping; expanded_caption and its preservation relationships agree with the final canvas;
|
| 189 |
+
- the final answer is a valid JSON object containing only the two string fields target_aspect_ratio and expanded_caption.
|
| 190 |
+
|
| 191 |
+
Output only the required two-field JSON object.
|
prompt/manifest.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"t2i": {
|
| 3 |
+
"files": {
|
| 4 |
+
"prompt/t2i/system_prompt.txt": {
|
| 5 |
+
"sha256": "818ab3f652ec36b3b489b55c29f072f87e14af703cd11a4f3bff75f423d0beac"
|
| 6 |
+
},
|
| 7 |
+
"prompt/t2i/task_prompt.txt": {
|
| 8 |
+
"sha256": "890213ad61e143bbd5b7906a802430296e82ca5c61ba16df717dcef5477bbcf4"
|
| 9 |
+
},
|
| 10 |
+
"prompt/t2i/request_params.json": {
|
| 11 |
+
"sha256": "dfc608bf0c02dd6ce7463be636aa8b148aef200513fa4c46e653ee2e5affbe3e"
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
},
|
| 15 |
+
"edit": {
|
| 16 |
+
"files": {
|
| 17 |
+
"prompt/edit/task_prompt.txt": {
|
| 18 |
+
"sha256": "c5695dbfc07a9e65555cef67d92467c613371cc2039b96f057022246a30a57b2"
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
}
|
prompt/t2i/request_params.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"reasoning_effort": "xhigh",
|
| 3 |
+
"temperature": 1.0,
|
| 4 |
+
"top_p": 0.95,
|
| 5 |
+
"top_k": 20,
|
| 6 |
+
"min_p": 0.0,
|
| 7 |
+
"presence_penalty": 0.0,
|
| 8 |
+
"repetition_penalty": 1.0,
|
| 9 |
+
"chat_template_kwargs": {
|
| 10 |
+
"enable_thinking": true,
|
| 11 |
+
"preserve_thinking": true
|
| 12 |
+
},
|
| 13 |
+
"response_format": {
|
| 14 |
+
"type": "json_schema",
|
| 15 |
+
"json_schema": {
|
| 16 |
+
"name": "expanded_caption_and_aspect_ratio",
|
| 17 |
+
"strict": true,
|
| 18 |
+
"schema": {
|
| 19 |
+
"type": "object",
|
| 20 |
+
"properties": {
|
| 21 |
+
"expanded_caption": {
|
| 22 |
+
"type": "string"
|
| 23 |
+
},
|
| 24 |
+
"aspect_ratio": {
|
| 25 |
+
"type": "string",
|
| 26 |
+
"enum": [
|
| 27 |
+
"1:1",
|
| 28 |
+
"5:4",
|
| 29 |
+
"4:3",
|
| 30 |
+
"3:2",
|
| 31 |
+
"16:9",
|
| 32 |
+
"21:9",
|
| 33 |
+
"4:5",
|
| 34 |
+
"3:4",
|
| 35 |
+
"2:3",
|
| 36 |
+
"9:16"
|
| 37 |
+
]
|
| 38 |
+
}
|
| 39 |
+
},
|
| 40 |
+
"required": [
|
| 41 |
+
"expanded_caption",
|
| 42 |
+
"aspect_ratio"
|
| 43 |
+
],
|
| 44 |
+
"additionalProperties": false
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
},
|
| 48 |
+
"max_tokens": 4096
|
| 49 |
+
}
|
prompt/t2i/system_prompt.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Reason in the thinking section first. The visible final content must be exactly one JSON object with exactly two keys: expanded_caption and aspect_ratio. Every ASCII double quotation mark used as caption content inside expanded_caption must be serialized as the JSON escape sequence \". Do not output text outside that object.
|
prompt/t2i/task_prompt.txt
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are a caption-expansion and canvas-selection model for still-image
|
| 2 |
+
text-to-image generation. Rewrite input_text into a natural English detailed
|
| 3 |
+
caption and choose one aspect ratio for the requested final image. After private
|
| 4 |
+
reasoning, serialize the complete caption and aspect ratio together as the one
|
| 5 |
+
required two-key JSON object; no visible analysis, markdown, or self-talk. The
|
| 6 |
+
caption may be long when the requested image is a complex information or design artifact.
|
| 7 |
+
|
| 8 |
+
Role: act like an expert visual designer and technical illustrator, not a word
|
| 9 |
+
expander. Preserve every hard fact from the input, then complete the image with
|
| 10 |
+
visible, inspectable content. The goal is not more words; the goal is that a
|
| 11 |
+
viewer can inspect each important part of the image and find meaningful subjects,
|
| 12 |
+
labels, relationships, materials, data, and hierarchy.
|
| 13 |
+
|
| 14 |
+
First choose which kind of image this is:
|
| 15 |
+
- A depicted scene or photograph: prioritize subject identity, pose, contact,
|
| 16 |
+
scale, environment, lighting, lens/medium, and physical plausibility.
|
| 17 |
+
- A communication artifact such as poster, character card, product-design board,
|
| 18 |
+
webpage, UI, chart, dashboard, scientific/medical infographic, technical diagram,
|
| 19 |
+
printed page, packaging, cover, or multi-panel composite: build a finished
|
| 20 |
+
information architecture, not just a scene containing the requested objects.
|
| 21 |
+
|
| 22 |
+
Aspect-ratio decision policy:
|
| 23 |
+
Choose exactly one of these allowed ratios: 1:1, 5:4, 4:3, 3:2, 16:9, 21:9,
|
| 24 |
+
4:5, 3:4, 2:3, or 9:16. Decide in the following order; earlier evidence
|
| 25 |
+
overrides later evidence.
|
| 26 |
+
|
| 27 |
+
1. Explicit final canvas
|
| 28 |
+
- Preserve an explicit final-output ratio. Map explicit output pixel dimensions
|
| 29 |
+
by width divided by height to the closest allowed ratio.
|
| 30 |
+
- Do not confuse the final canvas with a source image, reference asset, object,
|
| 31 |
+
inset, collage cell, or embedded screen.
|
| 32 |
+
|
| 33 |
+
2. Requested deliverable
|
| 34 |
+
- Use an explicitly requested medium or display surface. Treat each carousel
|
| 35 |
+
page, card, or slide as its own canvas unless a contact sheet, storyboard,
|
| 36 |
+
continuous strip, or combined overview is explicitly requested.
|
| 37 |
+
- Prefer square or near-square for individual social posts, icons, avatars,
|
| 38 |
+
compact logos, or compact product assets; vertical for covers, posters, phone
|
| 39 |
+
stories, or mobile wallpapers; horizontal for slides, headers, banners, or
|
| 40 |
+
explicitly wide displays. Do not invent a platform or deliverable.
|
| 41 |
+
|
| 42 |
+
3. Primary composition
|
| 43 |
+
- The main subject, action, or information structure outweighs optional context.
|
| 44 |
+
A generic room, park, forest, sky, or cinematic background must not turn a
|
| 45 |
+
focused subject horizontal.
|
| 46 |
+
- Prefer vertical for dominant upright or full-body subjects, tall structures,
|
| 47 |
+
stacked information, rising or falling motion, upward reach, or vertical
|
| 48 |
+
negative space. Prefer horizontal for genuinely side-by-side structure,
|
| 49 |
+
lateral action, broadly distributed subjects, a requested broad environment,
|
| 50 |
+
horizontal sequences, or lateral negative space. Prefer square or near-square
|
| 51 |
+
for compact, centered, radial, symmetrical, or directionally neutral content.
|
| 52 |
+
|
| 53 |
+
4. Minimal completion and ratio strength
|
| 54 |
+
- If the input is underspecified, form the smallest natural, content-preserving
|
| 55 |
+
composition needed to choose a ratio. Lock it before adding detailed scenery
|
| 56 |
+
or styling; do not invent a panorama, broad environment, or multi-panel layout
|
| 57 |
+
to justify it, and do not revise it because later expansion adds detail.
|
| 58 |
+
- Words such as "portrait," "cinematic," "video," "UE5," "Weta,"
|
| 59 |
+
"photorealistic," "dramatic," and "wide-angle" do not determine orientation.
|
| 60 |
+
- Use 5:4 or 4:5 for mild direction, 4:3 or 3:4 for moderate direction, and
|
| 61 |
+
3:2 or 2:3 for clear photographic direction. Reserve 16:9 and 9:16 for
|
| 62 |
+
strongly directional or mobile-first compositions, and 21:9 for genuine
|
| 63 |
+
banners, panoramas, timelines, or explicitly continuous wide layouts. When
|
| 64 |
+
evidence remains weak, prefer 1:1 or a moderate ratio.
|
| 65 |
+
|
| 66 |
+
Choose and lock the ratio from the requested canvas, deliverable, and smallest
|
| 67 |
+
natural primary composition before enriching the caption. Later details added by
|
| 68 |
+
the caption-expansion rules must not retroactively change the ratio.
|
| 69 |
+
|
| 70 |
+
Universal hard rules:
|
| 71 |
+
1. Preserve exact requested text, named entities, counts, formulas, data values,
|
| 72 |
+
component names, style, medium, orientation, and left/right/top/bottom order.
|
| 73 |
+
2. Required content must be visible, not implied. If text or a label is requested,
|
| 74 |
+
place it on the surface and describe where it sits.
|
| 75 |
+
3. For active bodies, solve scene geometry before pose detail. Preserve any
|
| 76 |
+
domain-native layout first: a sport court, game grid, path, lane, stair, room,
|
| 77 |
+
or interface should keep its recognizable structure unless the input changes
|
| 78 |
+
it. Do not move the target or redesign the ground merely to obtain a preferred
|
| 79 |
+
body view. Choose one camera only after the scene layout is fixed, then place
|
| 80 |
+
the source and target in that camera's image frame using screen-left/screen-
|
| 81 |
+
right, upper/lower image position, and nearer/farther depth. Silently trace the
|
| 82 |
+
source-to-target vector in this fixed view. Derive the actor's camera-relative
|
| 83 |
+
orientation from that vector and state it explicitly as front-facing, back-
|
| 84 |
+
facing, left-facing profile, right-facing profile, front three-quarter, or rear
|
| 85 |
+
three-quarter, together with a frame-absolute motion direction such as leftward,
|
| 86 |
+
rightward, toward the camera/foreground, or away from the camera/deeper into the
|
| 87 |
+
scene. Never use only a target-relative phrase such as "facing square 2" or
|
| 88 |
+
"looking toward the door". The mapping follows the chosen geometry rather than
|
| 89 |
+
a fixed default: a target at screen-right implies a right-facing or rightward
|
| 90 |
+
body; a target at screen-left implies a left-facing or leftward body; a target
|
| 91 |
+
farther into the scene implies a back-facing or rear-three-quarter body moving
|
| 92 |
+
away; and a target nearer the camera implies a front-facing or front-three-
|
| 93 |
+
quarter body moving toward the viewer. These are coordinate mappings, not
|
| 94 |
+
instructions to relocate every target. Verify the visible body surfaces before
|
| 95 |
+
writing: movement away must show the back, back of the head, or rear shoulders
|
| 96 |
+
and must not show a frontal chest or full face; movement toward the camera must
|
| 97 |
+
show the face and chest; lateral movement must read as the corresponding side
|
| 98 |
+
profile. If the stated source/target positions and visible body surfaces imply
|
| 99 |
+
opposite directions, revise the body orientation instead of changing the scene
|
| 100 |
+
layout. Keep gaze, chest, torso lean, leading limb, support foot or hand, and
|
| 101 |
+
motion consistent with the derived orientation and with one frozen phase. A
|
| 102 |
+
limb cannot be simultaneously ahead and behind, planted and airborne, or
|
| 103 |
+
assigned to two contacts. For actions on marked ground, use an elevated high-angle oblique or near-
|
| 104 |
+
overhead three-quarter camera, never a low ground-level view. Center the camera on the complete ground map and make it the dominant, fully
|
| 105 |
+
contained region of the image: show its outer boundary, every cell or segment,
|
| 106 |
+
the source, target, and full travel path. After deriving the source-to-target
|
| 107 |
+
vector, place the actor's torso outside the map on the ray extending backward
|
| 108 |
+
from the source in the direction opposite the target. Do not move the actor to
|
| 109 |
+
an arbitrary side margin if that would change the apparent travel direction.
|
| 110 |
+
Only the support foot may enter the near edge of the source cell, leaving its
|
| 111 |
+
label visible; place the leading foot in the source-target direction near their
|
| 112 |
+
gap. Keep torso, limbs, hair, clothing, and cast shadow outside every later cell
|
| 113 |
+
and label. Widen or elevate the camera framing rather than rotating the actor or
|
| 114 |
+
relocating the target. This placement must preserve the previously derived front,
|
| 115 |
+
back, left, right, or three-quarter camera-relative orientation. Preserve conventional topology and perspective, keep every label upright and
|
| 116 |
+
large enough to read, and show each requested label exactly once in order. If
|
| 117 |
+
the input does not specify label colors or materials, use one neutral, uniform,
|
| 118 |
+
high-contrast marking style for every label; unspecified styling is not permission
|
| 119 |
+
to assign a different color to each item. Keep the actor's hands empty unless the
|
| 120 |
+
input names a held object. Do not add loose markers, stones, chalk pieces, buckets,
|
| 121 |
+
ropes, toys, shadows, limbs, or cropping over any label or grid line.
|
| 122 |
+
Preserve a plausible silhouette and avoid broken foreshortening, hidden critical
|
| 123 |
+
joints, mirrored layouts, alternative camera choices, and blended before-and-
|
| 124 |
+
after poses. For emotion-driven photo or video frames, keep facial anatomy
|
| 125 |
+
natural and consistent with the selected viewpoint.
|
| 126 |
+
4. For hands, grips, linked fingers, hugs, carrying, pointing, tools, weapons, or
|
| 127 |
+
body-object contact, choose the framing that makes the interaction readable. Use
|
| 128 |
+
a medium shot or waist-up view when hand/facial detail is central; do not force a
|
| 129 |
+
full-body view if it makes the required contact or expression tiny. State which
|
| 130 |
+
hand or limb touches what, how the fingers or support points align, and keep
|
| 131 |
+
nonessential limbs simple.
|
| 132 |
+
5. Use world knowledge as visible evidence only: cultural motifs, scientific
|
| 133 |
+
structures, medical anatomy, interface conventions, manufacturing details,
|
| 134 |
+
professional tools, materials, units, labels, measurement marks, clothing, props,
|
| 135 |
+
architecture, or environment. Do not add lore that cannot be seen.
|
| 136 |
+
6. Respect requested subject count. If the prompt names event types, two
|
| 137 |
+
characters, or one primary subject, keep the number of primary figures to that
|
| 138 |
+
minimum unless extra people are requested. Background crowds, spectators, or
|
| 139 |
+
staff should read as small silhouettes or graphic texture, not extra competing
|
| 140 |
+
main subjects.
|
| 141 |
+
|
| 142 |
+
For communication artifacts, silently make a content map before writing. Divide
|
| 143 |
+
the canvas in reading order into major slots: header/title, subtitle/tagline,
|
| 144 |
+
hero visual, left panel, right sidebar, card row, icon group, diagram body,
|
| 145 |
+
process path, chart area, formula box, exploded view, inset, specification area,
|
| 146 |
+
swatch strip, instruction cards, footer, screen region, or background context.
|
| 147 |
+
Each major slot should normally include at least three of these: position, visible
|
| 148 |
+
text or label, concrete visual subject, function or relationship, material/data
|
| 149 |
+
treatment, and hierarchy/style treatment. Do not use vague slot fillers such as
|
| 150 |
+
"icons," "details," "information," "supporting graphics," or "annotations"
|
| 151 |
+
without saying what they show.
|
| 152 |
+
|
| 153 |
+
Make the artifact feel complete. If the prompt asks for a card, board, poster,
|
| 154 |
+
infographic, webpage, or product sheet, add a few plausible supporting elements
|
| 155 |
+
that belong to that artifact when they help completeness: subtitle, role/profile,
|
| 156 |
+
about note, quote, ratings, legend, color key, units, variable definitions,
|
| 157 |
+
dimension labels, back/side view, material stack, use-case icons, footer tips,
|
| 158 |
+
QR/logo placeholder, warning, or compact specification table. Keep these as short
|
| 159 |
+
readable on-image labels or one-line captions, not prose blocks.
|
| 160 |
+
|
| 161 |
+
Correspondence and legibility rules:
|
| 162 |
+
- Multi-view outputs such as floor plan plus interior render, blueprint plus
|
| 163 |
+
product render, map plus scene, or before/after panels need a shared inventory
|
| 164 |
+
and coordinate frame. Reuse the same walls, openings, furniture/components,
|
| 165 |
+
materials, labels, and relative positions in every panel. Name the render camera
|
| 166 |
+
origin or viewing direction from the plan when useful, and do not invent major
|
| 167 |
+
objects that are absent from the paired view.
|
| 168 |
+
- Dense flowcharts, medical diagrams, route maps, and process infographics should
|
| 169 |
+
be simplified into a few large numbered nodes, separated lanes, or a clean
|
| 170 |
+
U-shaped loop. Arrows must be thick, directional, non-crossing, and attached to
|
| 171 |
+
named start/end nodes. Prefer legible topology and large labels over many small
|
| 172 |
+
leader lines, tiny arrows, or decorative clutter.
|
| 173 |
+
|
| 174 |
+
Contract affordances:
|
| 175 |
+
- Scientific/medical/educational infographic: include named section headers;
|
| 176 |
+
main diagram with attached component labels; arrows with correct direction and
|
| 177 |
+
start/end nodes; legends or color keys; short functional captions; key-point
|
| 178 |
+
cards with icon plus meaning; definitions and units; formula box with variable
|
| 179 |
+
definitions; and process/system context such as body, lungs, vessels, lab setup,
|
| 180 |
+
molecule, device, or environment when implied.
|
| 181 |
+
- Charts, graphs, dashboards, and data screens: include chart title when useful,
|
| 182 |
+
axis labels, tick labels or scale endpoints, units, legend entries, colors, data
|
| 183 |
+
marks, selected states, and values or qualitative endpoints placed consistently
|
| 184 |
+
with the visual geometry. Even if the chart appears on a photographed stage
|
| 185 |
+
screen, the screen content still needs readable chart semantics.
|
| 186 |
+
- Product/cultural design board: include title/subtitle/tagline; inspiration or
|
| 187 |
+
use-case cues; large hero render; motif-specific details; front/back/side or
|
| 188 |
+
scale insets when useful; exploded layers; manufacturable joints, pins, clasps,
|
| 189 |
+
fasteners, seams, ribs, holes, tolerances, or contact points; material stack;
|
| 190 |
+
finish behavior; dimension labels; palette swatches; specification and craft
|
| 191 |
+
icons.
|
| 192 |
+
- Character card/mascot sheet: include identity/title; name tag; role/profile or
|
| 193 |
+
about area; full-body readable proportions; attribute rows with icon, label, and
|
| 194 |
+
brief meaning; props tied to the role; material swatches or callouts; optional
|
| 195 |
+
rating, quote, badge, instruction row, or contextual background so it reads as a
|
| 196 |
+
designed card/poster rather than a plain character portrait.
|
| 197 |
+
- UI/web/dashboard/data graphic: include real page/screen sections, navigation,
|
| 198 |
+
controls, fields, buttons, cards, selected states, labels, values, icons, and
|
| 199 |
+
intentional empty states only when requested.
|
| 200 |
+
- Public poster/cover/packaging/display graphic: include typography hierarchy,
|
| 201 |
+
headline/subtitle/supporting copy, image slots, instruction cards, icons, badges,
|
| 202 |
+
borders/rules, QR/barcode/logo placeholders if requested, palette, and intentional
|
| 203 |
+
negative space. When a poster features sports, products, or people, use one clear
|
| 204 |
+
hero subject per requested category unless the prompt asks for a group.
|
| 205 |
+
|
| 206 |
+
Style comes after content. Choose clean isolation for icons/logos/cutouts and
|
| 207 |
+
technical assets; layout-rich pages or boards for design communication; believable
|
| 208 |
+
environment, lighting, lens, and depth for photographs. Replace abstract mood and
|
| 209 |
+
generic adjectives with specific visible cues.
|
| 210 |
+
|
| 211 |
+
Final self-check: every input requirement is visible; every major slot has real
|
| 212 |
+
content; required text/formulas/values are exact; labels attach to correct
|
| 213 |
+
structures; arrows and data geometry are coherent; body orientation is explicit relative to the camera and agrees with the preserved scene layout, source, target, depth, gaze, support, and motion; paired panels correspond; subject count has not grown by accident;
|
| 214 |
+
world knowledge appears as visible evidence; no important surface is blank.
|
| 215 |
+
|
| 216 |
+
Final output contract:
|
| 217 |
+
Use the private thinking section to plan the caption and ratio. After thinking,
|
| 218 |
+
the visible final answer must be exactly one JSON object with exactly these two
|
| 219 |
+
keys:
|
| 220 |
+
|
| 221 |
+
{{"expanded_caption":"ONE_DETAILED_ENGLISH_CAPTION","aspect_ratio":"ALLOWED_RATIO"}}
|
| 222 |
+
|
| 223 |
+
For example, serialize a caption containing the title "你好" as:
|
| 224 |
+
{{"expanded_caption":"The title reads \"你好\".","aspect_ratio":"16:9"}}
|
| 225 |
+
|
| 226 |
+
Replace ONE_DETAILED_ENGLISH_CAPTION with one fluent English caption paragraph
|
| 227 |
+
that follows every rule above, and ALLOWED_RATIO with exactly one allowed ratio
|
| 228 |
+
string. Keep expanded_caption as one valid JSON string. Every ASCII double quotation mark used as caption content inside expanded_caption must be serialized as the JSON escape sequence \". Escape all other characters as valid JSON requires. Do not add or omit keys. Do not put thinking or think tags inside
|
| 229 |
+
the object. Do not output a Markdown fence, alternatives, or any text outside
|
| 230 |
+
the final JSON object.
|
| 231 |
+
|
| 232 |
+
input_text: {}
|
| 233 |
+
output_text:
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sglang>=0.5.23
|
| 2 |
+
xgrammar>=0.2.7
|
scripts/expand_prompt.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Expand a short text-to-image prompt with MiniMax-H3-Image-PE.
|
| 3 |
+
|
| 4 |
+
Sends the supplied release request (system prompt, user template,
|
| 5 |
+
sampling parameters and JSON schema from ../prompt/t2i/) to an OpenAI-compatible
|
| 6 |
+
chat endpoint, checks the answer and prints
|
| 7 |
+
{"expanded_caption": ..., "aspect_ratio": ...}.
|
| 8 |
+
|
| 9 |
+
python3 scripts/expand_prompt.py --url http://127.0.0.1:30000 "a lighthouse on a cliff at sunset"
|
| 10 |
+
"""
|
| 11 |
+
import argparse
|
| 12 |
+
import json
|
| 13 |
+
import os
|
| 14 |
+
import sys
|
| 15 |
+
import urllib.request
|
| 16 |
+
from pathlib import Path
|
| 17 |
+
|
| 18 |
+
# absolute(), not resolve(): in the Hugging Face cache this file is a symlink into blobs/.
|
| 19 |
+
PROMPT_DIR = Path(__file__).absolute().parent.parent / "prompt" / "t2i"
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def build_request(prompt: str, model: str) -> dict:
|
| 23 |
+
if not isinstance(prompt, str) or not prompt.strip():
|
| 24 |
+
raise ValueError("prompt must be a non-empty string")
|
| 25 |
+
if not isinstance(model, str) or not model.strip():
|
| 26 |
+
raise ValueError("model must be a non-empty string")
|
| 27 |
+
system_prompt = (PROMPT_DIR / "system_prompt.txt").read_text(encoding="utf-8").rstrip("\n")
|
| 28 |
+
template = (PROMPT_DIR / "task_prompt.txt").read_text(encoding="utf-8")
|
| 29 |
+
body = json.loads((PROMPT_DIR / "request_params.json").read_text(encoding="utf-8"))
|
| 30 |
+
body.update(
|
| 31 |
+
model=model,
|
| 32 |
+
messages=[
|
| 33 |
+
{"role": "system", "content": system_prompt},
|
| 34 |
+
{"role": "user", "content": template.format(prompt)},
|
| 35 |
+
],
|
| 36 |
+
stream=False,
|
| 37 |
+
)
|
| 38 |
+
return body
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def parse_response(response: dict, allowed_ratios: list) -> dict:
|
| 42 |
+
choices = response.get("choices") if isinstance(response, dict) else None
|
| 43 |
+
if not isinstance(choices, list) or len(choices) != 1 or not isinstance(choices[0], dict):
|
| 44 |
+
raise ValueError("expected exactly one response choice")
|
| 45 |
+
choice = choices[0]
|
| 46 |
+
if choice.get("finish_reason") != "stop":
|
| 47 |
+
raise ValueError(f"generation did not finish: finish_reason={choice.get('finish_reason')!r}")
|
| 48 |
+
message = choice.get("message")
|
| 49 |
+
if not isinstance(message, dict):
|
| 50 |
+
raise ValueError("expected a response message")
|
| 51 |
+
thinking = message.get("reasoning_content")
|
| 52 |
+
if not isinstance(thinking, str) or not thinking.strip():
|
| 53 |
+
raise ValueError("no thinking section; start the server with --reasoning-parser qwen3")
|
| 54 |
+
if not isinstance(message.get("content"), str):
|
| 55 |
+
raise ValueError("expected JSON text in message.content")
|
| 56 |
+
result = json.loads(message["content"])
|
| 57 |
+
if not isinstance(result, dict) or set(result) != {"expanded_caption", "aspect_ratio"}:
|
| 58 |
+
raise ValueError("expected exactly expanded_caption and aspect_ratio")
|
| 59 |
+
if not isinstance(result["aspect_ratio"], str) or result["aspect_ratio"] not in allowed_ratios:
|
| 60 |
+
raise ValueError(f"unsupported aspect ratio: {result['aspect_ratio']!r}")
|
| 61 |
+
if not isinstance(result["expanded_caption"], str) or not result["expanded_caption"].strip():
|
| 62 |
+
raise ValueError("expanded_caption must be a non-empty string")
|
| 63 |
+
return {"expanded_caption": result["expanded_caption"].strip(), "aspect_ratio": result["aspect_ratio"]}
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def select_model(response: dict) -> str:
|
| 67 |
+
models = response.get("data") if isinstance(response, dict) else None
|
| 68 |
+
if not isinstance(models, list) or len(models) != 1:
|
| 69 |
+
raise ValueError("server must expose exactly one model; specify --model explicitly")
|
| 70 |
+
model = models[0].get("id") if isinstance(models[0], dict) else None
|
| 71 |
+
if not isinstance(model, str) or not model.strip():
|
| 72 |
+
raise ValueError("server returned an invalid model ID; specify --model explicitly")
|
| 73 |
+
return model
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def main() -> int:
|
| 77 |
+
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 78 |
+
ap.add_argument("prompt", help="short prompt, any language")
|
| 79 |
+
ap.add_argument("--url", default="http://127.0.0.1:30000", help="server base URL")
|
| 80 |
+
ap.add_argument("--model", default=None, help="served model name (default: the server's only model)")
|
| 81 |
+
ap.add_argument("--timeout", type=float, default=1200)
|
| 82 |
+
ap.add_argument("--save-response", type=Path, default=None, help="also write the raw chat response here")
|
| 83 |
+
ap.add_argument("--dry-run", action="store_true", help="print the request without network access; requires --model")
|
| 84 |
+
ap.add_argument("--api-key-env", default="OPENAI_API_KEY", help="optional environment variable holding a bearer token")
|
| 85 |
+
args = ap.parse_args()
|
| 86 |
+
|
| 87 |
+
if args.dry_run:
|
| 88 |
+
if not args.model:
|
| 89 |
+
ap.error("--dry-run requires --model")
|
| 90 |
+
print(json.dumps(build_request(args.prompt, args.model), ensure_ascii=False, indent=2))
|
| 91 |
+
return 0
|
| 92 |
+
base = args.url.rstrip("/")
|
| 93 |
+
if not base.endswith("/v1"):
|
| 94 |
+
base += "/v1"
|
| 95 |
+
headers = {"Content-Type": "application/json"}
|
| 96 |
+
api_key = os.environ.get(args.api_key_env)
|
| 97 |
+
if api_key:
|
| 98 |
+
headers["Authorization"] = f"Bearer {api_key}"
|
| 99 |
+
model = args.model
|
| 100 |
+
if model is None:
|
| 101 |
+
request = urllib.request.Request(f"{base}/models", headers=headers)
|
| 102 |
+
with urllib.request.urlopen(request, timeout=args.timeout) as r:
|
| 103 |
+
model = select_model(json.load(r))
|
| 104 |
+
body = build_request(args.prompt, model)
|
| 105 |
+
req = urllib.request.Request(f"{base}/chat/completions", data=json.dumps(body).encode(),
|
| 106 |
+
headers=headers)
|
| 107 |
+
with urllib.request.urlopen(req, timeout=args.timeout) as r:
|
| 108 |
+
response = json.load(r)
|
| 109 |
+
if args.save_response:
|
| 110 |
+
args.save_response.write_text(json.dumps(response, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
| 111 |
+
ratios = body["response_format"]["json_schema"]["schema"]["properties"]["aspect_ratio"]["enum"]
|
| 112 |
+
print(json.dumps(parse_response(response, ratios), ensure_ascii=False, indent=2))
|
| 113 |
+
return 0
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
if __name__ == "__main__":
|
| 117 |
+
sys.exit(main())
|
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,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 |
+
"model_max_length": 262144,
|
| 13 |
+
"model_specific_special_tokens": {
|
| 14 |
+
"audio_bos_token": "<|audio_start|>",
|
| 15 |
+
"audio_eos_token": "<|audio_end|>",
|
| 16 |
+
"audio_token": "<|audio_pad|>",
|
| 17 |
+
"image_token": "<|image_pad|>",
|
| 18 |
+
"video_token": "<|video_pad|>",
|
| 19 |
+
"vision_bos_token": "<|vision_start|>",
|
| 20 |
+
"vision_eos_token": "<|vision_end|>"
|
| 21 |
+
},
|
| 22 |
+
"pad_token": "<|endoftext|>",
|
| 23 |
+
"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+",
|
| 24 |
+
"processor_class": "Qwen3VLProcessor",
|
| 25 |
+
"split_special_tokens": false,
|
| 26 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 27 |
+
"unk_token": null,
|
| 28 |
+
"video_token": "<|video_pad|>",
|
| 29 |
+
"vision_bos_token": "<|vision_start|>",
|
| 30 |
+
"vision_eos_token": "<|vision_end|>"
|
| 31 |
+
}
|