简体   繁体   English

在 SageMaker 上更改训练模型中的预处理

[英]Changing preprocessing in trained model on SageMaker

I have trained model on SageMaker together with prerocessing.我已经在 SageMaker 上训练了模型以及预处理。 By preprocessing I mean I added the inference.py file with input_handler and output_handler functions according to this https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/tensorflow/deploying_tensorflow_serving.rst .通过预处理,我的意思是我根据这个https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/tensorflow/deploying_tensorflow_serving.rst添加了具有 input_handler 和 output_handler 函数的 inference.py 文件。

I works nice but the problem is that everytime I want to change something in the preprocessing I have to retrain the model.我工作得很好,但问题是每次我想在预处理中更改某些内容时,我都必须重新训练模型。 Is there maybe some other to to do this without retraining?在没有再培训的情况下,是否还有其他方法可以做到这一点?

A trained model is simply a function that gets arguments (the input vector) and returns an output (the output vector/value).经过训练的模型只是一个获取参数(输入向量)并返回输出(输出向量/值)的函数。 If you changed the input with your modified pre-processing, you need to change the implementation of your function.如果您使用修改后的预处理更改了输入,则需要更改函数的实现。 This means that you need to retrain your model.这意味着您需要重新训练模型。

Retraining your models is a good habit, even if you don't change anything in your pre-processing, as the input is changing in time.重新训练你的模型是一个好习惯,即使你在预处理中没有改变任何东西,因为输入会随着时间的推移而改变。 The classical example of house prices is highlighting that your model is only good for the data that you trained on.房价的经典示例强调您的模型仅适用于您训练的数据。 If after a couple of years the market has changed, you have to retrained your model.如果几年后市场发生了变化,您必须重新训练您的模型。

Some models are being retrained every day.有些模型每天都在重新训练。 Amazon SageMaker makes it easy to train your model, but calling the train API, and waiting for it to finish. Amazon SageMaker 可以轻松训练您的模型,但调用训练 API 并等待它完成。 You can automate the process of building a new Docker image (if you changed your pre-processing), calling the training API, and then calling the deployment API to SageMaker to ECS/EKS or any other container hosting service.您可以自动执行构建新 Docker 镜像(如果您更改了预处理)、调用训练 API,然后将部署 API 调用到 SageMaker 到 ECS/EKS 或任何其他容器托管服务的过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM