Extensions/DiffusionGemma Prompt Builder
ComfyUI Extension

DiffusionGemma Prompt Builder

Five-node DiffusionGemma Director Assistant bridge for ComfyUI LTX workflows.

By exportAnything·Created about a month ago·Updated about a month ago· 43
exportAnything/ComfyUI-DiffusionGemmaPromptBuilder
Nodes5
On cloudLocal install
Categoryprompt/diffusiongemma
Stars43
Updatedabout a month ago
Readme
<p align="center"> <img src="examples/assets/character_motion_transfer/diffusiongemma_ltx_character_demo.gif" alt="DiffusionGemma and LTX 2.3 character motion transfer demo" width="720"> </p>

ComfyUI DiffusionGemma Prompt Builder

Five DiffusionGemma Director Assistant nodes for ComfyUI workflows that use DiffusionGemma as a multimodal prompt writer, not as the image or video sampler.

This release is packaged around the working LTX 2.3 character motion-transfer workflow in examples/07_ltx23_character_motion_transfer.json.

Exported Nodes

Only the nodes used by the packaged workflow are registered in ComfyUI:

  • DiffusionGemmaModelLoader - loads the local Transformers/NVFP4 DiffusionGemma runtime.
  • DiffusionGemmaContextHub - combines user text, optional image/video inputs, and optional visual_description into one DG_CONTEXT.
  • DiffusionGemmaTargetProfile - stores target generation settings such as LTX profile, audio mode, duration, aspect ratio, and negative prompt policy.
  • DiffusionGemmaCoTGenerator - asks DiffusionGemma for the final prompt packet and returns final JSON plus debug outputs.
  • DiffusionGemmaJSONSplitter - turns the final JSON into LTX prompt, negative prompt, metadata, resolution, segment, and readiness outputs.

Older compatibility and utility classes remain in source where the final nodes still reuse helper behavior internally, but they are not exported as ComfyUI nodes in this package.

Packaged Workflow

The release workflow is:

examples/07_ltx23_character_motion_transfer.json

It uses a reference image for character identity and a source video for pose, motion, camera choreography, depth, Canny/edge structure, composition, timing, and scene geometry. It includes Canny, Depth, and DWPose control branches for comparison.

Bundled media lives in:

examples/assets/character_motion_transfer

Before running the workflow, copy that folder to:

ComfyUI/input/character_motion_transfer

The workflow expects these input paths:

character_motion_transfer/character_reference.png
character_motion_transfer/motion_control_video.mp4

The demo output is also included:

examples/assets/character_motion_transfer/diffusiongemma_ltx_character_demo.mp4
examples/assets/character_motion_transfer/diffusiongemma_ltx_character_demo.gif

Recommended Wiring

For custom workflows, the core DiffusionGemma path is:

Text String -> DiffusionGemma Context Hub
Image or Video -> DiffusionGemma Context Hub
DiffusionGemma Target Profile -> DiffusionGemma CoT Generator
DiffusionGemma Model Loader (Advanced) -> DiffusionGemma CoT Generator
DiffusionGemma Context Hub -> DiffusionGemma CoT Generator
DiffusionGemma CoT Generator.final_json -> DiffusionGemma JSON Splitter
DiffusionGemma JSON Splitter.ltx_prompt -> LTX positive prompt input
DiffusionGemma JSON Splitter.negative_prompt -> LTX negative prompt input
DiffusionGemma JSON Splitter.ready_for_generation -> generation gate or manual check

Use image_identity_video_control on the Context Hub when the reference image should define the output subject while the video provides motion, pose, camera, depth, Canny/edge layout, blocking, and timing.

Runtime Dependencies

This pack assumes a working ComfyUI install with CUDA-capable PyTorch. The Python dependencies declared in requirements.txt are:

  • transformers>=5.12.1
  • accelerate>=1.14.0
  • comfy-kitchen>=0.2.10
  • jsonschema>=4.26.0
  • safetensors>=0.7.0
  • tqdm>=4.67.0

The NVFP4 bridge also depends on ComfyUI exposing comfy.quant_ops and comfy.ops. On this workstation, comfy-kitchen==0.2.10 is installed and the proof gate passes.

The local bridge does not require bundling a custom tensor file. It converts the ModelOpt NVFP4 tensors from the Hugging Face checkpoint at runtime: ModelOpt FP4 nibble order and weight_scale layout are adapted into Comfy's packed NVFP4 expert matmul layout. Keep the model weights as a normal Hugging Face repo folder and ship only the node source code.

Models Used By The Example

DiffusionGemma prompt model:

Place the whole repo folder at:

ComfyUI/models/LLM/diffusiongemma-26B-A4B-it-NVFP4

LTX 2.3 diffusion model:

Place in:

ComfyUI/models/unet

LTX IC-LoRAs:

Place in:

ComfyUI/models/loras

VAEs:

Place in:

ComfyUI/models/vae

Text encoders:

Place in:

ComfyUI/models/text_encoders

Latent upscaler:

Place in:

ComfyUI/models/latent_upscale_models

Custom Node Dependencies For The Example

Install missing packs through ComfyUI Manager when possible:

  • ComfyUI-LTXVideo
  • comfyui-videohelpersuite
  • comfyui-kjnodes
  • comfyui_controlnet_aux
  • comfyui_essentials
  • comfyui-easy-use
  • RES4LYF

Core ComfyUI supplies several additional LTX nodes used by the workflow, including video loaders, LTX preprocessing/conditioning, samplers, latent/audio/video split and concat nodes, and latent upscaler loading.

Proof Gate

The pack imports without loading DiffusionGemma. Before using the real NVFP4 backend, run:

C:\ComfyUI\.venv\Scripts\python.exe custom_nodes\ComfyUI-DiffusionGemmaPromptBuilder\proof_gates.py --model-path C:\ComfyUI\models\LLM\diffusiongemma-26B-A4B-it-NVFP4

A good NVFP4 result reports:

  • AutoProcessor resolves.
  • DiffusionGemmaForBlockDiffusion imports from Transformers.
  • CUDA is available.
  • comfy_nvfp4_bridge_supported is true.
  • The NVFP4 bridge smoke test passes.

Packaging Notes

pyproject.toml is included for GitHub and Comfy Registry readiness. The Comfy Registry requires a real publisher id; if exportAnything is not the exact Registry publisher id, update [tool.comfy].PublisherId before publishing.

The current GitHub repository URL in metadata is:

https://github.com/exportAnything/ComfyUI-DiffusionGemmaPromptBuilder

License

MIT License. See LICENSE.