[diffusion] endpoint: fix vertex generate (#17611)

This commit is contained in:
Yashika Gandhi - Google
2026-01-27 17:38:56 -08:00
committed by GitHub
parent 88fcd8535f
commit 32ea7bcdd8

View File

@@ -183,19 +183,28 @@ async def vertex_generate(vertex_req: VertexGenerateReqInput):
image_input = inst.get("image") or inst.get("image_url")
seed_val = params.get("seed", DEFAULT_SEED)
# Create a dictionary of provided parameters
# This filters out None values so the dataclass defaults kick in
user_params = {
"num_frames": params.get("num_frames"),
"fps": params.get("fps"),
"width": params.get("width"),
"height": params.get("height"),
"guidance_scale": params.get("guidance_scale"),
"save_output": params.get("save_output"),
}
# Remove None values to allow SamplingParams defaults to take over
valid_params = {k: v for k, v in user_params.items() if v is not None}
sp = SamplingParams.from_user_sampling_params_args(
model_path=server_args.model_path,
request_id=rid,
prompt=prompt,
image_path=image_input,
num_frames=params.get("num_frames"),
fps=params.get("fps"),
width=params.get("width"),
height=params.get("height"),
guidance_scale=params.get("guidance_scale"),
seed=seed_val,
server_args=server_args,
save_output=params.get("save_output"),
**valid_params, # Unpack the filtered dictionary
)
backend_req = prepare_request(server_args, sampling_params=sp)