🏖️Phi3mini 4k ModelLoader
Zero knobs, one big download, and the only door into this pack
- Phi3mini_4k
- tokenizer
This is the rare ComfyUI node with literally nothing to set: no inputs, no sliders, no model dropdown. What it does instead is the part that surprises people. On first run it phones home to Hugging Face and downloads a ~3.8-billion-parameter language model onto your machine, then loads it onto your GPU.
It's the loader for ZHO-ZHO-ZHO's Phi-3-mini pack, which ports Microsoft's Phi-3-mini-4k-instruct into the graph so you can run a local LLM as a prompt writer. It's the only node in the pack that touches the network; the other two (🏖️Phi3mini 4k and 🏖️Phi3mini 4k Chat) just generate text from whatever this hands them.
How it works
Under the hood it's effectively three lines of transformers:
model = AutoModelForCausalLM.from_pretrained(
"microsoft/Phi-3-mini-4k-instruct",
device_map="cuda", torch_dtype="auto", trust_remote_code=True)
Three things worth knowing about that. First, from_pretrained downloads the weights into your Hugging Face cache the first time you run it - hence the "keep your network connection open" note in the README. Second, device_map="cuda" is hardcoded. There is no CPU fallback and no auto-detect: if you don't have a working CUDA GPU you'll get a runtime error, not a gentle warning. Third, trust_remote_code=True is why Phi-3 loads at all - it ships custom modeling code, and some older transformers builds choke on that.
Inputs and outputs
There are no inputs, which is exactly the point. The outputs are two pack-private custom types:
- Phi3mini_4k (type
PHI3) - wires into themodelinput on either generate node. - tokenizer (type
TK) - wires into thetokenizerinput.
Because those types are defined inside this pack, the model can only be loaded by this loader and only consumed by this pack's nodes. You can't swap in a generic transformers loader, and a standard CheckpointLoaderSimple won't touch it. That's the classic Zho wrapper pattern - self-contained and zero-friction inside the pack, locked in the moment you step outside. Longtime Comfy users have griped about exactly this style across his packs; here it's mostly harmless because the pack is only three nodes and the loader genuinely does need to be this way to produce both objects.
Installing it
Same install for all three nodes in the pack. Easiest via ComfyUI Manager: search "Phi-3-mini" and install. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ZHO-ZHO-ZHO/ComfyUI-Phi-3-mini
cd ComfyUI-Phi-3-mini
pip install -r requirements.txt
# restart ComfyUI
The only hard dependency is transformers>=4.40.0. If yours is older, the README's fix is blunt:
pip uninstall -y transformers
pip install git+https://github.com/huggingface/transformers
Common issues
- First run downloads several gigabytes with no progress bar in the ComfyUI UI. Nothing looks broken - watch the console log, and don't yank the network cable.
- CUDA required. No GPU → the loader fails before the other nodes ever run.
- Stale transformers. You'll usually see a tokenizer or
trust_remote_codeerror that looks unrelated; the README upgrade above is the fix. - Load a saved workflow on a new machine and ComfyUI says the loader is missing - check that this pack is actually installed, not just that the model cache carried over.
The model itself is MIT-licensed and open for commercial use, so this is one of the few "auto-download on first run" nodes you don't need to feel cagey about. Just be ready for the download and the GPU requirement, and the loader does its one job quietly.
Inputs (0)
No inputs
Outputs (2)
| Name | Type | Description |
|---|---|---|
| Phi3mini_4k | PHI3 | — |
| tokenizer | TK | — |