Reputation: 23
We are trying to execute and check what kind of output is provided by Predictive Maintenance Using Machine Learning on AWS sample data. We are referring Predictive Maintenance Using Machine Learning and AWS Guide to launch the sample template provided by the AWS. The template is executed properly and we can see the resources in account. Whenever we run the sagemaker notebook for the given example we are getting the error in CloudWatch logs as follows
ImportError: cannot import name 'replace_file' on line from mxnet.gluon.utils import download, check_sha1, _get_repo_file_url, replace_file.
This is the stage where the invoke the training job. We have tried following options to resolve the issue.
But no success.
Thanks in advance.
Error Traceback is as follows
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/ml/code/sagemaker_predictive_maintenance_entry_point.py", line 10, in <module>
import gluonnlp
File "/usr/local/lib/python3.5/dist-packages/gluonnlp/__init__.py", line 25, in <module>
from . import data
File "/usr/local/lib/python3.5/dist-packages/gluonnlp/data/__init__.py", line 23, in <module>
from . import (batchify, candidate_sampler, conll, corpora, dataloader,
File "/usr/local/lib/python3.5/dist-packages/gluonnlp/data/question_answering.py", line 31, in <module>
from mxnet.gluon.utils import download, check_sha1, _get_repo_file_url, replace_file
ImportError: cannot import name 'replace_file'
Upvotes: 2
Views: 463
Reputation: 825
A fix for this issue is being deployed to the official solution. In the meantime, you can make the changes described here in your SageMaker environment by following the instructions below:
1) In the notebook, please change the framework_version
to 1.6.0
.
MXNet(entry_point='sagemaker_predictive_maintenance_entry_point.py',
source_dir='sagemaker_predictive_maintenance_entry_point',
py_version='py3',
role=role,
train_instance_count=1,
train_instance_type=train_instance_type,
output_path=output_location,
hyperparameters={'num-datasets' : len(train_df),
'num-gpus': 1,
'epochs': 500,
'optimizer': 'adam',
'batch-size':1,
'log-interval': 100},
input_mode='File',
train_max_run=7200,
framework_version='1.6.0') <- Change this to 1.6.0.
2) This will likely fix things, but just to be sure you don't have any stale packages, change the requirements.txt
file as well.
You'll need to open up a terminal in SageMaker. image taken from https://medium.com/swlh/jupyter-notebook-on-amazon-sagemaker-getting-started-55489f500439
and run
cd SageMaker/sagemaker_predictive_maintenance_entry_point/
sudo vim requirements.txt # (or sudo nano requirements.txt)
Change the contents to:
gluonnlp==0.9.1
pandas==0.22
Save it, and then run the example again.
Feel free to comment on the issue as well: https://github.com/awslabs/predictive-maintenance-using-machine-learning/issues/6
Upvotes: 2