SageMaker脚本模式+管道模式

问题描述 投票:0回答:1

我正在使用TensorFlow +脚本模式在SageMaker中进行培训,目前正在为我的数据使用“文件”输入模式。

有没有人想出如何使用“管道”数据格式结合脚本模式培训来传输数据?

python tensorflow streaming amazon-sagemaker
1个回答
1
投票

您可以从训练脚本导入sagemaker_tensorflow,如下所示:

from sagemaker_tensorflow import PipeModeDataset
from tensorflow.contrib.data import map_and_batch

channel = 'my-pipe-channel-name'

ds = PipeModeDataset(channel)
ds = ds.repeat(EPOCHS)
ds = ds.prefetch(PREFETCH_SIZE)
ds = ds.apply(map_and_batch(parse, batch_size=BATCH_SIZE,
                            num_parallel_batches=NUM_PARALLEL_BATCHES))

你可以在这里找到完整的例子:https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-python-sdk/tensorflow_pipemode_example/pipemode.py

你可以在这里找到关于sagemaker_tensorflow的文档https://github.com/aws/sagemaker-tensorflow-extensions#using-the-pipemodedataset

© www.soinside.com 2019 - 2024. All rights reserved.