[英]Run Tensorflow 2 prediction on AWS Lambda
I want to run a Tensorflow 2 LinearClassifier on AWS Lambda.我想在 AWS Lambda 上运行 Tensorflow 2 LinearClassifier。 I have a trained LinearClassifier tensorflow model.
我有一个训练有素的线性分类器 tensorflow model。 I want to run only the prediction in AWS Lambda, because of cost efficeny.
由于成本效益,我只想在 AWS Lambda 中运行预测。
Currently I'm not sure how to handle it.目前我不确定如何处理它。
Do you have an idea, how I can get TF 2 Estimation of LinearClassifier running on AWS Lambda?你有什么想法,我怎样才能在 AWS Lambda 上运行 TF 2 Estimation of LinearClassifier?
Normally I think not all of the 1.5 GB Tensorflow modules are used for the simple prediction of an existing model.通常我认为并非所有 1.5 GB Tensorflow 模块都用于对现有 model 进行简单预测。 So is there a possibility to only get the files which are used for running the script?
那么是否有可能只获取用于运行脚本的文件?
I have found possible answers for your question:我为您的问题找到了可能的答案:
For the part: "Clone TensorFlow from the official GitHub repository", we need to force a version of tensorflow because sometimes latest version is not compiling well.对于部分:“从官方 GitHub 存储库中克隆 TensorFlow”,我们需要强制使用 tensorflow 的版本,因为有时最新版本编译不好。
For my case, I want tensorflow v2.3.0, so i modified this line:对于我的情况,我想要 tensorflow v2.3.0,所以我修改了这一行:
git clone https://github.com/tensorflow/tensorflow.git
by经过
git clone --branch v.2.3.0 https://github.com/tensorflow/tensorflow.git
I have modified also at the end, to invoke lambda on AWS:最后我也进行了修改,以在 AWS 上调用 lambda:
sls invoke local -f predict
by经过
sls invoke -f predict
I recommend you to do all the tutorial with the sample model provided to be sure everything is working.我建议您使用提供的示例 model 完成所有教程,以确保一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.