Load Phi
Put a 3.8B language model inside your ComfyUI graph
- phi_model
- phi_tokenizer
This is the node you reach for when you want an actual language model running in your graph, not just a text-encoder that makes embeddings. Load Phi spins up Microsoft's Phi-3.5-mini-instruct - a 3.8B-parameter chat model - and hands you a ready-to-run model plus its tokenizer. The obvious use is what most people actually do with Phi in ComfyUI: prompt generation and rewriting. Wire its output into the right place and you've got a node that takes your rough idea ("a cyberpunk bakery, moody lighting, close-up") and hands back a polished prompt you can feed a checkpoint. No API, no key, no cloud call - it's all running on your GPU.
The name is honest, which is rarer than it should be: this node only loads. Generation happens in its sibling, Run Phi. Think of the Load/Run pair as a ComfyUI-flavored version of "model + sampler" - load once, keep it in memory, run as many generations as you like without re-reading weights.
How it works
Peek at the source and it's a straight HuggingFace load. The node resolves your ComfyUI/models/microsoft/ folder, builds the path to the model directory, and calls AutoModelForCausalLM.from_pretrained with device_map="cuda", torch_dtype="auto", and trust_remote_code=True. The tokenizer comes from AutoTokenizer. Everything is local_files_only=True - a detail that matters more than it looks like it should, because it means there is no auto-download. If the model folder isn't there, the node fails, and the failure message will not hold your hand.
Inputs and outputs
Only one input you can set:
- model - a dropdown that lists exactly one choice,
Phi-3.5-mini-instruct. It's an enum with a single entry, so don't go looking for a model-list scan like other loaders give you.
The node emits two outputs:
- phi_model - the loaded model object.
- phi_tokenizer - its tokenizer.
Both feed into Run Phi and nothing else; these are custom types (phi_model, phi_tokenizer) that only this pack understands.
Installing it
Install the pack either way you like:
# Option A: ComfyUI Manager → search "Phi" → install
# Option B: manual
cd ComfyUI/custom_nodes
git clone https://github.com/alexisrolland/ComfyUI-Phi.git
../../(your python) -m pip install -r ComfyUI-Phi/requirements.txt
Then the part that trips people: download the model yourself into a folder that ComfyUI registers as microsoft:
cd ComfyUI/models/microsoft # create it if missing
git clone https://huggingface.co/microsoft/Phi-3.5-mini-instruct
The folder name must be exactly Phi-3.5-mini-instruct - the node builds the path from the enum, so a renamed folder breaks the load. The pack's requirements are light (accelerate, backoff, peft); notably transformers is not pinned anymore, so it borrows whatever ComfyUI already has - fine, but it's the classic no-isolation situation where another pack's upgrade can quietly break this one.
Where people get burned
- No auto-download.
local_files_only=Truemeans a missing folder = instant error. The README is explicit about manual download; ignore it and you'll stare at a red node. - VRAM. 3.8B params in fp16 is roughly 7–8GB of weights sitting in memory while you also try to hold a diffusion checkpoint. On a 12GB card this is a squeeze; it's one reason many people run Phi via GGUF/llama.cpp instead for text-only jobs. This pack is not a GGUF loader - it wants the full HuggingFace safetensors repo.
- CUDA or nothing.
device_map="cuda"means no CPU fallback; a machine without a usable GPU won't run this at all. trust_remote_code. The model loads custom modeling code from the repo. The pack's README recommends the forkedLexius/Phi-3.5-mini-instructbecause the originals have known issues - worth knowing before you pull the plainmicrosoftrepo and hit a weird generation bug downstream.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | Phi-3.5-mini-instruct | The name of the model to load. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| phi_model | phi_model | — |
| phi_tokenizer | phi_tokenizer | — |