问题
I am trying to follow the tutorial here to implement a custom inference pipeline for feature preprocessing. It uses the python sklearn sdk to bring in custom preprocessing pipeline from a script. For example:
from sagemaker.sklearn.estimator import SKLearn
script_path = 'preprocessing.py'
sklearn_preprocessor = SKLearn(
entry_point=script_path,
role=role,
train_instance_type="ml.c4.xlarge",
sagemaker_session=sagemaker_session)
However I can't find a way to send multiple files. The reason I need multiple files is because I have a custom class used in the sklearn pipeline needs to be imported from a custom module. Without importing, it raises error AttributeError: module '__main__' has no attribute 'CustomClassName'
when having the custom class in the same preprocessing.py file due to the way pickle works (at least I think it's related to pickle).
Anyone know if sending multiple files is even possible?
Newbie to Sagemaker, thanks!!
回答1:
There's a source_dir parameter which will "lift" a directory of files to the container and put it on your import path.
You're entrypoint script should be put there to and referenced from that location.
来源:https://stackoverflow.com/questions/54314876/aws-sagemaker-sklearn-entry-point-allow-multiple-script