-
Notifications
You must be signed in to change notification settings - Fork 0
[Manual Test] diffusion endpoints allow model mismatch (upstream #2805) #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1304,11 +1304,10 @@ async def generate_images(request: ImageGenerationRequest, raw_request: Request) | |||||||||
| # Get engine client (AsyncOmni) from app state | ||||||||||
| engine_client, model_name, stage_configs = _get_engine_and_model(raw_request) | ||||||||||
|
|
||||||||||
| # Validate model field (warn if mismatch, don't error) | ||||||||||
| if request.model is not None and request.model != model_name: | ||||||||||
| logger.warning( | ||||||||||
| f"Model mismatch: request specifies '{request.model}' but " | ||||||||||
| f"server is running '{model_name}'. Using server model." | ||||||||||
| raise HTTPException( | ||||||||||
| status_code=HTTPStatus.BAD_REQUEST.value, | ||||||||||
| detail=(f"Model mismatch: request specifies '{request.model}' but server is running '{model_name}'."), | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| try: | ||||||||||
|
|
@@ -1446,8 +1445,9 @@ async def edit_images( | |||||||||
| # 1. get engine and model | ||||||||||
| engine_client, model_name, stage_configs = _get_engine_and_model(raw_request) | ||||||||||
| if model is not None and model != model_name: | ||||||||||
| logger.warning( | ||||||||||
| f"Model mismatch: request specifies '{model}' but server is running '{model_name}'. Using server model." | ||||||||||
| raise HTTPException( | ||||||||||
| status_code=HTTPStatus.BAD_REQUEST.value, | ||||||||||
| detail=(f"Model mismatch: request specifies '{model}' but server is running '{model_name}'."), | ||||||||||
| ) | ||||||||||
| # 2. get output format & compression | ||||||||||
| output_format = _choose_output_format(output_format, background) | ||||||||||
|
|
@@ -2136,10 +2136,12 @@ async def _parse_video_form( | |||||||||
| app_model_name, app_stage_configs = _resolve_video_runtime_context(raw_request) | ||||||||||
| effective_model_name = handler.model_name or app_model_name or request.model or "unknown" | ||||||||||
| if request.model is not None and effective_model_name is not None and request.model != effective_model_name: | ||||||||||
|
Comment on lines
2137
to
2138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||
| logger.warning( | ||||||||||
| "Model mismatch: request specifies '%s' but server is running '%s'. Using server model.", | ||||||||||
| request.model, | ||||||||||
| effective_model_name, | ||||||||||
| raise HTTPException( | ||||||||||
| status_code=HTTPStatus.BAD_REQUEST.value, | ||||||||||
| detail=( | ||||||||||
| f"Model mismatch: request specifies '{request.model}' but server is running " | ||||||||||
| f"'{effective_model_name}'." | ||||||||||
| ), | ||||||||||
| ) | ||||||||||
| handler.set_stage_configs_if_missing(app_stage_configs) | ||||||||||
| except HTTPException: | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
or request.modelfallback silently defeats the new hard-error guard. When bothhandler.model_nameandapp_model_nameareNone(which is possible ifOmniOpenAIServingVideowas constructed via__init__with the defaultmodel_name=None, e.g. not viafor_diffusion),effective_model_namebecomesrequest.modeland the checkrequest.model != effective_model_nameis alwaysFalse— no 400 is ever raised.The image endpoints don't have this hole:
_get_engine_and_modeluses"unknown"as the fallback, not the client's model string.If the intent is a hard reject on mismatch, pull the model name directly from the handler/app and error explicitly when it's unset, rather than falling back to what the client sent:
Then keep the existing mismatch check below unchanged.