Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
260ae4a
add diffusers serve and generate commands
DN6 Oct 9, 2026
3e4aa57
add remote serve
DN6 Oct 9, 2026
5bc3948
update
DN6 Oct 9, 2026
fc92295
update
DN6 Oct 9, 2026
c964faf
Merge remote-tracking branch 'origin/main' into diffusers-serve
DN6 Oct 14, 2026
c8967b0
Address serve review feedback and run serve --remote on HF Jobs
DN6 Nov 3, 2026
a5781d1
Add context-parallel serving and allow --compile with --context-parallel
DN6 Nov 4, 2026
a60093d
Restore --compile with --context-parallel guard
DN6 Nov 4, 2026
3df7581
clean up
DN6 Nov 4, 2026
b81768c
Remove the SGLang and vLLM-Omni serve backends and clean up the serve…
DN6 Nov 4, 2026
a7e8ea0
Reorganize serve modules and validate manifests at startup
DN6 Nov 4, 2026
ccdcc36
Flatten serve response formatting into _format_job_response and _form…
DN6 Nov 5, 2026
2fd5dcb
Derive serve fps and sample rate from the model and merge parallel.py…
DN6 Nov 5, 2026
8e8f6c3
Seed request seeds from the global RNG and build job responses inside…
DN6 Nov 5, 2026
c746c03
Resolve outputs, fps and adapter weights in the manifest so the backe…
DN6 Nov 5, 2026
7179858
Address review: validate adapter repo ids, add --generation-timeout
DN6 Nov 5, 2026
8830305
Wait on the event loop, time out by deadline, and drop low-value serv…
DN6 Nov 5, 2026
29ad358
Simplify serve: inline single-use helpers, drop 501 stubs, shorten docs
DN6 Nov 5, 2026
57c1686
Merge branch 'main' into diffusers-serve
DN6 Nov 5, 2026
e66798c
Remove ParallelBackend
DN6 Nov 17, 2026
196fb0f
Harden serve media inputs, support modular step callbacks, and simpli…
DN6 Nov 18, 2026
aa2a41c
Drop fraction from progress events
DN6 Nov 18, 2026
52f2be3
Clean up
DN6 Nov 18, 2026
7ef87c6
Add Generative Media Spec docs (#15323)
apolinario Nov 24, 2026
c592639
Address review comments
DN6 Nov 24, 2026
89bc8a2
Accept model positionally in run and serve
DN6 Nov 24, 2026
7ab2cdf
Address review comments
DN6 Nov 24, 2026
8b14b0b
Merge branch 'main' into diffusers-serve
sayakpaul Nov 30, 2026
3ee9fd4
Use `insert_step_callback` for modular step progress
DN6 Dec 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ai/skills/diffusers-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description: >
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `run` | Run any `DiffusionPipeline` or `ModularPipeline`. Forwards `--pipeline-kwargs` verbatim, saves output by detecting its runtime type, optionally runs on HF Jobs via `--remote`. |
| `schema` | Print the input schema for a pipeline repo (kwarg names, types, defaults, descriptions). **No weights downloaded** — only the small index file. |
| `serve` | Serve a pipeline over HTTP with the Generative Media Spec API: model discovery, queued generations, polling or SSE progress. |
| `custom_blocks` | Package a local `ModularPipelineBlocks` subclass for the Hub. |
| `env` | Print versions of diffusers + torch + transformers + accelerate + safetensors + CUDA + GPU info. Use when investigating environment issues, dtype/precision support, or building bug reports. |

Expand All @@ -33,6 +34,7 @@ The other commands are small enough that `diffusers-cli <command> --help` is the

```bash
diffusers-cli schema --help
diffusers-cli serve --help
diffusers-cli custom_blocks --help
diffusers-cli env --help
```
Expand Down
4 changes: 4 additions & 0 deletions docs/source/en/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
title: Quickstart
- local: using-diffusers/cli
title: Command line interface
- local: using-diffusers/serve
title: Serving
- local: using-diffusers/gms
title: Generative Media Spec
title: Get started
- isExpanded: true
sections:
Expand Down
18 changes: 17 additions & 1 deletion docs/source/en/using-diffusers/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ specific language governing permissions and limitations under the License.

# Command line interface

`diffusers-cli` is a command line client for running, inspecting, and packaging Diffusers pipelines.
`diffusers-cli` is a command line client for running, inspecting, and packaging Diffusers pipelines. It is also

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The remote worker doesn’t inherit the local PR revision. Running the PR’s CLI locally with --remote launched a stock worker whose installed Diffusers release lacked serve. Maybe we should clarify this?

installed as `diffusers`, so `diffusers serve` and `diffusers-cli serve` are the same command.

## Available commands

Expand All @@ -21,6 +22,7 @@ specific language governing permissions and limitations under the License.
| [`env`](#env) | Print environment info for bug reports. |
| [`schema`](#schema) | Inspect a pipeline's `__call__` signature without downloading weights. |
| [`run`](#run) | Run a pipeline locally or in a Hugging Face Sandbox. |
| [`serve`](#serve) | Serve a pipeline over HTTP with the [Generative Media Spec](./gms) API. |
| [`custom_blocks`](#customblocks) | Package a local `ModularPipelineBlocks` subclass for the Hub. |
| [`fp16_safetensors`](#fp16safetensors) | Convert a checkpoint to fp16 `.safetensors`. |
| [`skills`](#skills) | Install pre-authored skill bundles into your AI coding agent. |
Expand Down Expand Up @@ -287,6 +289,20 @@ diffusers-cli run -m black-forest-labs/FLUX.1-dev --dtype bf16 \
hf sandbox kill <id>
```

## `serve`

Serve a pipeline over HTTP with the [Generative Media Spec](./gms) API. See [Serving](./serve) for the full guide.

```bash
pip install "diffusers[serve]"
diffusers-cli serve black-forest-labs/FLUX.2-klein-4B
```

```text
url=http://127.0.0.1:8000 model=black-forest-labs/FLUX.2-klein-4B pipeline_class=Flux2KleinPipeline tasks=['text_to_image', 'image_to_image'] ...
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```

## `custom_blocks`

Package a local `ModularPipelineBlocks` subclass for upload to the Hub. Reads a Python file, AST-scans it for
Expand Down
71 changes: 71 additions & 0 deletions docs/source/en/using-diffusers/gms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!--Copyright 2026 The HuggingFace Team. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->

# Generative Media Spec

The [Generative Media Spec](https://github.com/huggingface/gms-alpha) (GMS) is an open HTTP API for serving image,
video, and audio generation models. Any GMS client works with any GMS server, and a model exposes the same interface
everywhere it is hosted. [`diffusers serve`](./serve) is a GMS server.

> [!TIP]
> GMS is in alpha. The full specification, the [OpenAPI definition](https://github.com/huggingface/gms-alpha/blob/main/openapi.yaml)
> and the [manifest JSON Schema](https://github.com/huggingface/gms-alpha/blob/main/schemas/manifest.schema.json)
> live in the [GMS repository](https://github.com/huggingface/gms-alpha). Feedback is welcome there.

Every request follows one loop:

1. **Discover.** `GET /v1/models/{id}` returns the model's manifest: its tasks, inputs, outputs, parameters and
presets, plus what the server supports.
2. **Generate.** `POST /v1/generations` creates a generation from a model, its `inputs` and its `parameters`.
3. **Follow along.** A generation goes from `queued` to `generating` to `complete`. Poll it, or subscribe to
`GET /v1/generations/{id}/events` for progress and previews.
4. **Read the results.** The completed generation lists its named outputs, the seed that was used, and the model
revision that ran.

## Manifests

A manifest is the machine-readable description of one model. Clients render interfaces and validate requests from it,
so a new model works in an existing client without client changes.

Each task declares its inputs and parameters in flat, typed maps, and the names are model-specific. `serve` uses the
pipeline's own argument names, except for a few common ones:

| Manifest name | Pipeline argument |
|---|---|
| `steps` | `num_inference_steps` |
| `seed` | `generator` |
| `num_outputs` | `num_images_per_prompt`, `num_videos_per_prompt`, `num_waveforms_per_prompt` |
| `fps` | `frame_rate` |
| `mask` (input) | `mask_image` |

The manifest travels with the model: canonically, a `gms.json` file in the model repository. A server SHOULD serve a
published manifest as is, so the same model reads the same on every host. `serve` loads it automatically, and falls
back to a manifest derived from the pipeline's `__call__` signature when the repository has none.

## Publishing a manifest

A derived manifest has types and defaults, but no ranges or presets. Write a `gms.json` to add them, and test it
locally before uploading:

```bash
diffusers serve black-forest-labs/FLUX.2-klein-4B --manifest gms.json
```

`serve` checks the manifest against the pipeline at startup and refuses to start if it declares something the
pipeline can't do. Once it loads, upload it to the root of the model repository:

```bash
hf upload black-forest-labs/FLUX.2-klein-4B gms.json gms.json
```

See the [example manifests](https://github.com/huggingface/gms-alpha/tree/main/manifests) for FLUX.2, LTX 2.5 and
ACE-Step 1.5.
Loading
Loading