Run this model with HF Jobs

Run heheyas/Qwen-Image-SP on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/heheyas/Qwen-Image-SP. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/heheyas/Qwen-Image-SP on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Qwen-Image-SP / README.md
nielsr's picture
nielsr HF Staff
Add links to paper, project page, and code repository
dcd37f9 verified
|
Raw History Blame
1.57 kB
metadata
base_model: Qwen/Qwen-Image
library_name: diffusers
license: apache-2.0
pipeline_tag: text-to-image
tags:
  - text-to-image
  - diffusion
  - structured-prompt
  - context-scaling

Qwen-Image-SP

This model is described in the paper Scaling Properties of Text Conditioning in Visual Generation.

QwenImage DiT + text-encoder fine-tuned on Structured-Prompt data (context-scaling project). EMA weights, bf16, 55 GB total.

Sharded across 14 safetensors files (each ~4.5 GB, well under HF LFS per-file limits):

  • dit_model-*.safetensors (10 shards) → transformer state dict
  • text_encoder-*.safetensors (4 shards) → Qwen2.5-VL text-encoder

Module prefix already stripped inside each shard, so:

import torch, glob
from safetensors.torch import load_file
from diffusers import QwenImagePipeline
from huggingface_hub import hf_hub_download, snapshot_download

pipe = QwenImagePipeline.from_pretrained("Qwen/Qwen-Image", torch_dtype=torch.bfloat16)
local = snapshot_download("heheyas/Qwen-Image-SP")

for shard in sorted(glob.glob(f"{local}/dit_model-*.safetensors")):
    pipe.transformer.load_state_dict(load_file(shard), strict=False)
for shard in sorted(glob.glob(f"{local}/text_encoder-*.safetensors")):
    pipe.text_encoder.load_state_dict(load_file(shard), strict=False)

VAE, tokenizer, scheduler are inherited from Qwen/Qwen-Image at load time and not shipped here.