(Down)Load Moondream Model
The Moondream Model Loader That Downloads Itself
- model
If you've loaded a workflow with this pack and stared at a node called "(Down)Load Moondream Model," the name is doing exactly what it says - with the "Down" in parentheses because the loading is the downloading, at least the first time. This is the pack's model node: one dropdown, one output, and the first time you run it, it quietly goes out to Hugging Face and pulls down Moondream 2 for you. No separate trip to civitai, no "place the .safetensors in the right folder" dance. It just works, which puts it ahead of most custom node model loaders in this ecosystem.
Why it exists
Gaze detection lives on top of a vision-language model, and that model has to live somewhere. This node is the pack's answer to where: it loads Moondream 2 (the vikhyatk/moondream2 repo) using the transformers library and holds the loaded model as a single MOONDREAM_MODEL object that the other two nodes in the pack - Gaze Detection and Gaze Detection Video - consume. You can't do anything else with this pack until this node has run, so in any workflow you'll find it wired into both of them.
The reason there's a separate loader at all, rather than the detection nodes loading the model themselves, is ComfyUI graph hygiene: load the model once, pass the same loaded instance to every node that needs it, and never pay the memory cost of a second copy.
How it works
Under the hood it calls AutoModelForCausalLM.from_pretrained("vikhyatk/moondream2", trust_remote_code=True, ...). First run downloads the weights into ComfyUI/models/moondream/, which is also where it looks for them on every run after that. Moondream is a genuinely small, open-weights vision-language model - a couple of GB to download - so the first queue is the slow one, and the pack's author reports peak VRAM around 6GB. If your GPU doesn't have that headroom, keep reading, because you have an out.
The input that matters
There is exactly one input:
- device - a dropdown with
cudaorcpu.cudaloads the model onto your GPU, which is where you want it for anything but a one-off test.cpuis your escape hatch: the model runs entirely in RAM instead of VRAM, at the cost of being dramatically slower. On a 6GB card this can be the difference between the pack working and not working at all - worth knowing before you blame the detection nodes.
The output
- model - the
MOONDREAM_MODELobject. Wire it into themodelinput ofGaze DetectionorGaze Detection Video. There's nothing else to do with it; it's a handle, not an image.
How to install it
This node ships in the ComfyUI-Moondream-Gaze-Detection pack, so you install the pack:
- ComfyUI Manager - search "Moondream" (or the full pack title) and click install. Easiest path, and Manager will also warn you if the Python dependencies are missing.
- Manual - from
ComfyUI/custom_nodes/:
On the portable Windows build, the pip command becomesgit clone https://github.com/jhj0517/ComfyUI-Moondream-Gaze-Detection cd ComfyUI-Moondream-Gaze-Detection pip install -r requirements.txtpython_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\ComfyUI-Moondream-Gaze-Detection\requirements.txt. Restart ComfyUI either way, and the node appears under the "Moondream Gaze Detection" category.
The requirements pull in matplotlib, pyvips, accelerate, and opencv-python. That pyvips line is the one dependency with teeth: on Windows the node automatically downloads the native libvips DLLs it needs (a known pyvips packaging pain, issue #489 on the libvips tracker), but on Linux you may need to install system libvips yourself (apt install libvips or your distro's equivalent) before the loader will even import. If your first run dies with a pyvips import error, that's what's happening - it's not your model, it's the DLL.
When you hit the wall
The two failure modes people actually meet: the first run takes forever (model download plus a several-second load - this is normal, not a hang), and the loader errors out on pyvips (see above). Beyond that, this is about as low-friction as a custom node loader gets. Just don't set device to cpu and then complain the whole pack is slow - it will be, and it's doing what you told it to.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| device | COMBO | 2 options: cuda, cpu |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | MOONDREAM_MODEL | — |