翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
TensorFlow フレームワークプロセッサ
TensorFlow は、オープンソースの機械学習と人工知能のライブラリです。Amazon SageMaker Python SDK の TensorFlowProcessor は、TensorFlow スクリプトを使用して処理ジョブを実行する機能を提供します。を使用するとTensorFlowProcessor、Amazon が構築した Docker コンテナをマネージド TensorFlow 環境で活用できるため、独自のコンテナを持ち込む必要はありません。
次のコード例は、SageMaker AI によって提供および保守されている Docker イメージを使用して処理ジョブを実行する方法を示しています。ジョブを実行するとき、source_dir 引数にスクリプトと依存関係を含むディレクトリを指定でき、処理スクリプトの依存関係を指定する requirements.txt ファイルを source_dir ディレクトリ内に置くことができることにご注意ください。SageMaker Processing は、コンテナの requirements.txt に依存関係をインストールします。
from sagemaker.core.resources import ProcessingJob from sagemaker.core.helper.session_helper import get_execution_role # Create a processing job with a TensorFlow container processing_job = ProcessingJob.create( processing_job_name='frameworkprocessor-TF', role_arn=get_execution_role(), app_specification={ "image_uri": "tensorflow-processing-image-uri", "container_entrypoint": ["python3", "/opt/ml/processing/input/code/processing-script.py"] }, processing_resources={ "cluster_config": {"instance_count": 1, "instance_type": "ml.m5.xlarge", "volume_size_in_gb": 30} }, processing_inputs=[ {"input_name": "data", "s3_input": {"s3_uri": f"s3://{{BUCKET}}/{{S3_INPUT_PATH}}", "local_path": "/opt/ml/processing/input/data", "s3_data_type": "S3Prefix", "s3_input_mode": "File"}}, {"input_name": "model", "s3_input": {"s3_uri": f"s3://{{BUCKET}}/{{S3_PATH_TO_MODEL}}", "local_path": "/opt/ml/processing/input/model", "s3_data_type": "S3Prefix", "s3_input_mode": "File"}}, {"input_name": "code", "s3_input": {"s3_uri": "s3://path/to/scripts/", "local_path": "/opt/ml/processing/input/code", "s3_data_type": "S3Prefix", "s3_input_mode": "File"}} ], processing_output_config={ "outputs": [ {"output_name": "predictions", "s3_output": {"s3_uri": f"s3://{{BUCKET}}/{{S3_OUTPUT_PATH}}", "local_path": "/opt/ml/processing/output", "s3_upload_mode": "EndOfJob"}} ] } )
requirements.txt ファイルがある場合、コンテナにインストールするライブラリのリストである必要があります。source_dir のパスは、相対パス、絶対パス、または Amazon S3 URI パスのいずれかになります。ただし、Amazon S3 URI を使用する場合は、tar.gz ファイルを指している必要があります。source_dir に指定したディレクトリには複数のスクリプトを入れることができます。TensorFlowProcessor クラスの詳細については、Amazon SageMaker Python SDK の「TensorFlow Estimator