Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ComfyUI-SeFiImage

ComfyUI custom nodes for SeFi-Image — a Semantic-First Diffusion text-to-image model family from Liu et al. (released July 2026). SeFi separates the latent into a semantic stream and a texture stream and denoises semantic structure slightly ahead of texture detail, giving the texture stream a cleaner structural anchor. The result is strong prompt following, text rendering and bilingual generation at a fraction of the usual training cost.

This pack wraps SeFi's official sefi inference package as two ComfyUI nodes so you can generate directly on the graph.


Features

  • Two simple nodes: a Loader and a Sampler — wire Loader → Sampler → SaveImage.
  • Supports every published checkpoint: 1B / 2B / 5B in Base, RL and Turbo flavours.
  • Weights download automatically from Hugging Face on first use.
  • No manual setup of the upstream package: the pack fetches the sefi source itself (stdlib tarball download — no git required on the host) and adds it to sys.path on first use.
  • The loaded pipeline is cached across executions, so repeated generations don't reload the model.

Installation

Via ComfyUI-Manager (recommended)

Use Install via Git URL in ComfyUI-Manager with:

https://github.com/AMXELA-Official/ComfyUI-SeFiImage

Then restart ComfyUI.

Manual

cd ComfyUI/custom_nodes
git clone https://github.com/AMXELA-Official/ComfyUI-SeFiImage
cd ComfyUI-SeFiImage
pip install -r requirements.txt

Restart ComfyUI.

Dependencies

Installed from requirements.txt (most already ship with ComfyUI):

diffusers, transformers, accelerate, safetensors, huggingface_hub, omegaconf, pillow. PyTorch is provided by your ComfyUI install.

The upstream sefi package itself is not listed here because it is not pip-installable (it ships no packaging metadata). The pack downloads its source automatically — see How the sefi source is fetched.


Nodes

SeFi-Image Loader

Loads a SeFi inference pipeline. On first use it downloads the selected checkpoint from Hugging Face into SeFi's cache (outputs/model_weights/sefi_inference).

Input Type Notes
checkpoint choice HF checkpoint id (see Models).
dtype choice auto (let SeFi decide) / bfloat16 / float16 / float32.
device choice auto / cuda / cpu.
Output Type
sefi_pipe SEFI_PIPE

SeFi-Image Sampler

Generates one image from a text prompt.

Input Type Default Notes
sefi_pipe SEFI_PIPE From the Loader.
prompt string Text prompt (multiline).
steps int 4 ~4 for Turbo; raise (e.g. 20–30) for Base/RL.
guidance_scale float 1.0 ~1.0 for Turbo; higher for Base/RL.
width int 1024
height int 1024
seed int 0
Output Type
IMAGE standard ComfyUI image (feed to SaveImage/PreviewImage).

SeFi's inference API does not expose a negative prompt or batch-per-prompt, so those widgets are intentionally absent.


Models

Checkpoints are published under the SeFi-Image Hugging Face organization:

Family Sizes HF id pattern Suggested steps / guidance
Turbo 1B, 2B, 5B SeFi-Image/SeFi-Image-{1,2,5}B-turbo ~4 steps, guidance 1.0
Base 1B, 2B, 5B SeFi-Image/SeFi-Image-{1,2,5}B-Base ~20–30 steps, higher guidance
RL 5B SeFi-Image/SeFi-Image-5B-RL as Base

Recommended starting point: SeFi-Image-2B-turbo — fast and a good quality / VRAM balance.

VRAM

The upstream pipeline has no CPU-offload / low-VRAM path. Rough guidance:

Model Approx. VRAM (1024²)
1B comfortable on 8–12 GB
2B fits ~12 GB
5B likely OOM on 12 GB; needs more headroom

If you OOM, drop to a smaller variant or reduce width/height.


Usage

  1. Add SeFi-Image Loader, pick SeFi-Image/SeFi-Image-2B-turbo, leave dtype/device on auto.
  2. Add SeFi-Image Sampler, connect sefi_pipe, type a prompt, keep steps=4, guidance_scale=1.0.
  3. Connect the Sampler's IMAGE output to a SaveImage (or PreviewImage).
  4. Queue. The first run downloads the checkpoint (several GB) — subsequent runs reuse the cached model.

How the sefi source is fetched

sefi is MIT-licensed but not published as a pip package. On first node execution (and, best-effort, at install time via install.py) the pack:

  1. Downloads https://codeload.github.com/jmliu206/SeFi-Image/tar.gz/refs/heads/main using Python's standard library (urllib + tarfile) — no git binary needed.
  2. Extracts it to SeFi-Image/ inside this pack directory.
  3. Adds that directory to sys.path so import sefi works.

This is done lazily so a network hiccup can never block ComfyUI startup — it simply retries on the next run. The fetched SeFi-Image/ folder is gitignored.


Troubleshooting

  • ModuleNotFoundError: sefi — the source fetch failed (no network on first run). Re-queue once you have connectivity, or manually git clone the SeFi repo into this pack's SeFi-Image/ subfolder.
  • CUDA out of memory — use a smaller checkpoint (2B or 1B), lower the resolution, or free VRAM before running.
  • Slow first run — expected: it's downloading multi-GB weights from Hugging Face. Later runs are fast.
  • Wrong-looking output on Base/RL — raise steps and guidance_scale; the defaults are tuned for Turbo.

Credits & License

  • Wrapper (this repo): MIT.
  • SeFi-Image model & sefi inference package: © the SeFi-Image authors (jmliu206/SeFi-Image), MIT. All model weights and inference logic belong to them; this repo only adds a thin ComfyUI node layer.

If you use SeFi-Image in your work, please cite the original authors.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages