[Model] Add torch.compile support for InternVL vision encoder (#38049)
Signed-off-by: tianrengao <terrygao87@gmail.com>
This commit is contained in:
@@ -296,7 +296,15 @@ def normalize_value(x):
|
||||
|
||||
# PretrainedConfig
|
||||
if hasattr(x, "to_json_string") and callable(x.to_json_string):
|
||||
return x.to_json_string()
|
||||
try:
|
||||
return x.to_json_string()
|
||||
except (TypeError, ValueError):
|
||||
# to_json_string() may fail for trust-remote-code configs
|
||||
# with non-JSON-serializable nested objects. Fall back to
|
||||
# normalizing the dict representation recursively.
|
||||
if hasattr(x, "to_dict") and callable(x.to_dict):
|
||||
return normalize_value(x.to_dict())
|
||||
raise
|
||||
|
||||
# Unsupported type: e.g., modules, generators, open files, or objects
|
||||
# without a stable JSON/UUID representation. Hard-error to avoid
|
||||
|
||||
Reference in New Issue
Block a user