amazon-sagemaker-examples icon indicating copy to clipboard operation
amazon-sagemaker-examples copied to clipboard

IOError: [Errno 2] No such file or directory: '/opt/ml/model/decision-tree-model.pkl'

Open tminussi opened this issue 7 years ago • 5 comments

Hello everyone.

I am trying to run the example under https://github.com/awslabs/amazon-sagemaker-examples/tree/master/advanced_functionality/scikit_bring_your_own and this definitely does not work out of the box.

Once the image is deployed to ECR, I attempt to create a new Model with its corresponding EndpointConfiguration and Endpoint, but I always run into the following issue as per CloudWatch logs: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1718, in handle_user_exception IOError: [Errno 2] No such file or directory: '/opt/ml/model/decision-tree-model.pkl

I have tried running the commands as suggested in #283 but no luck either.

Can anyone please suggest a workaround or point to a valid working solution? (Initially, I was looking at https://sagemaker-workshop.com/custom/containers.html and this is how I ended up here)

All I need is a container that actually works so I can deploy it to SageMaker and start building on top of it.

Any help is greatly appreciated,

Thanks

Thales

tminussi avatar Feb 12 '19 11:02 tminussi

I have tried reproducing the tensorflow_bring_your_own and I ran into a similar issue as well:

E tensorflow_serving/sources/storage_path/file_system_storage_path_source.cc:369] FileSystemStoragePathSource encountered a file-system access error: Could not find base path /opt/ml/model/export/Servo for servable cifar10_model

Maybe there's a non documented step which I may be missing considering I am completely new to ML in general?

EDIT: Although the error message is shown in the logs, the status of the endpoint is "InService", so I assume this is working as expected?

tminussi avatar Feb 12 '19 11:02 tminussi

@tminussi did you solve the issue? I am running into a similar problem:

OSError: [Errno 2] No such file or directory: '/opt/ml/input/data/training'

mcassuranceiq avatar Mar 10 '19 23:03 mcassuranceiq

@mcassuranceiq I have not. I ended up giving up and creating my own docker image instead. I would like to get this to work though, but no luck so far.

tminussi avatar Mar 11 '19 06:03 tminussi

If you adjust the code for the get methods in predictor.py to:

@app.route('/ping', methods=['GET'])
def ping():
    """Determine if the container is working and healthy. In this sample container, we declare
    it healthy if we can load the model successfully."""

    status = 200
    folders = [f for f in glob.glob(model_path+'/*')]

    for f in folders:
        print(f)
    return flask.Response(response='\n', status=status, mimetype='application/json')

It should fix the error you are running into.

You will also need to import glob.

moviedatascience avatar Jan 13 '20 09:01 moviedatascience

If you adjust the code for the get methods in predictor.py to:

@app.route('/ping', methods=['GET'])
def ping():
    """Determine if the container is working and healthy. In this sample container, we declare
    it healthy if we can load the model successfully."""

    status = 200
    folders = [f for f in glob.glob(model_path+'/*')]

    for f in folders:
        print(f)
    return flask.Response(response='\n', status=status, mimetype='application/json')

It should fix the error you are running into.

You will also need to import glob.

I tried it but it didn't work. Iam also using cygwin in windows 10. can this cause any error?

Mostafa-Ellebodi avatar Jul 28 '20 14:07 Mostafa-Ellebodi