How to use sagemaker.processing.Processor run method

0

This is sagemaker docs. What is the purpose of sagemaker.processing.Processor as its run method does not have input for code or script? then how can I use it?

Of course, I can use FrameworkProcessor, ScriptProcessor, SklearnProcessor because I can provide my processing.py. But for the sagemaker.processing.Processor, how can I use it?

hai
質問済み 2年前258ビュー
2回答
1

sagemaker.processing.Processor is the base class which is extended by ScriptProcessor, SKLearnProcessor etc... Its not recommended to directly use the base Processsor class. However you can still have a custom docker image and Run it using the base Processor module.

AWS
回答済み 2年前
AWS
エキスパート
Alex_T
レビュー済み 2年前
  • +1: Since base Processor doesn't support passing in scripts at run-time, the main use case for it would be where you have a container image which already bakes your script in.

0

Thank you, I understand the Processor is a base class. Then, find out how to provide my script to Processor via the entrypoint and run it.

container_base_path = "/opt/ml/processing"

processor = Processor(
    role=os.environ['ROLE'],
    image_uri=image_url,
    instance_count=1,
    instance_type='ml.m4.xlarge',
    entrypoint=["python", f"{container_base_path}/input/process-data.py"]
)

processor.run(
    job_name=f'processor-{strftime("%Y-%m-%d-%H-%M-%S")}',
    inputs=[
        ProcessingInput(
            source=data_input_path,
            destination=f"{container_base_path}/data/"
        ),
        ProcessingInput(
            source=code_input_path,
            destination=f"{container_base_path}/input/"
        )
    ],
...

I feel that SageMaker SDK is not consistent for developers because each processor has a different way to pass my code into it.

  • Processor: entrypoint
  • ScriptProcessor: command
  • SklearnProcessor='my_script.py' in the run method
hai
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ