Griptape Util: Create Model from Modelfile
Turn that Modelfile into an actual Ollama model
- OUTPUT
- NEW_MODEL_NAME
This is the second half of the Griptape pack's "bake your agent into an Ollama model" pipeline. Where "Create Agent Modelfile" generates the recipe, this node executes it: give it a Modelfile string and a name, and it writes the Modelfile to disk and runs ollama create to build a real, usable custom model on your local Ollama server. After this node runs, you've got a new model listed in Ollama that behaves like the agent you built - no ComfyUI required to use it afterward.
That distinction is the whole point of the two-node flow, and it's worth stating plainly because it changes how you think about the pair. The first node is pure text generation - it can't build anything. This node is the one that actually shells out to Ollama and produces a model. You can also use this node standalone: any valid Modelfile string works, not just one from the sibling node. Want a custom model with a different system prompt, different parameters, a different base? Craft the Modelfile yourself (or in a text node), feed it in, and out comes a model.
How it works
The node takes your Modelfile text, parses the FROM line to learn the base model, writes the file to disk as Modelfile, then runs two Ollama commands: ollama cp <base_model> <new_name> to copy the base, then ollama create <new_name> -f Modelfile to build the customized model on top. The resulting model is named {new_model_name}-{base_model} - so "new_model" over "llama3" becomes new_model-llama3. Note the code drops any tag after a colon in the base name, so llama3:latest becomes llama3.
The inputs that matter
- modelfile - required, and it's a force-input string, meaning it must be connected from another node (like the Create Agent Modelfile node) rather than typed in. It must contain a valid
FROMline - that's how the node figures out the base. - new_model_name - default
new_model. The base for your custom model's name. Keep it short and descriptive; the final name gets the base model appended.
Two outputs: OUTPUT (STRING, the result of the ollama create call) and NEW_MODEL_NAME (STRING, the built model's full name - handy if you want to wire it back into a driver later).
Install
Same pack, same Ollama prerequisite:
cd ComfyUI/custom_nodes
git clone https://github.com/griptape-ai/ComfyUI-Griptape
or ComfyUI Manager → search "Griptape" → install → restart. And Ollama must be installed and running - this node literally invokes ollama commands, so it refuses to validate otherwise.
Where people get burned
The most common issue is connecting a Modelfile without a FROM line - the node returns nothing useful because it can't figure out the base. Make sure the first line of your Modelfile says FROM <model>. Second, Ollama has to be reachable; if you've moved it off localhost you'll need to make sure it's running, since this node uses Ollama's CLI directly. Finally, expect this node to do real work: ollama create on a big model isn't instant, and it consumes disk. If the OUTPUT comes back with an error, read it - it's Ollama's own message, and it'll tell you exactly what went wrong (missing base model, tag collision, etc.).
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| modelfile | STRING | — | |
| new_model_name | STRING | new_model | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| OUTPUT | STRING | — |
| NEW_MODEL_NAME | STRING | — |