AWS Sagemaker SKlearn entry point allow multiple script

萝らか妹 提交于 2020-01-03 18:19:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!