Hugo Evers
01/19/2024, 1:36 PMMlflowModelLoggerDataSet
. The error indicates that the module transformers
does not have the specified attribute LSGDistilBertForSequenceClassification
.
Below is the traceback. Any insights on how to resolve this issue would be greatly appreciated.
/home/ec2-user/PROJECT/.venv/lib/python3.9/site-packages/kedro/io/core.py:193 in load
return self._load()
...
/home/ec2-user/PROJECT/.venv/lib/python3.9/site-packages/kedro_mlflow/io/models/mlflow_model_logger_dataset.py:91 in _load
return self._mlflow_model_module.load_model(model_uri=self.model_uri, **self._load_args)
...
/home/ec2-user/PROJECT/.venv/lib/python3.9/site-packages/mlflow/transformers/init.py:875 in load_model
return _load_model(local_model_path, flavor_config, return_type, device, **kwargs)
...
/home/ec2-user/PROJECT/.venv/lib/python3.9/site-packages/mlflow/transformers/init.py:935 in _load_model
model_instance = getattr(transformers, flavor_config[_PIPELINE_MODEL_TYPE_KEY])
...
/home/ec2-user/PROJECT/.venv/lib/python3.9/site-packages/transformers/utils/import_utils.py:1375 in getattr
raise AttributeError(f"module {self.name} has no attribute {name}")
**Error**: `AttributeError: module transformers has no attribute LSGDistilBertForSequenceClassification`
This error occurred while executing a Kedro pipeline that loads a model from MLflow.
Any guidance on troubleshooting or fixing this issue would be greatly appreciated.
Thank you!Yolan Honoré-Rougé
01/19/2024, 7:02 PMpipeline_ml_factory
or through MlflowModelLoggerDataSet.save
method?Yolan Honoré-Rougé
01/19/2024, 7:04 PMLSGDistilBertForSequenceClassification
a custom class? Where is the code stored ?Hugo Evers
01/19/2024, 8:26 PMYolan Honoré-Rougé
01/20/2024, 2:01 PMAutoModelForSequenceClassification.from_pretrained
do some dark magic with the PYTHONPATH to import the code. You need to import it manually in your project to make the class available.