HF Transformers load pipeline
Run an LLM inside ComfyUI without leaving the graph
- HFT_PIPELINE
Half of this pack is for diffusers pipelines; this node is the other half's front door. It loads a HuggingFace Transformers pipeline - an LLM or VLM - so you can run a language model as a step in your ComfyUI graph. The flagship example is prompt enhancement: an LLM takes your one-line prompt, expands it into a detailed paragraph, and that text feeds your text-to-image model. Same node serves image captioning, classification, anything transformers.pipeline() can do.
Inputs:
- task - the pipeline task, default
text-to-text. This is the string you'd passtransformers.pipeline(), and it does the heavy lifting of picking the right pipeline class. - pipeline_class - optional, and this is the pack's trademark move: leave it blank to let the task auto-select, or type a class name from the
transformersnamespace to force a specific one. Most people leave it blank. - model - the repo id, default
HuggingFaceH4/zephyr-7b-beta(a small instruction-tuned chat model, which tells you the intended audience: prompt-enhancement, not trillion-parameter frontier models). The example workflow usesQwen/Qwen3-VL-2B-Instruct. - device -
default/auto/cpu(+ CUDA options). - dtype -
defaultthroughbitsandbytes_4bit. For LLMs this is the knob that matters; a 4-bit 7B model is a very different beast from its fp16 self. - model_kwargs - a JSON text box for model-level arguments that aren't pipeline-level - the example passes
{"attn_implementation": "flash_attention_2"}here. - kwargs - JSON for everything else.
Output is one HFT_PIPELINE, which feeds HFTRunPipeline. That's the whole contract.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Yahweasel/ComfyUI-HF-Diffusers
or install ComfyUI-HF-Diffusers via ComfyUI Manager, then restart. requirements.txt pins diffusers~=0.36.0; the Transformers side relies on ComfyUI's bundled transformers, and for brand-new model architectures the author notes you may need the git version. Upgrading transformers in a ComfyUI install is a classic dependency-hell trigger - other packs pin versions, and a too-new transformers can break them in turn. Worth doing in a venv or accepting the risk.
The honest take
This is a genuinely useful node and also a genuinely niche one: most ComfyUI users who want LLM prompt enhancement use a dedicated pack or an API call instead. What this offers over both is that it stays local, stays generic, and never leaves the graph - no API key, no external service, the whole thing runs on your card. The trade is the usual local-LLM one: a 7B model is slower than an API call and eats VRAM you might rather give the diffusion model. If you have the memory, it's the cleanest way to build an LLM step into a workflow, and it plays perfectly with HFTCreateConversation on the front and HFTUnpackConversation on the back.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| task | STRING | text-to-text | — |
| pipeline_class | STRING | — | |
| model | STRING | HuggingFaceH4/zephyr-7b-beta | — |
| device | COMBO | 3 options: default, auto, cpu | |
| dtype | COMBO | 6 options: default, float32, bfloat16, float16, bitsandbytes_8bit, bitsandbytes_4bit | |
| model_kwargs | STRING | — | |
| kwargs | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| HFT_PIPELINE | HFT_PIPELINE | — |