Derive the GMS manifest from modular block declarations
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Domaine
- machine-learning
Piste de recherche
Start by reading the work in PR #15017 and the modular pipeline declarations, especially InputParam, _workflow_map, and save_pretrained(). The issue presents several design options and says the related PR is still WIP, so first check the current implementation and discussion for an agreed direction. Done means modular blocks can provide the manifest data and newly saved models include gms.json.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
#15017 adds diffusers serve, which describes a model with a manifest: its tasks, inputs, parameters and outputs.
Right now modular pipelines go through the same path as standard pipelines: the blocks are converted into a __call__-like signature, and the manifest is guessed from argument names and type hints. That makes sense for standard pipelines, where the signature is all we have. But modular blocks are declarative, and we shouldn't need to guess for our own pipelines. I think the blocks can state most of this directly. A few ideas to start with:
1. InputParam.metadata
InputParam already has a metadata dict (Mellon uses it). It could carry what the manifest needs:
- the public name (
num_inference_steps→steps) - the kind: text, image, video, audio, mask, or a plain setting
- whether it's user-facing at all (
latents,timestepsare not)
2. Tasks from workflows
Tasks are guessed from whether there's an image / video input, so a model gets at most two. Blocks already declare their workflows and trigger inputs in _workflow_map. One task per workflow would also cover workflows triggered by other inputs, e.g. references in MiniMax-H3.
3. Require type_hint on user-facing inputs
A parameter's schema comes from its type hint (int → integer, list[float] → array of numbers). An input without one can't be described and is dropped today. We could require a type_hint on every InputParam that's exposed, and check it in the tests.
4. Reuse it in save_pretrained()
If the manifest comes from the blocks alone, the same function can run in save_pretrained() and write a gms.json next to modular_model_index.json. serve already picks up a gms.json from the model repo, so new models would ship with their manifest.
What the code could look like
A made-up sketch to show the idea, not tested. The "gms" key and its fields are placeholders.
# in a block
InputParam("num_inference_steps", type_hint=int, default=28, metadata={"gms": {"name": "steps"}})
InputParam("image", type_hint=PIL.Image.Image, metadata={"gms": {"type": "image"}})
InputParam("latents", type_hint=torch.Tensor) # no metadata, not exposed
def derive_manifest(model_id, blocks):
tasks = {}
for workflow, triggers in blocks._workflow_map.items():
# the blocks that run for this workflow, so only its own inputs are listed
workflow_blocks = blocks.get_workflow(workflow)
inputs, parameters = {}, {}
for param in workflow_blocks.inputs:
gms = (param.metadata or {}).get("gms")
if gms is None: # not user-facing
continue
name = gms.get("name", param.name)
if gms.get("type") in ("text", "image", "video", "audio", "mask"):
inputs[name] = {"type": gms["type"], "required": param.required or param.name in triggers}
else:
schema = type_hint_to_schema(param.type_hint) # int -> {"type": "integer"}
if param.default is not None:
schema["default"] = param.default
parameters[name] = schema
tasks[workflow] = {"inputs": inputs, "parameters": parameters}
return {"id": model_id, "tasks": tasks}
No rush since the PR is still WIP, opening this to collect ideas.
Posted by Claude on behalf of @yiyixuxu. The text was drafted together and approved by yiyixuxu.
- Langage dominant
- Python
- Étoiles
- 34.9k
- Forks
- 7.5k
- Merge moyen
- 3 j 16 h
- PR mergées (30 j)
- 65
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de huggingface/diffusers
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
huggingface/diffusers#15363 ·
Les mainteneurs répondent en général sous 1 jour
-
`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeErrorPeut-être pris @chessing234 l’a pris il y a 1 jour. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
huggingface/diffusers#15337 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Multi-vector textual inversion uses only the first vector when the token has uppercase letters (transformers v5)Peut-être pris @sunhouy l’a pris il y a 2 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
huggingface/diffusers#15313 ·
Les mainteneurs répondent en général sous 1 jour
-
TCDScheduler advances the generator on the final step of a strength-truncated custom schedulePeut-être pris @SIDDARTHAREDDY8 l’a pris il y a 5 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
huggingface/diffusers#15288 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
unload_textual_inversion(token) leaves the extra tokens of a multi-vector embedding behind, so it can't be loaded againPeut-être pris @sohailshk l’a pris il y a 11 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
huggingface/diffusers#15211 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de huggingface/diffusers
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
Les mainteneurs répondent en général sous 1 jour
-
Unused loot bag group names left in dreamcraft en_US.langPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. OuverteStatus: Triage Suggestion
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
GTNewHorizons/GT-New-Horizons-Modpack#27789 ·
Les mainteneurs répondent en général sous 1 jour
-
bug frontend sev-5
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
-
core good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
b4b code health next
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
ESCOMP/CTSM#4330 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour