From 595b30b7291b7b04237bf25832301160c0170039 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 27 Jul 2026 04:32:05 +0000 Subject: [PATCH] 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. --- studio/backend/models/training.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/studio/backend/models/training.py b/studio/backend/models/training.py index 0ff4e8e9cc..29ddb3ff7a 100644 --- a/studio/backend/models/training.py +++ b/studio/backend/models/training.py @@ -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 "