Hugging Face, End to EndLesson 33 of 75

Contents

Hugging Face, End to End

Lesson 33 of 75. Sign in to keep your place.

Module 4 · Spaces: putting something in front of people

Hardware, sleep, and the bill that runs while you are asleep

9 min read

What a tier costs if nothing stops itFree CPU basic, whichsleeps by itself0ZeroGPU, a GPU attachedper function call0A small paid CPU upgrade22An entry-level GPU atabout a dollar an hour720US dollars for a month left runningRates move and these are orders of magnitude rather than quotes. The shape does not move: paidhardware bills wall-clock time and does not sleep unless you set the timer first, so a Space servingthree visitors a day costs exactly what one serving three thousand costs.
Rates move and these are orders of magnitude rather than quotes. The shape does not move: paid hardware bills wall-clock time and does not sleep unless you set the timer first, so a Space serving three visitors a day costs exactly what one serving three thousand costs.

Figure

The shape of the pricing

Free CPU hardware is free permanently and sleeps when idle. Every upgrade past it bills per hour of wall-clock time the Space is running, not per request and not per unit of compute. A Space serving three visitors a day on a paid GPU costs exactly what one serving three thousand costs, because the meter is time.

This is the single most expensive misunderstanding on the platform. People upgrade to test something, close the tab, and find a bill weeks later. Approximate rates change, so check the current figures before committing, but the order of magnitude is worth carrying: a small paid CPU upgrade is a few US cents an hour, an entry-level GPU in the region of a dollar an hour, and a large-memory GPU several dollars an hour. A dollar an hour is about 720 dollars a month if nothing stops it.

Set the sleep timer before you upgrade

In Settings there is a sleep time: after this many minutes of no traffic, the Space stops and billing stops. The order matters:

  1. Set the sleep timer.
  2. Then change the hardware.

Doing it the other way leaves a window, and windows become weekends. Free CPU Spaces sleep on their own schedule; paid hardware does not sleep unless you tell it to. That asymmetry is where the surprise bills come from.

Waking from sleep costs a cold start: container start, dependency layer restore, model download if the cache was cleared, model load. Ten seconds for a small ONNX model, two or three minutes for a large one. If the wait is unacceptable, the answer is either persistent storage so the weights are already there, or paying for uptime, and those are the only two answers.

ZeroGPU: the interesting option

ZeroGPU allocates GPU time per function call rather than reserving a machine. You mark the functions that need a GPU:

Python
import spaces

@spaces.GPU(duration=60)
def generate(prompt):
    return pipe(prompt).images[0]

Between calls, no GPU is held. The Space itself runs on CPU; when generate is invoked, a slice of an A100-class GPU is attached for up to duration seconds, then released.

What this buys: a free public demo that uses a GPU, which is otherwise impossible. What it costs:

  • Gradio only, and the decorator has to be applied to the right functions.
  • A per-call ceiling. Set duration honestly: asking for 120 seconds when you need 20 wastes quota, and asking for 20 when you need 60 gets your call killed mid-generation.
  • Cold attachment. There is overhead on each allocation, so many tiny GPU calls are worse than one batched call.
  • A quota, larger for paying accounts, and shared across the platform at busy times.

It is the right choice for image generation, speech and mid-sized chat demos that are used in bursts. It is the wrong choice for a Space serving steady production traffic, where a dedicated endpoint is both faster and more predictable.

Choosing, in one pass

  • Embeddings, classifiers, ONNX, small Whisper → free CPU. Permanently.
  • Image generation, larger chat, a public demo with a GPU → ZeroGPU.
  • Steady traffic with a latency promise → paid hardware with a sleep timer, or a dedicated endpoint.
  • A private tool for yourself → free CPU and tolerate the cold start, or run it on your own machine.

Three habits that keep the bill honest

  1. Check your Spaces list monthly. A forgotten upgraded Space is the classic way to spend money on nothing.
  2. Set a spending limit in billing settings if your account supports one, rather than relying on memory.
  3. Develop locally, deploy once. Every debugging cycle on paid hardware is a cycle billed for a bug.

The position on free

Hugging Face gives away a lot: unlimited public repositories, permanent free CPU Spaces, ZeroGPU quota, and a large amount of bandwidth. That generosity is real and it is also a commercial strategy, funded by enterprise customers and paid compute. It could change. Nothing in this lesson is a promise about 2028, and any project whose viability depends on a free tier staying free should be able to move, which, since everything here is git repositories and open formats, it can.

Do this now

Open the settings of any Space you own and look at the sleep time. If it says never and the hardware is not free, change one of the two right now, before finishing this lesson.

Every lesson here is open. Your progress is recorded once you pass the Image Generation, in Practice exam.

Check your understanding

A Space upgraded to a GPU serves about twenty requests a day. The owner is surprised by the size of the monthly bill. What is the mechanism?

Pick the one you would defend. Your answer stays private.

Next lesson · 8 minThe filesystem disappears, and what to do about it

Stuck on something?Ask Arjun, your AI tutor

How to cite: Addaly (2026) ‘Hardware, sleep, and the bill that runs while you are asleep’, in Hugging Face, End to End. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/hugging-face/hardware-sleep-and-zerogpu (Accessed: 13 October 2026).