初始化项目,由ModelHub XC社区提供模型

Model: retowyss/PromptBridge-0.6b-Alpha
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-06-18 05:21:19 +08:00
commit 39e58a66c6
11 changed files with 151953 additions and 0 deletions

36
.gitattributes vendored Normal file
View File

@@ -0,0 +1,36 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
tokenizer.json filter=lfs diff=lfs merge=lfs -text

158
README.md Normal file
View File

@@ -0,0 +1,158 @@
---
language:
- en
license: apache-2.0
tags:
- text-generation
- prompt-engineering
- image-generation
- prompt-expansion
- prompt-compression
- prompt-enhancer
- qwen3
base_model:
- Qwen/Qwen3-0.6B
pipeline_tag: text-generation
---
# PromptBridge-0.6b-Alpha
A specialized Qwen3-0.6B model fine-tuned for bidirectional prompt transformation for text-to-image generation.
## Example (Round-Trip)
(Expand → Compress → Expand)
Original Short Prompt:
> woman, flowing red dress, standing, sunset beach
Step 1: Expand:
> A woman stands on a sandy beach at sunset, facing forward with a composed, neutral expression. Her fair skin shows a subtle, natural sheen from the warm light. She has a slender, athletic build and long, straight darkbrown hair that falls to the middle of her back, the strands catching faint highlights that suggest a soft, slightly wavy texture. Her face is symmetrical, with high cheekbones, a straight nose, full lips, and dark brown eyes that gaze directly ahead; the eyes are framed by welldefined, slightly arched eyebrows. A small, silver hoop earring rests in her left ear, and a thin, matteblack chain necklace rests against her collarbone. She wears a sleeveless red dress made of a lightweight, slightly textured fabric that drapes fluidly over her torso. The dress features a high, standup collar, a fitted waist that defines her silhouette, and a plunging neckline that reveals a hint of the collarbone. The fabric catches the sunset light with a faint satin luster, and the hem is finished with a subtle, rolled edge that adds a gentle ripple. A narrow, woven red belt with a small, polished stone accent the waist. Her left arm is bent at the elbow, the hand resting lightly on her hip, fingers relaxed. The right arm hangs straight down, the hand relaxed with the palm facing inward. She wears simple, lowprofile sandals made of dark, worn leather that blend into the sand, their soles slightly scuffed. A thin, silver bracelet encircles her left wrist, adding a discreet accent. The background stretches into a vast, flat expanse of lightbrown sand, its surface marked by fine ripples and gentle waves that catch the soft glow of the setting sun. In the distance, low dunes rise faintly against a sky that shifts from deep orange at the horizon to pale teal near the horizon, with a few scattered, wispy clouds catching the last rays of light. The overall lighting is warm and diffused, casting gentle shadows that emphasize the contours of her body and the folds of the dress, while the golden hue of the sunset enhances the reds and greens of her attire, creating a harmonious, tranquil atmosphere.
Step 2: Compress to Keywords:
> fair-skinned athletic woman, dark brown wavy hair, red sleeveless dress, standing on sand beach, sunset golden glow, left arm bent hand on hip, right arm relaxed palm inward, dark leather sandals, silver hoop earring necklace, thin matte black chain necklace, silver bracelet on wrist, large orange teal sky, gentle ripples and dunes, warm diffused lighting
Step 3: Expand Again:
> A woman stands on a sandy beach at sunset, her body angled slightly to the right while she faces the camera. Her dark brown hair is long, wavy, and falls past her shoulders, with a few strands framing her face and catching the warm light. She has fair skin, high cheekbones, full lips, and dark brown eyes that look directly at the viewer. A small, polished silver hoop earring glints in her left ear. She wears a red, formfitting sleeveless dress made of a smooth, slightly reflective fabric. The dress features a deep Vneckline, a subtle embossed geometric pattern on the shoulders, and a high slit on the left side that reveals a glimpse of her left thigh. The material has a faint sheen that catches the light, emphasizing the curve of her hips. On her left wrist she has a thin silver bracelet, and a delicate chain necklace with a tiny pendant rests against the dress. Her left arm is bent, the hand resting lightly on her hip; the right arm hangs relaxed at her side, the palm turned inward. She wears simple dark leather sandals with thin straps that match the dress, and small, matte black stud earrings. The beach beneath her is composed of fine, lighttan sand with subtle ripples that reflect the sunset glow. Behind her, the sky is a gradient of deep orange fading into teal, the sun low and bright, casting a warm, diffused light that creates a soft rim of illumination around her shoulders and a gentle shadow on the sand to her left. Small dunes rise faintly in the distance, adding texture to the horizon. The overall scene is bathed in warm, golden tones that highlight the colors of the dress and the earthy palette of the beach.
## Model Description
PromptBridge-0.6b-Alpha can perform two kinds of prompt transformations:
- **Prompt Expansion**: Converts brief keywords or a single sentences into detailed prompts suitable for image generation models.
- **Prompt Compression**: Distills lengthy image generation prompts into concise keywords or single sentences.
Which also allows it to generate variations by chaining these operations (expand → compress → re-expand).
**PromptBridge-0.6b-Alpha is trained exclusively on prompts that featuers a single, adult human(oid) subject.**
The model was trained on approximately 300k pairs of prompts (300M tokens).
The content rating distribution of the training data is as follows (rated by gpt-oss-120b):
- **PG**: 153680
- **PG-13**: 128890
- **R**: 8910
- **X**: 0 (80 X-rated prompts were removed from the training data.)
Therefore, the model may generate sensitive content - you are solely responsible for the output you generate.
The training data is 100% synthetic and was created by the following pipeline:
1. Randomly roll keywords
2. Generate image based on keywords
3. Caption Image using Qwen3-VL-32b-Instruct-FP8
4. Refine Caption with gpt-oss-120b
5. Create training pairs by reversing caption into keywords and one sentence descriptions
## Usage
The model requires one of three specific system prompts:
- `"Expand the prompt."`
- `"Compress the prompt into one sentence."`
- `"Compress the prompt into keyword format."`
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_name = "retowyss/PromptBridge-0.6b-Alpha"
model = AutoModelForCausalLM.from_pretrained(
model_name,
trust_remote_code=True,
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
# mode = "Compress the prompt into one sentence."
# mode = "Compress the prompt into keyword format."
mode = "Expand the prompt."
# Expansion example
messages = [
{"role": "system", "content": mode},
{"role": "user", "content": "woman, flowing red dress, standing, sunset beach"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.2,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(response)
```
Works with vllm.
```
vllm serve retowyss/PromptBridge-0.6b-Alpha
```
## Training Results
- **Initial Loss**: 2.95 (PPL: 19.08)
- **Final Loss**: 1.24 (PPL: 3.43)
- **Training Duration**: ~8.0 RTX 5090 hours
## Limitations
1. **Token Length**: May generate prompts exceeding typical token limits used by image models.
2. **Specialization**: Cannot perform general instruction-following tasks, reasoning, or chat functions.
3. **Domain**: Optimized for human subject descriptions; performance on other subjects is neither trained nor tested.
4. **Content**: Trained on PG to R-rated content; may not handle extreme content.
## Ethical Considerations
### Content Policy
- Training data filtered to remove explicit (X-rated) content
- Removed prompts containing minors (<20 years old) or brand references
- Retained R-rated content as it represents realistic artistic descriptions
```bibtex
@misc{promptbridge_0.6b_alpha},
author = {Wyss Reto},
title = {PromptBridge-0.6b-Alpha: Bidirectional Prompt Transformation for Image Generation},
year = {2026},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/retowyss/PromptBridge-0.6b-Alpha}}
}
```
## Model Card Contact
For questions or feedback, please open an issue on the model repository.

60
config.json Normal file
View File

@@ -0,0 +1,60 @@
{
"architectures": [
"Qwen3ForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"dtype": "bfloat16",
"eos_token_id": 151645,
"head_dim": 128,
"hidden_act": "silu",
"hidden_size": 1024,
"initializer_range": 0.02,
"intermediate_size": 3072,
"layer_types": [
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention"
],
"max_position_embeddings": 40960,
"max_window_layers": 28,
"model_type": "qwen3",
"num_attention_heads": 16,
"num_hidden_layers": 28,
"num_key_value_heads": 8,
"pad_token_id": 151643,
"rms_norm_eps": 1e-06,
"rope_scaling": null,
"rope_theta": 1000000,
"sliding_window": null,
"tie_word_embeddings": true,
"transformers_version": "4.57.6",
"use_cache": false,
"use_sliding_window": false,
"vocab_size": 151936
}

12
generation_config.json Normal file
View File

@@ -0,0 +1,12 @@
{
"do_sample": true,
"eos_token_id": [
151645,
151643
],
"pad_token_id": 151643,
"temperature": 0.6,
"top_k": 20,
"top_p": 0.95,
"transformers_version": "4.57.6"
}

151388
merges.txt Normal file

File diff suppressed because it is too large Load Diff

21
metadata.json Normal file
View File

@@ -0,0 +1,21 @@
{
"package_date": "2026-01-22T20:21:10.378026",
"base_model": "Qwen/Qwen3-0.6b",
"model_name": "PromptBridge-0.6b-Alpha",
"version": "alpha",
"checkpoint_source": "qwen3-prompt-model/checkpoint-17220",
"files_included": [
"model.safetensors",
"config.json",
"generation_config.json",
"tokenizer.json",
"tokenizer_config.json",
"vocab.json",
"merges.txt",
"special_tokens_map.json"
],
"dataset_info": {
"total_examples": 291480,
"training_hours": 8.0
}
}

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a5d7ba3664e2944212fb0c06378ed08abb99f05dae5b860ad0ea522a8083dc1a
size 1192135096

31
special_tokens_map.json Normal file
View File

@@ -0,0 +1,31 @@
{
"additional_special_tokens": [
"<|im_start|>",
"<|im_end|>",
"<|object_ref_start|>",
"<|object_ref_end|>",
"<|box_start|>",
"<|box_end|>",
"<|quad_start|>",
"<|quad_end|>",
"<|vision_start|>",
"<|vision_end|>",
"<|vision_pad|>",
"<|image_pad|>",
"<|video_pad|>"
],
"eos_token": {
"content": "<|im_end|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"pad_token": {
"content": "<|endoftext|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
}
}

BIN
tokenizer.json (Stored with Git LFS) Normal file

Binary file not shown.

240
tokenizer_config.json Normal file
View File

@@ -0,0 +1,240 @@
{
"add_bos_token": false,
"add_prefix_space": false,
"added_tokens_decoder": {
"151643": {
"content": "<|endoftext|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151644": {
"content": "<|im_start|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151645": {
"content": "<|im_end|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151646": {
"content": "<|object_ref_start|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151647": {
"content": "<|object_ref_end|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151648": {
"content": "<|box_start|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151649": {
"content": "<|box_end|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151650": {
"content": "<|quad_start|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151651": {
"content": "<|quad_end|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151652": {
"content": "<|vision_start|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151653": {
"content": "<|vision_end|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151654": {
"content": "<|vision_pad|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151655": {
"content": "<|image_pad|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151656": {
"content": "<|video_pad|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"151657": {
"content": "<tool_call>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151658": {
"content": "</tool_call>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151659": {
"content": "<|fim_prefix|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151660": {
"content": "<|fim_middle|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151661": {
"content": "<|fim_suffix|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151662": {
"content": "<|fim_pad|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151663": {
"content": "<|repo_name|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151664": {
"content": "<|file_sep|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151665": {
"content": "<tool_response>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151666": {
"content": "</tool_response>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151667": {
"content": "<think>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"151668": {
"content": "</think>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
}
},
"additional_special_tokens": [
"<|im_start|>",
"<|im_end|>",
"<|object_ref_start|>",
"<|object_ref_end|>",
"<|box_start|>",
"<|box_end|>",
"<|quad_start|>",
"<|quad_end|>",
"<|vision_start|>",
"<|vision_end|>",
"<|vision_pad|>",
"<|image_pad|>",
"<|video_pad|>"
],
"bos_token": null,
"clean_up_tokenization_spaces": false,
"eos_token": "<|im_end|>",
"errors": "replace",
"extra_special_tokens": {},
"model_max_length": 131072,
"pad_token": "<|endoftext|>",
"split_special_tokens": false,
"tokenizer_class": "Qwen2Tokenizer",
"unk_token": null,
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}"
}

1
vocab.json Normal file

File diff suppressed because one or more lines are too long