Unverified Commit 7142bdfa authored by inisis's avatar inisis Committed by GitHub
Browse files

Add is_model_supported for fx (#28521)



* modify check_if_model_is_supported to return bool

* add is_model_supported and have check_if_model_is_supported use that

* Update src/transformers/utils/fx.py

Fantastic
Co-authored-by: default avataramyeroberts <22614925+amyeroberts@users.noreply.github.com>

---------
Co-authored-by: default avataramyeroberts <22614925+amyeroberts@users.noreply.github.com>
parent 02f8738e
...@@ -1199,8 +1199,12 @@ def get_concrete_args(model: nn.Module, input_names: List[str]): ...@@ -1199,8 +1199,12 @@ def get_concrete_args(model: nn.Module, input_names: List[str]):
return {p.name: p.default for p in sig.parameters.values() if p.name not in input_names} return {p.name: p.default for p in sig.parameters.values() if p.name not in input_names}
def is_model_supported(model: PreTrainedModel):
return model.__class__.__name__ in _SUPPORTED_MODELS
def check_if_model_is_supported(model: PreTrainedModel): def check_if_model_is_supported(model: PreTrainedModel):
if model.__class__.__name__ not in _SUPPORTED_MODELS: if not is_model_supported(model):
supported_model_names = ", ".join(_SUPPORTED_MODELS) supported_model_names = ", ".join(_SUPPORTED_MODELS)
raise NotImplementedError( raise NotImplementedError(
f"Model {model.__class__.__name__} is not supported yet, supported models: {supported_model_names}" f"Model {model.__class__.__name__} is not supported yet, supported models: {supported_model_names}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment