【问题标题】:DeepAR model testing without Deploying无需部署的 DeepAR 模型测试
【发布时间】:2019-07-18 07:32:56
【问题描述】:

我正在训练 DeepAR 模型以进行时间序列预测,训练后我需要将该模型部署到终点以进行测试。

我可以在我的笔记本中获得预测而不部署到端点吗?

【问题讨论】:

    标签: amazon-sagemaker


    【解决方案1】:

    如果端点不适合您,您可以使用批量转换,它将预测存储在 S3 中的数据,并在 S3 中输出结果。文档https://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works-batch.html

    这非常简单,看起来像:

    batch_input = 's3://{}/{}/test/examples'.format(bucket, prefix)
    batch_output = 's3://{}/{}/batch-inference'.format(bucket, prefix) 
    
    transformer = model.transformer(instance_count=1, instance_type='ml.m4.xlarge', output_path=batch_output)
    
    transformer.transform(data=batch_input, data_type='S3Prefix', content_type='text/csv', split_type='Line')
    
    transformer.wait()
    

    如果您正在寻找本地部署,则它不适用于内置算法,仅适用于内置框架(TF、MXNet 等)。

    【讨论】:

    • 是的,它不适用于像 DeepAR 这样的内置算法。我收到此异常 AttributeError: 'DeepARPredictor' object has no attribute 'transformer'
    • 完全支持批量转换,见docs.aws.amazon.com/sagemaker/latest/dg/…。您的代码一定有问题,您可以发布吗?
    • 从错误中,您似乎正在从预测对象调用该方法。在调用 .deploy() 方法后,将从 Python SDK 返回此预测器对象。您必须在 Estimator 类的对象上调用转换器方法
    猜你喜欢
    • 2019-12-15
    • 1970-01-01
    • 2021-11-06
    • 2013-01-16
    • 2015-07-29
    • 2020-08-22
    • 1970-01-01
    • 2022-07-12
    • 2023-04-08
    相关资源
    最近更新 更多