All posts
Artificial IntelligenceComfyUITutorials

Uncensored Gemma 4 in ComfyUI: An Ollama Workflow Guide

Connect a community uncensored Gemma 4 vision model to ComfyUI through Ollama, turn reference images into prompts, and send them to Z-Image-Turbo.

By PixelAiLabs · 7/20/2026

Uncensored Gemma 4 in ComfyUI: An Ollama Workflow Guide

The uncensored Gemma 4 in ComfyUI workflow shown in the video uses Ollama as a local multimodal model server. A ComfyUI custom node sends a reference image and prompt to the community-published fredrezones55/Gemma-4-Uncensored-HauhauCS-Aggressive:e4b model, then passes the returned description into Z-Image-Turbo for image generation.

This is not an official Google model release or a guarantee that every request will be accepted. It is a community-modified Gemma 4 package whose author describes it as aggressively uncensored. The workflow is useful when you want a local vision model to convert an image into a structured generation prompt and apply text-directed changes.

Important: An uncensored model removes safeguards you may otherwise rely on. Review its outputs, avoid processing images you do not have permission to use, and do not treat the model author's refusal claims as independently verified benchmarks.

Table of contents

What you'll learn

By the end of this guide, you will know how to:

  • install the comfyui-ollama custom nodes;
  • download the exact Ollama model tag used by the supplied workflow;
  • connect Ollama to ComfyUI at its local API address;
  • send a reference image through the Gemma 4 vision model;
  • route the generated description into Z-Image-Turbo;
  • use keep_alive to release the language model after a response; and
  • diagnose the most likely missing-node, missing-model, and connection errors.

This is an intermediate workflow guide. It assumes you can open and import a ComfyUI workflow, use ComfyUI's node manager, and place model files in the correct folders.

Requirements

You need:

  • a current local installation of ComfyUI;
  • the comfyui-ollama custom-node package by Stav Sapir;
  • a running Ollama installation;
  • enough system memory or GPU memory for the Ollama model and your image-generation model;
  • the supplied workflow JSON;
  • the three Z-Image-Turbo files listed below; and
  • a reference image you are permitted to process.

The demonstrated Ollama e4b tag is listed as a 6.3 GB Q4_K_M package on its Ollama page. Actual memory use can exceed the download size and varies with runtime settings, context, hardware, and whether other models are loaded.

Required Z-Image-Turbo files

The workflow's embedded download metadata points to the Comfy-Org Z-Image-Turbo repository:

FileComfyUI folderPurpose
qwen_3_4b.safetensorsComfyUI/models/text_encoders/Text encoder
z_image_turbo_bf16.safetensorsComfyUI/models/diffusion_models/Diffusion model
ae.safetensorsComfyUI/models/vae/VAE

The supplied JSON contains an older internal VAE label, zimage-ae.safetensors, while its embedded download note and the video show ae.safetensors. If the imported workflow reports a missing VAE, select the downloaded ae.safetensors manually.

How the workflow works

The workflow has two linked stages:

  1. Image-to-prompt: Load Image sends a reference image to Ollama Chat. The included system prompt tells the model to describe the image, preserve elements that the user has not asked to change, and return one plain paragraph suitable for an image generator.
  2. Prompt-to-image: The Ollama text output feeds the positive prompt input of a Z-Image-Turbo subgraph. Z-Image-Turbo then generates a new image from that description.

This distinction matters: Gemma 4 does not edit the pixels directly. It interprets the reference and writes text. Z-Image-Turbo generates a new image from that text, so identity, fine texture, text, pose, and composition can drift.

Install the uncensored Gemma 4 ComfyUI workflow

1. Update ComfyUI and install comfyui-ollama

Open ComfyUI's extension manager and search for comfyui-ollama by Stav Sapir. Install it, then restart ComfyUI.

The comfyui-ollama repository also documents a manual installation route, but the manager is the simplest option for this workflow. If the manager shows multiple Ollama packages, verify the author rather than choosing only by name.

2. Install Ollama

Download Ollama from the official Ollama download page for Windows, macOS, or Linux. Start Ollama before loading the ComfyUI workflow. The custom nodes require an Ollama server that is reachable from the machine running ComfyUI.

3. Download the exact model tag

Run the command shown in the video and confirmed by the supplied workflow:

ollama run fredrezones55/Gemma-4-Uncensored-HauhauCS-Aggressive:e4b

This selects the e4b Ollama tag rather than the unqualified latest tag. At the time of verification, the Ollama model page identifies the package as Q4_K_M and 6.3 GB.

Source note: The underlying model is published by HauhauCS on Hugging Face and packaged for Ollama by fredrezones55. Claims such as “won't refuse prompts” come from those community model pages; PixelAiLabs has not independently reproduced the model author's refusal test.

4. Import the workflow JSON

Drag OLLAMA_GEMMA4_UNCESORED_ZIT_ComfyUI workflow.json onto the ComfyUI canvas or use ComfyUI's workflow-open command.

If ComfyUI flags missing nodes, confirm that comfyui-ollama is installed and restart the application. The workflow also includes visual label nodes from rgthree, but the Ollama and Z-Image processing path is the important part.

5. Add the Z-Image-Turbo files

Download the three files listed in the requirements table from the Comfy-Org Z-Image-Turbo repository and place each one in its matching model directory. Restart or refresh ComfyUI after adding them.

Do not rename the files unless you also update the loader selections in the workflow.

6. Configure Ollama Connectivity

In the Ollama Connectivity node, set:

  • URL: http://127.0.0.1:11434
  • Model: fredrezones55/Gemma-4-Uncensored-HauhauCS-Aggressive:e4b

The loopback address works when Ollama and ComfyUI run on the same machine. A remote Ollama server requires a different address and its own network configuration; that setup is outside the video.

7. Set keep_alive for memory management

The video recommends setting keep_alive to 0 when VRAM is limited. Ollama's official FAQ confirms that API value 0 unloads a model immediately after it generates a response.

This can free memory before Z-Image-Turbo runs, but the next Ollama request will need to load the model again. Use a longer keep-alive value when repeated prompt generation matters more than releasing memory between runs.

8. Load a reference and queue the workflow

Choose a reference image in the Load Image node. Leave the user prompt empty for a descriptive first pass, or request one targeted change, such as:

Preserve the character but change her hair to long and dark.

Queue the workflow and inspect the text preview before relying on the generated image. If the description omits an important detail, state that detail explicitly in the user prompt and run the Ollama stage again.

Important settings

Ollama settings

SettingValue used or suppliedWhat it affects
Server URLhttp://127.0.0.1:11434Connection to the local Ollama API
Model tag...Aggressive:e4bSelects the demonstrated community model package
QuantizationQ4_K_MReduces model size relative to higher-precision variants
keep_alive0 recommended in the narrationUnloads the Ollama model after the response
Temperature1 on the model pageSampling variability
top_k64 on the model pageCandidate-token sampling limit
top_p0.95 on the model pageNucleus-sampling threshold

The workflow's Ollama Options node contains many optional controls, but they are disabled unless explicitly enabled. Start with the model defaults before changing sampling parameters.

Z-Image-Turbo settings

The video shows 832×1024 with 8 steps during the demonstration. The supplied workflow JSON stores 848×1216 with 9 steps inside its Z-Image-Turbo subgraph. These are different saved states, not a universal requirement.

The supplied JSON also records:

  • CFG: 1
  • sampler: res_multistep
  • scheduler: simple
  • ModelSamplingAuraFlow shift: 3
  • seed behavior: randomize after generation

Use the values loaded from the supplied workflow as the reproducible starting point, then change dimensions to match your output format. Changing resolution and steps affects speed and memory use and may change the result.

Use a reference image effectively

The included system prompt asks the vision model to inventory the face, hair, body type, clothing, pose, framing, environment, lighting, color, objects, and visible text. It then merges those observations with the requested change.

For more predictable results:

  1. Request one change at a time. “Make this a mirror selfie” is easier to reconcile than a long list of scene, wardrobe, pose, and identity changes.
  2. Inspect the generated description. The text preview shows what Z-Image-Turbo will actually receive.
  3. Restate critical attributes. If the model misses the shot type, clothing item, or background, add it to the user prompt.
  4. Expect identity drift. The video itself notes that the generated face differs from the reference because no character LoRA or other identity-conditioning method is used.
  5. Treat visible text cautiously. The system prompt requests verbatim transcription, but vision models can misread source text and image generators can render it incorrectly.

Troubleshooting

ComfyUI reports missing Ollama nodes

Confirm that you installed comfyui-ollama by Stav Sapir and restarted ComfyUI. The supplied workflow records custom-node version 2.1.0, but a current compatible release may be newer.

The Ollama node cannot connect

Check that Ollama is running and that the Connectivity node uses http://127.0.0.1:11434. If Ollama runs in Docker, on another computer, or under a restricted firewall configuration, the loopback address may not reach it.

The model does not appear in the node

Run the exact ollama run command once and allow the download to complete. Reconnect the Ollama Connectivity node or restart ComfyUI so it refreshes the model list.

ComfyUI reports a missing Z-Image model

Verify both filename and folder:

  • text encoder in models/text_encoders/;
  • diffusion model in models/diffusion_models/; and
  • VAE in models/vae/.

If the workflow asks for zimage-ae.safetensors, manually choose ae.safetensors; the supplied JSON contains both names in different metadata fields.

Memory runs out before image generation

Set keep_alive to 0, generate the text, and confirm that Ollama unloads before the diffusion stage. If memory is still insufficient, reduce image dimensions or use a lower-memory Z-Image variant supported by the current official workflow. Do not assume that a smaller download guarantees a specific VRAM requirement.

The result does not match the reference

Read the Ollama text output first. If the description is wrong, revise the user prompt. If the description is accurate but the image still drifts, the limitation is in text-conditioned generation; use explicit identity or structure controls appropriate to your image model.

Limitations and trade-offs

  • “Uncensored” is not a quality metric. Reduced refusal behavior does not guarantee accurate image understanding, reliable instruction following, or safe output.
  • The refusal claims are self-reported. The model card states “0/465 Refusals” but also adds an asterisk about limited longer-context testing.
  • Reference preservation is approximate. The workflow converts an image into text and generates a new image; it is not pixel-preserving editing.
  • Local does not mean risk-free. Generated content still requires human review, appropriate consent, and compliance with the services and contexts in which it is used.
  • Unloading trades speed for memory. keep_alive: 0 releases the model after each response, so later requests can take longer.
  • Saved settings differ. The video and supplied JSON use different image dimensions and step counts.
  • Model metadata conflicts. The Ollama package page labels the e4b tag as 8B parameters, while the linked Hugging Face E4B card says 4B parameters. Avoid making a parameter-count claim until the packager clarifies the discrepancy.

FAQ

Is this an official Google Gemma 4 model?

No. It is a community-modified model published by HauhauCS and packaged on Ollama by fredrezones55. It is based on a Gemma 4 model and uses the Gemma license listed on the Hugging Face page.

Does keep_alive: 0 permanently remove the model?

No. It unloads the model from memory after the response. The downloaded model remains available and can be loaded again on the next request.

Can the workflow copy a face exactly?

No exact-copy guarantee is demonstrated. The video explicitly shows some facial drift and explains that no character LoRA is in use.

Can I use another image generator?

Yes, in principle. The Ollama stage returns text, so you can route it to another compatible prompt input. Prompt format and results will vary by model; the supplied workflow is configured for Z-Image-Turbo.

Conclusion

This workflow places a local vision-language model between a reference image and Z-Image-Turbo. The main setup requirements are the correct comfyui-ollama package, the exact Ollama model tag, the three Z-Image-Turbo files, and a working local Ollama connection.

The most useful operational setting is keep_alive: 0 when the language model and diffusion model compete for memory. The main limitation is equally clear: the reference is translated into text before image generation, so inspect the intermediate description and expect some visual drift.

Workflow files & resources

Download the files used in this article and try the workflow yourself.

Continue learning

Explore more PixelAiLabs workflows and courses.

Browse courses