首页 > 解决方案 > 无法从 Heroku 项目中的 AWS S3 读取文件

问题描述

我已经在 Heroku 上部署了我的 python 电报机器人。机器人必须使用 Nemo ML 模型,因为我的模型太大了我通过这条指令将它存储在 AWS S3 上

我尝试通过 AWS 的链接读取模型:

import nemo.collections.asr as nemo_asr
quartznet=nemo_asr.models.EncDecCTCModel.restore_from(restore_path="http://s3.amazonaws.com/dataforgolosbot/QuartzNet15x5_golos.nemo")

但我收到了这个错误:

2021-07-14T14:41:02.019040+00:00 app[worker.1]: Traceback (most recent call last):
2021-07-14T14:41:02.019051+00:00 app[worker.1]: File "/app/main.py", line 4, in <module>
2021-07-14T14:41:02.019209+00:00 app[worker.1]: quartznet = nemo_asr.models.EncDecCTCModel.restore_from(restore_path="http://s3.amazonaws.com/dataforgolosbot/QuartzNet15x5_golos.nemo")
2021-07-14T14:41:02.019215+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/nemo/core/classes/modelPT.py", line 474, in restore_from
2021-07-14T14:41:02.019469+00:00 app[worker.1]: raise FileNotFoundError(f"Can't find {restore_path}")
2021-07-14T14:41:02.019528+00:00 app[worker.1]: FileNotFoundError: Can't find http://s3.amazonaws.com/dataforgolosbot/QuartzNet15x5_golos.nemo
2021-07-14T14:41:03.220793+00:00 heroku[worker.1]: Process exited with status 1
2021-07-14T14:41:03.350467+00:00 heroku[worker.1]: State changed from up to crashed

标签: python-3.xamazon-web-servicesamazon-s3heroku

解决方案


推荐阅读