Nodes/ComfyUI-YogurtSa2VA/Yogurt Sa2VA Model Loader
ComfyUI Node

Yogurt Sa2VA Model Loader

Load your segmentation model once — this node is why the pack exists

By yogurt7771·Created 4 months ago·Updated 4 months ago· 0
Yogurt Sa2VA Model Loader
    • sa2va_model
    model_nameByteDance/Sa2VA-Qwen3-VL-4B
    use_8bittrue
    use_flash_attntrue
    force_reloadfalse

    Every workflow using this pack starts here. Yogurt Sa2VA Model Loader loads ByteDance's Sa2VA - the vision-language model fine-tuned on SAM2 outputs that lets you describe what to segment in plain English - once, caches it, and hands you a reusable model object instead of reloading a multi-GB model every time a segmentation node runs.

    That last part is the entire reason this pack exists. The upstream alexjx/ComfyUI-Sa2VA-XJ loaded Sa2VA inside each segmentation node, so every node in your graph paid the full load cost. This fork splits loading out: one loader, one load, N downstream nodes. If you're running a Sa2VA-XJ workflow where three segmentation nodes each hit the disk, switching to this pack is the upgrade.

    How it works

    The loader builds a YogurtSa2VAModel bundle - model + processor + an inference lock - and caches it in a dict keyed by (model_name, use_8bit, use_flash_attn). Same config, same model object back. The underlying torch module is wrapped and registered with ComfyUI's model_management, so when some other node needs VRAM, ComfyUI can offload Sa2VA and drag it back before your segmentation node runs. No manual unloading.

    Two memory paths, worth knowing:

    • 8-bit (use_8bit, default on): needs bitsandbytes. The model can't reliably do .to("cpu"), so on VRAM pressure it's deleted and reloaded on demand. Frees the most memory; costs a reload every time something else wants the GPU.
    • fp16/bf16: whole-model CPU/GPU offload. Reloads are faster, but a 4B model is still 4B - it eats more VRAM.

    Inputs that matter

    • model_name - seven candidates in the dropdown, default ByteDance/Sa2VA-Qwen3-VL-4B. That default is the community darling (the Qwen3-VL-4B rev is what made Sa2VA mainstream in late 2025). Sa2VA-Qwen2_5-VL-7B or InternVL3-8B/14B if you want more capacity and have the VRAM; kumuji/Sa2VA-i-1B if you're on a potato.
    • use_8bit - on by default, and it's a good default on 8GB cards. Turn it off if you'd rather eat VRAM than eat reload latency.
    • use_flash_attn - on by default but graceful: if flash-attn isn't installed, it just logs and continues. You don't need it; it just makes generation faster when present.
    • force_reload - discards the cache for this config and reloads. For after you swap model files.

    Output is a single sa2va_model (YOGURT_SA2VA_MODEL), which feeds Yogurt Sa2VA Image Segmentation, ... Video Segmentation, and ... V2.

    Install

    Whole-pack install - one clone gets you all five nodes:

    cd ComfyUI\custom_nodes
    git clone https://github.com/yogurt7771/ComfyUI-YogurtSa2VA
    cd ComfyUI-YogurtSa2VA
    python -m pip install -r requirements.txt
    

    requirements.txt is minimal: transformers>=4.57.0, torch, qwen_vl_utils, pillow, numpy. Optional extras per the README:

    python -m pip install bitsandbytes      # for use_8bit
    python -m pip install flash-attn --no-build-isolation   # for use_flash_attn
    

    Models go in ComfyUI/models/sa2va as plain folders containing config.json - use huggingface-cli download --local-dir rather than dumping HF cache. If nothing's there, transformers pulls it from Hugging Face on first run.

    Gotchas

    • 8-bit load failure: bitsandbytes missing. Install it or flip use_8bit off.
    • Dropdown empty after copying models: wrong directory structure or no config.json, then not restarted. Check both.
    • First run is slow, embarrassingly so: the 4B model download plus load is a multi-GB affair. That's why you cache it once and reuse - and it's exactly what this node is for.

    If you only ever segment one image in a whole session, a loader feels like ceremony. The moment you run two nodes, or a video, it's the difference between a snappy workflow and watching models load in a queue.

    CategoryYogurtSa2VA

    Inputs (4)

    NameTypeDefaultDescription
    model_nameCOMBOByteDance/Sa2VA-Qwen3-VL-4B7 options: kumuji/Sa2VA-i-1B, ByteDance/Sa2VA-Qwen3-VL-4B, ByteDance/Sa2VA-InternVL3-2B, ByteDance/Sa2VA-Qwen2_5-VL-3B, ByteDance/Sa2VA-Qwen2_5-VL-7B, ByteDance/Sa2VA-InternVL3-8B, +1
    use_8bitBOOLEANtrueUse 8-bit quantization to reduce memory usage (requires bitsandbytes).
    use_flash_attnBOOLEANtrueUse flash attention for faster processing (requires flash-attn).
    force_reloadBOOLEANfalseUnload and recreate the cached model for this model/quantization/attention configuration.

    Outputs (1)

    NameTypeDescription
    sa2va_modelYOGURT_SA2VA_MODEL