Using Hugging Face Models in Google Colab

Download open-weight Hugging Face models into Colab correctly: list repo files before downloading, budget disk and VRAM, verify weights, and put files in the layout tools like ComfyUI expect.

September 24, 2026
google-colabhugging-facemodelscomfyuigguf

Open-weight models on Hugging Face are what make a Colab GPU worth renting. The downloads are large, the repos hold far more files than any single run needs, and the runtime disk is temporary. This page is the model-agnostic core of doing it well; the walkthroughs that follow apply it to two real models.

Never download blind

A model repo is a directory tree on a CDN. The diffusion model, its text encoder, and its VAE are usually separate files, and the workflow you plan to run names specific ones. Before downloading anything, list the repo's actual file tree from the Hub API:

import urllib.request, json

d = json.load(urllib.request.urlopen(
    "https://huggingface.co/api/models/Comfy-Org/MiniMax-H3"))
for s in d["siblings"]:
    print(s["rfilename"])

Then read the workflow or template you intend to run and note exactly which filenames it expects — loaders reference files by name, and a mismatch is an error later. On model repos measured in hundreds of gigabytes, "scope-download" is the difference between a working run and a full disk.

Budget disk and VRAM before you commit

Three separate capacities decide whether a model can run:

  • Disk for the download: !df -h / on the runtime. Colab runtimes give you roughly 100–230 GB depending on the machine.
  • VRAM for the model at inference: !nvidia-smi. Quantized formats cut both needs — a Q4 GGUF can be a fraction of the bf16 original.
  • System RAM for offloading and text encoders: shown in the toolbar tooltip after connecting.

Many repos offer tiers — full precision, bf16, int8/NVFP4 quants, GGUF variants. Prefer the tier your workflow template was calibrated for; add higher-quality tiers only after the first run works.

Download with resumable, verifiable transfers

wget -c resumes interrupted downloads instead of restarting them — on a runtime that can disconnect at any time, this is not optional:

!wget -c "https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors" \
  -O /content/ComfyUI/models/diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors

Verify after downloading:

import os
p = "/content/ComfyUI/models/diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors"
if os.path.exists(p):
    print("OK ", f"{os.path.getsize(p)/1e9:.2f} GB")
else:
    print("MISS", p)

Compare the size against what the repo page reports. A truncated download that "succeeds" will fail later, usually with a confusing safetensors error.

Put files where the tool expects them

ComfyUI, the tool our walkthroughs use, wants a fixed directory layout under its install:

DirectoryWhat goes there
models/diffusion_models/The diffusion model (single-file safetensors, GGUF)
models/text_encoders/Text encoders (T5, Qwen VL, CLIP pair, ...)
models/vae/The VAE, when it ships separately
models/loras/LoRA adapters (including speed "turbo" LoRAs)
models/checkpoints/All-in-one checkpoints (MODEL + CLIP + VAE in one)
models/embeddings/Style and textual inversion embeddings

Downloaded-and-verified is not done until the tool shows the file: ComfyUI refreshes its loader dropdowns after a restart, and a node that lists no files is pointing at the wrong directory or a mismatched name.

Persistence and mirrors

  • Colab wipes /content every session. Either re-download on each run (fast on Colab's bandwidth — a 15 GB stack takes a few minutes) or copy to a mounted Drive folder and symlink. The Working in Colab guide covers the mount.
  • Prefer official repos. Community mirrors can vanish or be replaced; if a URL 404s, search huggingface.co/models?search=<name> and re-pin your URLs.
  • Some models are gated. License acceptance or an approved application may be required before download; Colab VMs live in the US, which matters for region-restricted licenses. Read the license on anything you would be embarrassed to have downloaded without checking.
  • Anything not on Hugging Face (some community models only exist on Civitai) needs an account and API token in the download URL. Keep tokens out of shared notebooks.

Apply it