Google App Engine:每天自动重新部署一次以更新机器学习模型? [英] Google App Engine: Automatically re-deploy once a day to update machine learning model?

查看:66
本文介绍了Google App Engine:每天自动重新部署一次以更新机器学习模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下情况:在Google App引擎上运行的Python Flask应用;这个应用程式提供Spacy机器学习模型的预测.整天都有一个为该模型添加新训练数据的工作流程,并且该应用程序有一项cron任务,该工作每天晚上都会考虑这些新训练数据来重新训练模型.

I have the following situation: a Python Flask app running on Google App engine; this app serves predictions from a Spacy machine learning model. Throughout the day, there is a workflow in place which adds new training data for this model, and the App has a cron job that retrains the model taking this new training data into account every evening.

问题是我希望每个App实例在此新训练的模型可用后都引用它.我可以将模型上载到某个地方(例如Google Cloud Storage),但是最终,每个实例都需要找出该新模型的存在,下载并加载到内存中/进行初始化.这需要时间,所以我只想每天/启动一次.

The problem is that I want each App instance to reference this newly trained model after it becomes available. I can upload the model somewhere (say, Google Cloud Storage) but, ultimately, each instance needs to find out about the existence of this new model, download it, and load it into memory/initialize it; this takes time, so I'd like to only do this once per day/on start up.

我目前在想-是否可以每天自动重新部署一次应用程序或自动重新启动实例?我应该采取其他方法吗?

I'm currently wondering - is there a way to auto-redeploy the App once a day or automatically restart the instances? Is there a different way I should be going about this?

(注意:我现在暂时希望使用Google App引擎.)

(Note: I would prefer to stick with Google App engine for now.)

推荐答案

听起来您应该每天部署新版本的应用程序,然后在将流量迁移到新实例之前对其进行预热.这是基于以下假设:应用程序的初始启动速度很慢,因此无法加载该新模型,因此您无法中断正在运行的版本,因为这会中断您的流量.

It sounds like you should be deploying a new version of your app daily, and then warming the new instance before migrating traffic to it. This is with the assumption that initial start up is slow for your app to load this new model so you can't interrupt the running version because it will disrupt your traffic at that time.

要部署版本,请遵循官方指南此处,然后使用指南此处进行预热和迁移流量.

To deploy versions, follow the official guide here and then to warm up and migrate traffic use the guide here.

要自动执行此过程,您可以使用Admin API-问题将是如何将模型获取到新版本的特定位置.我建议为模型使用相同的文件名,以使您的实际代码在每个版本中保持一致.这样,您应该能够每天构建该目录并以编程方式使用新版本部署应用程序-但是这取决于设置的其余部分以及过程的其他部分如何存储和自动化.

To automate this process you can use the Admin API -- the question will be how you get the model to a specific location for the new version. I would recommend using same file name for the model so that your actual code stays the same consistently per version. With that, you should be able to build that directory and deploy the app with the new version programmatically every day -- but it depends on the rest of your setup and how you are storing and automating any other part of the process.

这篇关于Google App Engine:每天自动重新部署一次以更新机器学习模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆