界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

image-generation

image-generation

【效率与协作】Guides Janus and Janus-Pro text-to-image generation, classifier-free guidance, and image decoding workflows.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: image-generation description: "Guides Janus and Janus-Pro text-to-image generation, classifier-free guidance, and image decoding workflows." disable-model-invocation: true metadata: disco-role: operating license: NOASSERTION

Image Generation

Use this sub-skill when the task is about Janus or Janus-Pro text-to-image generation, classifier-free guidance, output image saving, or adapting the repo's generation scripts.

Read first

For installation and model-family selection, use the root ../../references/installation-and-models.md.

When to use this route

Choose this route when the user asks to:

  • Generate images from text with Janus or Janus-Pro.
  • Adapt the classifier-free guidance loop or image decode logic.
  • Change seeds, batch size, output directory, image size, or patch size.
  • Debug pad_id, past_key_values, or token/image shapes in generation.
  • Save one or more generated samples from a prompt.

Core workflow

  1. Choose Janus or Janus-Pro and the matching model id.
  2. Apply the SFT template to a user/assistant conversation.
  3. Append vl_chat_processor.image_start_tag to the prompt.
  4. Encode the prompt to token ids.
  5. Duplicate the batch for CFG and mask the unconditional branch.
  6. Run the token loop, alternating language-model forward passes and prepare_gen_img_embeds.
  7. Decode tokens with gen_vision_model.decode_code.
  8. Convert the decoded tensor into image files.

Dry-run before model execution

Validate the prompt and generation parameters without downloading weights:

python sub-skills/image-generation/scripts/janus_text_to_image.py \
  --family janus-pro \
  --model-id deepseek-ai/Janus-Pro-1B \
  --prompt "A glass of red wine on a reflective surface." \
  --output-dir ./generated_samples

The default mode prints a plan and does not download model weights. Add --run-model only when you are ready for the real generation run.

Route elsewhere

我的收藏