AMS.

Why my 15 GB AI model download kept failing near the end

5 min listen

Cover: Container ship arriving port by Unknown, CC0 1.0.

Background

Once ComfyUI was installed, the real hurdle was the models. One image-to-video template needs six files, one of them 20 GB and another 15 GB. ComfyUI in the browser has a Download button, but there were three problems:

  • Files land in the Downloads folder, not ComfyUI's models folder, so you have to know where each one goes.
  • "Download all" only downloaded the first file.
  • The 15 GB one ran almost to the end and then said "File wasn't available on site".

What I tried

  • Switching to Brave: it's Chromium like Chrome, with exactly the same download behaviour. No help.
  • Reading Chrome's own download record: the failure was SERVER_FORBIDDEN from Hugging Face's CDN, on a signed link with a time limit. The link had expired and the browser was refused when it tried to resume with it.
  • Hugging Face's official hf tool: it gets a fresh link with your sign-in on every reconnect. The 15 GB file finished in one go.
  • The new xet download method or classic HTTP: I stopped each one by force after 20 seconds. Xet kept nothing; HTTP kept what it had downloaded and resumed from there. Speed was about the same, so HTTP it is.

How it works

1. A helper that watches Downloads

Every ComfyUI workflow lists the models it needs, each with a file name and a folder (for example vae or text_encoders). The helper reads that list from the built-in templates and saved workflows, looks at Downloads every 5 seconds, and moves a file when its name matches exactly and its size has stopped changing. Anything it doesn't recognise is left alone, and it never overwrites or deletes.

for name in listdir(downloads):         # every 5 s: move finished downloads a workflow lists
    folder = index.get(name)            # e.g. "vae", learned from workflow JSON
    if folder and size_is_stable(name):  # partial downloads have temporary names anyway
        move(name, models / folder / name)

Each look at the folder is so quick that the helper barely uses any CPU.

2. A "download missing models" option

Save the workflow in ComfyUI with Control and S, choose option 8 in the tool and pick the workflow by number. No model names to type. It lists the missing files, their sizes, where they go and whether there's enough disk space, then downloads them one by one with a progress bar. Close the window, lose the connection or shut down, and choosing it again continues from where it stopped.

Save the workflowList the missingmodelsCheck sizes anddisk spaceDownload with afresh linkMove into the rightfolder
How a missing model gets downloaded

3. Sign in to Hugging Face at the start

Most models live on Hugging Face and need a token. The first install step asks for a Fine-grained, Read-Only token, checks straight away which account it belongs to, and warns if it can also write. The token is saved where Hugging Face's own tools look for it, never in an environment variable or a log.

Things that bit me

  • "Download all" downloads one file: Chrome blocks several downloads at once from one site until you allow "Automatic downloads" for it in the address bar.
  • Models with a lock icon: each model repository needs you to click agree on its page once, and no tool can do that for you. The first version only flashed this message on screen; now it's repeated at the very end under "Needs your action", with an offer to open the page.
  • My resume test was wrong at first: on Windows the Python in a virtual environment is only a launcher. I stopped it, but the child process doing the download kept going in the background. Stopping the whole process tree made the test honest.
  • File sizes can lie: for a file still being written, Windows can keep showing 0 bytes in the folder. To watch progress, look at how much the process has written instead.

What improved

The 15 GB model that kept failing in the browser now finishes in one go. If the computer shuts down halfway, the download continues where it stopped instead of starting from zero. Each model goes straight into the right folder rather than sitting in Downloads, and a model that needs a licence is listed at the end with its page opened for you, instead of a confusing error.

Comments