You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While deploying the model generated with the regression example, getting below error: (In this case, the model has been created, but getting error while deploying the model on sagemaker)
MlflowException: The specified model does not contain any of the supported flavors for deployment. The model contains the following flavors: dict_keys(['sklearn']). Supported flavors: ['python_function', 'mleap']
def estimator_fn(estimator_params: Dict[str, Any] = None):
"""
Returns an *unfitted* estimator that defines ``fit()`` and ``predict()`` methods.
The estimator's input and output signatures should be compatible with scikit-learn
estimators.
"""
if estimator_params is None:
estimator_params = {}
sgd_regressor = SGDRegressor(random_state=42, **estimator_params)
model_info = mlflow.sklearn.log_model(
sk_model=sgd_regressor, artifact_path="sklearn_pyfunc_model_artifact"
)
sklearn_pyfunc = mlflow.pyfunc.load_model(model_uri=model_info.model_uri)
return sklearn_pyfunc`
With above modification, getting below error (In this case, getting error while running train step of the recipe):
MlflowException Traceback (most recent call last)
Cell In[17], line 1
----> 1 r.run("train")
File ~/.local/share/virtualenvs/recipes-examples-49tQ2II3/lib/python3.10/site-packages/mlflow/recipes/regression/v1/recipe.py:276, in RegressionRecipe.run(self, step)
204 def run(self, step: str = None) -> None:
205 """
206 Runs the full recipe or a particular recipe step, producing outputs and displaying a
207 summary of results upon completion. Step outputs are cached from previous executions, and
(...)
274 regression_recipe.run()
275 """
--> 276 return super().run(step=step)
File ~/.local/share/virtualenvs/recipes-examples-49tQ2II3/lib/python3.10/site-packages/mlflow/recipes/recipe.py:98, in BaseRecipe.run(self, step)
96 if last_executed_step_state.status != StepStatus.SUCCEEDED:
97 if step is not None:
---> 98 raise MlflowException(
99 f"Failed to run step '{step}' of recipe '{self.name}'."
100 f" An error was encountered while running step '{last_executed_step.name}':"
101 f" {last_executed_step_state.stack_trace}",
102 error_code=BAD_REQUEST,
103 )
104 else:
105 raise MlflowException(
106 f"Failed to run recipe '{self.name}'."
107 f" An error was encountered while running step '{last_executed_step.name}':"
108 f" {last_executed_step_state.stack_trace}",
109 error_code=BAD_REQUEST,
110 )
MlflowException: Failed to run step 'train' of recipe 'regression'. An error was encountered while running step 'train': Traceback (most recent call last):
File "/home/jaykishan/.local/share/virtualenvs/recipes-examples-49tQ2II3/lib/python3.10/site-packages/mlflow/recipes/step.py", line 129, in run
self.step_card = self._run(output_directory=output_directory)
File "/home/jaykishan/.local/share/virtualenvs/recipes-examples-49tQ2II3/lib/python3.10/site-packages/mlflow/recipes/steps/train.py", line 367, in _run
estimator = self._resolve_estimator(
File "/home/jaykishan/.local/share/virtualenvs/recipes-examples-49tQ2II3/lib/python3.10/site-packages/mlflow/recipes/steps/train.py", line 695, in _resolve_estimator
return self._get_user_defined_estimator(
File "/home/jaykishan/.local/share/virtualenvs/recipes-examples-49tQ2II3/lib/python3.10/site-packages/mlflow/recipes/steps/train.py", line 665, in _get_user_defined_estimator
default_params = estimator.get_params()
AttributeError: 'PyFuncModel' object has no attribute 'get_params'
Any idea about this?
The text was updated successfully, but these errors were encountered:
While deploying the model generated with the regression example, getting below error: (In this case, the model has been created, but getting error while deploying the model on sagemaker)
MlflowException: The specified model does not contain any of the supported flavors for deployment. The model contains the following flavors: dict_keys(['sklearn']). Supported flavors: ['python_function', 'mleap']
Script for model deployment: https://github.com/aws-samples/amazon-sagemaker-mlflow-fargate/blob/main/lab/3_deploy_model.ipynb
Full traceback:
Below is the MLmodel file:
Tried modifying estimator function in train.py step as below to get python_function flavor in the MLmodel file:
With above modification, getting below error (In this case, getting error while running train step of the recipe):
Any idea about this?
The text was updated successfully, but these errors were encountered: