Match the file's typing idiom for flow_shift

models/training.py annotates with typing constructs throughout (105 Optional[...],
no Union), and flow_shift was the one place using PEP 604. Union[] reads like the
rest of the file, and it also drops the runtime evaluation that would raise on
Python 3.9.
This commit is contained in:
Daniel Han 2026-07-27 04:32:05 +00:00
commit 595b30b729

View file

@ -7,7 +7,7 @@ Pydantic schemas for Training API
import re
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
from typing import Any, Optional, List, Dict, Literal
from typing import Any, Optional, List, Dict, Literal, Union
from utils.training_runs import normalize_project_name
@ -828,7 +828,7 @@ class DiffusionTrainingStartRequest(BaseModel):
"(Gaussian bell centered mid-schedule). Timesteps are always logit-normal sampled."
),
)
flow_shift: Optional[float | Literal["auto"]] = Field(
flow_shift: Optional[Union[float, Literal["auto"]]] = Field(
None,
description = (
"Flow-matching timestep shift. null uses the family default "