f18ae1e1c6c6841c6a9e02fc909c8fac1fd219ce
ComfyUI LongCat Plugin
Overview
ComfyUI nodes wrapping LongCat image generation and editing pipelines (diffusers-based). Includes text-to-image and multi-image edit flows with prompt rewriting, aspect-aware sizing, and latent decoding for ComfyUI.
Features
- LongCatCheckpointLoader: Loads the LongCat model components (Model, CLIP, VAE).
- TextEncodeLongCatImage / TextEncodeLongCatImageEdit: Encodes text prompts and reference images (for editing) into conditioning.
- VAEEncodeLongCat / VAEDecodeLongCat: Encodes images to latents and decodes latents to images using the LongCat VAE.
- LongCatSampler: Handles the sampling process (denoising) using the LongCat transformer.
- LongCatImageSizeScale: Scales images to a target pixel area and rounds dimensions to multiples of 16.
Installation
- Copy Folder: Copy the
comfyui_longcatfolder into your ComfyUIcustom_nodesdirectory.- Example:
ComfyUI/custom_nodes/comfyui_longcat
- Example:
- Install Dependencies: Ensure your ComfyUI environment has the required packages:
(Note:
pip install -r requirements.txtrequirements.txtis in the root of this repo, or checksetup.pyfor list). - Model Weights: Place LongCat model weights in a directory accessible to ComfyUI.
Usage in ComfyUI
- Put this plugin folder into ComfyUI
custom_nodes, then restart. - Nodes appear under category
longcat. - Workflow:
- Load model with
LongCatCheckpointLoader. - Connect
CLIPtoTextEncodeLongCatImage(T2I) orTextEncodeLongCatImageEdit(Edit). - Connect
VAEtoVAEEncodeLongCat(if using image input) andVAEDecodeLongCat. - Connect
MODEL,CONDITIONING(Positive/Negative), andLATENTtoLongCatSampler.
- Load model with
- Set
model_pathto your downloaded LongCat checkpoint; on CUDA you may enablecpu_offloadto save VRAM.
Development
- Tests:
pytest tests/test_nodes.py - Key modules:
nodes.py,longcat_image/pipelines/*,longcat_image/models/longcat_image_dit.py.
To-Do
- Add robust fallback when prompt rewriting model lacks
generate. - Guard
LongCatImageEditPipelineforimage=Nonemisuse. - Expand docs with example ComfyUI workflows and screenshots.
- Provide sample model download script and config guidance.
- Add more automated tests (pipeline smoke tests, dtype/device matrix).
Credits
- LongCat base model & pipelines: original LongCat project (LongCat team).
- diffusers (Hugging Face) for pipeline scaffolding.
- transformers (Hugging Face) for text and vision encoders.
- accelerate for optional CPU/GPU offload helpers.
- PyTorch for core tensor and model runtime.
- Pillow (PIL) and NumPy for image/tensor conversions.
- OpenAI / DeepSeek API usage scaffold in
misc/prompt_rewrite_api.py.
Languages
Python
99.3%
Shell
0.7%