我已经用 sagemaker 成功地训练了一个 LDA 模型,我已经能够设置一个推理 API,但它对我一次可以查询的记录数有限制。
我需要对一个大文件进行预测,并且一直在尝试使用批量转换,但是遇到了障碍。
我的输入日期是 application/x-recordio-protobuf 内容类型,代码如下:
# Initialize the transformer object
transformer =sagemaker.transformer.Transformer(
base_transform_job_name='Batch-Transform',
model_name=model_name,
instance_count=1,
instance_type='ml.c4.xlarge',
output_path=output_location,
max_payload=20,
strategy='MultiRecord'
)
# Start a transform job
transformer.transform(input_location, content_type='application/x-recordio-protobuf',split_type="RecordIO")
# Then wait until the transform job has completed
transformer.wait()
# Fetch validation result
s3_client.download_file(bucket, 'topic_model_batch_transform/output/batch_tansform_part0.pbr.out', 'batch_tansform-result')
with open('batch_tansform-result') as f:
results = f.readlines()
print("Sample transform result: {}".format(results[0]))
我已将输入文件分成 10 个文件,每个文件大小约为 19MB。我首先尝试在单个块上运行,因此总共 19MB。我尝试过改变策略,尝试 SingleRecord。我也尝试过不同的 split_types,也尝试过 None 和“Line”。
我已经阅读了文档,但不清楚我还应该尝试什么,错误消息也很不清楚。
2019-04-02T15:49:47.617:[sagemaker logs]: MaxConcurrentTransforms=1, MaxPayloadInMB=20, BatchStrategy=MULTI_RECORD
#011at java.lang.Thread.run(Thread.java:748)2019-04-02T15:49:48.035:[sagemaker logs]: du-sagemaker/data/batch_transform/batch_tansform_part0.pbr: Bad HTTP status returned from invoke: 413
2019-04-02T15:49:48.036:[sagemaker logs]: du-sagemaker/data/batch_transform/batch_tansform_part0.pbr:
2019-04-02T15:49:48.036:[sagemaker logs]: du-sagemaker/data/batch_transform/batch_tansform_part0.pbr: Message:
2019-04-02T15:49:48.036:[sagemaker logs]: du-sagemaker/data/batch_transform/batch_tansform_part0.pbr: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2019-04-02T15:49:48.036:[sagemaker logs]: du-sagemaker/data/batch_transform/batch_tansform_part0.pbr: <title>413 Request Entity Too Large</title>
2019-04-02T15:49:48.036:[sagemaker logs]: du-sagemaker/data/batch_transform/batch_tansform_part0.pbr: <h1>Request Entity Too Large</h1>
2019-04-02T15:49:48.036:[sagemaker logs]: du-sagemaker/data/batch_transform/batch_tansform_part0.pbr: <p>The data value transmitted exceeds the capacity limit.</p>
以上是我使用上述配置获得的最后一个,在此之前我还收到了 400 HTTP 错误代码。
任何帮助或指示将不胜感激!谢谢