@@ -430,7 +430,6 @@ def from_env(
430430 _KW_MAP = {
431431 "api_key" : "pipeline.maas.api_key" ,
432432 "api_url" : "pipeline.maas.api_url" ,
433- "model" : "pipeline.maas.model" ,
434433 "mode" : "pipeline.maas.enabled" ,
435434 "timeout" : "pipeline.maas.request_timeout" ,
436435 "enable_layout" : "pipeline.enable_layout" ,
@@ -442,6 +441,15 @@ def from_env(
442441 "cuda_visible_devices" : "pipeline.layout.cuda_visible_devices" ,
443442 "layout_device" : "pipeline.layout.device" ,
444443 }
444+
445+ # `model` is shared by both MaaS and self-hosted modes.
446+ # Keep MaaS behavior while also forwarding it to OCR API so that
447+ # `GlmOcr(mode="selfhosted", model="...")` works as expected.
448+ if "model" in overrides and overrides ["model" ] is not None :
449+ model_value = str (overrides ["model" ])
450+ _set_nested (data , "pipeline.maas.model" , model_value )
451+ _set_nested (data , "pipeline.ocr_api.model" , model_value )
452+
445453 for kw , dotted in _KW_MAP .items ():
446454 if kw in overrides and overrides [kw ] is not None :
447455 raw = overrides [kw ]
0 commit comments