Merge pull request #291 from runpod-workers/bug/281-hf-token
Release / release (push) Waiting to run
Release / release (push) Waiting to run
bug: fix hf-token being passed in engineargs
This commit is contained in:
@@ -82,6 +82,16 @@ def _convert_env_value_to_field_type(value: str, field_name: str, field_type: ty
|
|||||||
if type(None) in (args or ()):
|
if type(None) in (args or ()):
|
||||||
return None
|
return None
|
||||||
raise ValueError("empty value not allowed for non-optional field")
|
raise ValueError("empty value not allowed for non-optional field")
|
||||||
|
|
||||||
|
# Union[bool, str, ...]: only coerce to bool for unambiguous literals;
|
||||||
|
# otherwise preserve the string (e.g. hf_token="hf_abc..." must stay a str).
|
||||||
|
if get_origin(field_type) is not None:
|
||||||
|
union_types = [a for a in (get_args(field_type) or ()) if a is not type(None)]
|
||||||
|
if bool in union_types and str in union_types:
|
||||||
|
if str(val).lower() in ("true", "false", "1", "0", "yes", "no", "on", "off"):
|
||||||
|
return str(val).lower() in ("true", "1", "yes", "on")
|
||||||
|
return str(val)
|
||||||
|
|
||||||
effective_type = _resolve_field_type(field_type)
|
effective_type = _resolve_field_type(field_type)
|
||||||
# bool
|
# bool
|
||||||
if effective_type is bool:
|
if effective_type is bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user