Error when adding dataset to the model on Azure ML
When I try to add dataset to the model I got error like .
UserScriptException: UserScriptException: Message: Invalid dataset of type <class 'str'> passed, must be of type Dataset or DatasetSnapshot
my codes are Model.register(workspace=run.experiment.workspace, model_path = model_file, model_name = 'randomforestregressor_model', model_framework=Model.Framework.SCIKITLEARN, # Framework used to create the model. model_framework_version=sklearn.version, # Version of scikit-learn used to create the model. tags={'Training context':'Pipeline'}, sample_input_dataset=pre_processed_data, properties={'Error': np.float(train_mse_err)}, datasets=list(("first_Added_dataset_to_model", pre_processed_data)) )
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureml-github.
Issue Details
When I try to add dataset to the model I got error like .
UserScriptException: UserScriptException: Message: Invalid dataset of type <class 'str'> passed, must be of type Dataset or DatasetSnapshot
my codes are Model.register(workspace=run.experiment.workspace, model_path = model_file, model_name = 'randomforestregressor_model', model_framework=Model.Framework.SCIKITLEARN, # Framework used to create the model. model_framework_version=sklearn.version, # Version of scikit-learn used to create the model. tags={'Training context':'Pipeline'}, sample_input_dataset=pre_processed_data, properties={'Error': np.float(train_mse_err)}, datasets=list(("first_Added_dataset_to_model", pre_processed_data)) )
| Author: | CakmakMuhammet |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
Thanks for the feedback, we’ll investigate asap.
@Salil Bapatmailto:[email protected] / @Travis Angevinemailto:[email protected] / @Shivani Patelmailto:[email protected]
Sent from Outlookhttp://aka.ms/weboutlook
From: msftbot[bot] [email protected] Sent: Thursday, February 25, 2021 8:58 AM To: Azure/azure-sdk-for-python [email protected] Cc: azureml-github [email protected]; Mention [email protected] Subject: Re: [Azure/azure-sdk-for-python] Error when adding dataset to the model on Azure ML (#16932)
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureml-githubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fazureml-github&data=04%7C01%7CJordane%40microsoft.com%7C49b2ff82dda74629c66e08d8d9ae8ffe%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637498691485884780%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=C2Fx3JwUCtKr5nqOvJoMJzyNEeZqVx8jVmDgLQjD2Sk%3D&reserved=0.
Issue Details
When I try to add dataset to the model I got error like .
UserScriptException: UserScriptException: Message: Invalid dataset of type <class 'str'> passed, must be of type Dataset or DatasetSnapshot
my codes are Model.register(workspace=run.experiment.workspace, model_path = model_file, model_name = 'randomforestregressor_model', model_framework=Model.Framework.SCIKITLEARN, # Framework used to create the model. model_framework_version=sklearn.version, # Version of scikit-learn used to create the model. tags={'Training context':'Pipeline'}, sample_input_dataset=pre_processed_data, properties={'Error': np.float(train_mse_err)}, datasets=list(("first_Added_dataset_to_model", pre_processed_data)) )
Author: CakmakMuhammet Assignees: - Labels:
Machine Learning, Service Attention, bug, customer-reported, needs-triage, question
Milestone: -
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-sdk-for-python%2Fissues%2F16932%23issuecomment-786050708&data=04%7C01%7CJordane%40microsoft.com%7C49b2ff82dda74629c66e08d8d9ae8ffe%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637498691485884780%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Cx0IbHF2x9jP6p%2FBa7pbmjKnTLZd%2F%2BWxIp5CUNN6ew4%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOVYYXT7LTKYXQGHFT62DQLTAZ6S7ANCNFSM4YGOF6PQ&data=04%7C01%7CJordane%40microsoft.com%7C49b2ff82dda74629c66e08d8d9ae8ffe%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637498691485894741%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YOaTqDPgZVutofaGPC%2BRifqUPrRN4g%2B35M6Pp2Etol4%3D&reserved=0.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @lostmygithubaccount.
Issue Details
When I try to add dataset to the model I got error like .
UserScriptException: UserScriptException: Message: Invalid dataset of type <class 'str'> passed, must be of type Dataset or DatasetSnapshot
my codes are Model.register(workspace=run.experiment.workspace, model_path = model_file, model_name = 'randomforestregressor_model', model_framework=Model.Framework.SCIKITLEARN, # Framework used to create the model. model_framework_version=sklearn.version, # Version of scikit-learn used to create the model. tags={'Training context':'Pipeline'}, sample_input_dataset=pre_processed_data, properties={'Error': np.float(train_mse_err)}, datasets=list(("first_Added_dataset_to_model", pre_processed_data)) )
| Author: | CakmakMuhammet |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
@CakmakMuhammet , how do you create pre_processed_data? Per the error message, it seems like that variable is referring to a string when it should be referring to a Dataset object. If it is pointing to a Dataset object, if you can provide the full stacktrace that would help with debugging. Thanks.
@trangevi It is <class 'azureml.data.tabular_dataset.TabularDataset'>.
You can see the error that i can see on the pipeline.
Saving model... Registering model... Registering model randomforestregressor_model Starting the daemon thread to refresh tokens in background for process with pid = 102
[2021-02-25T12:34:27.168055] The experiment failed. Finalizing run...
Cleaning up all outstanding Run operations, waiting 900.0 seconds
2 items cleaning up...
Cleanup took 0.1970975399017334 seconds
Starting the daemon thread to refresh tokens in background for process with pid = 102
Traceback (most recent call last):
File "/mnt/batch/tasks/shared/LS_root/jobs/datasciencewsdev/azureml/9c128523-3e46-4415-987d-8d8a10c94586/mounts/workspaceblobstore/azureml/9c128523-3e46-4415-987d-8d8a10c94586/azureml-setup/context_manager_injector.py", line 223, in execute_with_context
runpy.run_path(sys.argv[0], globals(), run_name="main")
File "/azureml-envs/azureml_e0b4b7d75c9cd39eaa8d1cae40f9b062/lib/python3.6/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "/azureml-envs/azureml_e0b4b7d75c9cd39eaa8d1cae40f9b062/lib/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/azureml-envs/azureml_e0b4b7d75c9cd39eaa8d1cae40f9b062/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "training.py", line 74, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "training.py", line 74, in
[2021-02-25T12:34:28.035153] Finished context manager injector with Exception.
Ah, interesting. Looks like using list is converting the internal tuple into a flat list, so instead of a list of a single tuple for the 'datasets' parameter, you're getting a list of a string and an object. This appears to be an effect of the list function itself: https://www.programiz.com/python-programming/methods/built-in/list. If instead you use array notation it maintains the internal tuple.
>>> datasets_list=list(("first_Added_dataset_to_model", pre_processed_data))
>>> datasets_list
['first_Added_dataset_to_model', {}]
>>> datasets_list=[("first_Added_dataset_to_model", pre_processed_data)]
>>> datasets_list
[('first_Added_dataset_to_model', {})]
So if you change how you're creating that list object to use array notation it should work as expected.
Hi again, It is very interesting but It worked very well. Many thanks.