support requirements.txt in TF serving
Do you support customized packages (installing dependences) in serving mode?
Hi @chinazm ,
Yes, with the requirements_file parameter:
https://github.com/aws/sagemaker-python-sdk/blob/6b809eba605119ff274b39b3c8df3dd1163e784a/src/sagemaker/tensorflow/estimator.py#L123-L125
I just updated https://github.com/aws/sagemaker-python-sdk/issues/84. I suspect that we're not handling your use case correctly in the image, though. We'll investigate that further.
Thanks!
Sorry I may not make the question clear. When do the training, you can specify the requirements_file, in Tensorflow. However, when you deploy the model for serving, estimator.deploy(initial_instance_count=1, instance_type='ml.c4.xlarge'), I don't think there is a requirements.txt to be deployed in the endpoint container...
Thank you!
Hi @chinazm,
The requirements.txt file should work in this hosting case, but it seems from the other issue that it isn't working for your case. We're looking into this now. Thanks!
i was able to get around this by adding this code before the relavent imports:
try:
from pip import main as pipmain
except:
from pip._internal import main as pipmain
requirements=os.path.dirname(__file__)
pipmain(['install', "--upgrade", "pip"])
pipmain(['install', "-r","requirements"])
change requirements to point to your requirements file
@JohnCalhoun Your solution doesn't work for me. It throws an error saying TypeError: super(type, obj): obj must be an instance or subtype of type. Do you happen to know how to trouble-shoot this?