I get this exact same error when I try to build everything with the script provided by @FraPochetti
Still thanks a lot for the template though. I tried to add certain extra lines of code like conda updata conda --all but it didn’t help to get rid of the error message. I ended up just using one of the initially provided templates. Thank you all for your help
@FraPochetti I also get the 5 minute timeout error when launching the cloudformation stack using the template you shared. Can you confirm this template still works?
@matt.mcclean can you confirm this setup process still works?
I can report that the cloudformation stack deploys with no issues, and able to access the Sagemaker notebook instance/jupyter. But, the notebook instance it creates does not work with the fastai notebooks.
I selected the Frankfurt, Germany link since I live in Northern Europe, and got this response when trying to create the stack.
CREATE_FAILED The requested resource notebook-instance/ml.p2.xlarge is not available in this region (Service: AmazonSageMaker; Status Code: 400; Error Code: ResourceLimitExceeded; Request ID: 12ba24b0-cf28-4e37-aec0-e04a199ef168)
Hmm, that instance type is definitely supposed to be available in the Frankfurt region. Check out the pricing page under the “On-Demand Notebook Instances” tab and Frankfurt region.
I tried Ireland instead, but ran into having to request a quota increase. It took hours to get a response, which only repeated my request back to me. By that time I was up and running with Paperspace, so I cancelled AWS. Not going back to AWS anytime soon.
Has anyone seen this error while trying to deploy the model?
sagemaker_containers._errors.ClientError: name ‘load_learner’ is not defined
The error is coming from:
File “/usr/local/lib/python3.6/dist-packages/inference.py”, line 15, in model_fn
learn = load_learner(model_dir, fname=‘export.pkl’)
The file inference.py contains the 4 methods: model_fn , input_fn , predict_fn & output_fn
and it imports:
import logging, requests, os, io, glob, time
from fastai.vision import *
This is great. I will try it out. How can this be used when the training data keeps changing on a daily or regular basis like in recommendation engine or forecasting?
Hi, I’m Sal and am trying to start the course. I have been following the Sagemaker instructions but AWS has told me that ml.p3.2xlarge is not available in the US-West, which seems odd to me. Is there any way to use the Notebook with other available instances?
Thanks
I was eventually able to get this working by using the template found at: https://course.fast.ai/start_sagemaker
and then adding the nohup prefix to the pip install commands.
You do need use Cloud Formation: create-stack and enter the template manually in designer or upload.
Perhaps someone could add this to the official button-click launches. It would save some confusion for people not experienced with Cloud Formation
For reference here is my working version:
AWSTemplateFormatVersion: 2010-09-09
Parameters:
InstanceType:
Type: String
Default: ml.p2.xlarge
AllowedValues:
- ml.p3.2xlarge
- ml.p2.xlarge
Description: Enter the SageMaker Notebook instance type
VolumeSize:
Type: Number
Default: 50
Description: Enter the size of the EBS volume attached to the notebook instance
MaxValue: 17592
MinValue: 5
Resources:
Fastai2SagemakerNotebookfastaiv4NotebookRoleA75B4C74:
Type: AWS::IAM::Role
DeletionPolicy: Delete
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: sagemaker.amazonaws.com
Version: “2012-10-17”
ManagedPolicyArns:
- Fn::Join:
- “”
- - “arn:”
- Ref: AWS::Partition
- :iam::aws:policy/AmazonSageMakerFullAccess
Metadata:
aws:cdk:path: CdkFastaiv2SagemakerNbStack/Fastai2SagemakerNotebook/fastai-v4NotebookRole/Resource
Fastai2SagemakerNotebookfastaiv4LifecycleConfigD72E2247:
Type: AWS::SageMaker::NotebookInstanceLifecycleConfig
DeletionPolicy: Delete
Properties:
NotebookInstanceLifecycleConfigName: fastai-v4LifecycleConfig
OnCreate:
- Content:
Fn::Base64: >-
#!/bin/bash
Here’s a guide on how to deploy a fastai v2 model to a sagemaker endpoint using torchserve (pytorch >= 1.6). Largely based on great prior work by @matt.mcclean
Feel free to use this as a template for deploying your own models. I suffered through a lot of issues getting this working so hopefully I can save you some of the pain.