Forum Discussion
Unable to load ML model
- 2 years ago
The main issue I had was using this particular function:
from synapse.ml.predict import MLFlowTransformer
I've since used a different method available at the below video around 21-23 minutes which has been less troublesome and I've been able to put together what I was after:
Fabric Data Science Sales Forecasting: Predict sales numbers for product categories at a superstore. (youtube.com)
I think what they're saying is that they've found another totally separate resource (That video link) that fixes the missing information in the documentation that's causing the error:
ImportError Traceback (most recent call last) Cell In[13], line 3 1 #Test the model on new sample data points: 2 # Inference with loading the logged model ----> 3 from synapse.ml.predict import MLflowTransformer 5 spark.conf.set("spark.synapse.ml.predict.enabled", "true") 7 model = MLflowTransformer( 8 inputCols=["x"], 9 outputCol="prediction", 10 modelName="sample-sklearn", 11 modelVersion=1, 12 ) ImportError: cannot import name 'MLflowTransformer' from 'synapse.ml.predict' (/home/trusted-service-user/cluster-env/trident_env/lib/python3.10/site-packages/synapse/ml/predict/__init__.py)
I'm experiencing the same error when simply following the tutorial steps exactly. I'm surprised that you've not been able to answer the initial question in a more satisfactory way (Ie, actually provide a reason and suggested resolution) especially considering this is marked as resolved when from my perspective it totally isn't.
To restate the question, the code sample provided results in the error saying that it cannot import name 'MLflowTransformer' from 'synapse.ml.predict'. The question is why is this and what is the proposed fix?