将.tf以及可能的.txt文件依赖项上传到Acumos

时间:2018-08-03 23:09:13

标签: acumos

我目前正在为acumos AI挑战项目,并且我正在创建一个简单的Tensorflow程序以尝试上传。我遇到的问题是acumos支持使用Requirements使用Python依赖项,但是我还没有找到添加.tf文件(用于预训练的tensorflow模型)或.txt文件(用于数据)的方法。

该站点允许我上传我的模型而无需添加我的预训练过的tensorflow模型作为依赖项,但是当我在另一台计算机上的docker上运行它时,出现此错误...

[2018-08-03 21:48:58 +0000] [11] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "runner.py", line 102, in load
    return build_app(self.parsed_args)
  File "runner.py", line 115, in build_app
    model = load_model(pargs.modeldir)  # refers to ./model dir in pwd. generated by helper script also in this dir
  File "/usr/local/lib/python3.6/site-packages/acumos/wrapped.py", line 42, in load_model
    model = _load_model(f)
  File "/usr/local/lib/python3.6/site-packages/dill/dill.py", line 288, in load
    obj = pik.load()
  File "/usr/local/lib/python3.6/site-packages/dill/dill.py", line 546, in _load_type
    return _reverse_typemap[name]
KeyError: 'ClassType'
[2018-08-03 21:48:58 +0000] [11] [INFO] Worker exiting (pid: 11)
[2018-08-03 21:48:58 +0000] [10] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "runner.py", line 102, in load
    return build_app(self.parsed_args)
  File "runner.py", line 115, in build_app
    model = load_model(pargs.modeldir)  # refers to ./model dir in pwd. generated by helper script also in this dir
  File "/usr/local/lib/python3.6/site-packages/acumos/wrapped.py", line 42, in load_model
    model = _load_model(f)
  File "/usr/local/lib/python3.6/site-packages/dill/dill.py", line 288, in load
    obj = pik.load()
  File "/usr/local/lib/python3.6/site-packages/dill/dill.py", line 546, in _load_type
    return _reverse_typemap[name]
KeyError: 'ClassType'
[2018-08-03 21:48:58 +0000] [10] [INFO] Worker exiting (pid: 10)
[2018-08-03 21:48:58 +0000] [1] [INFO] Shutting down: Master
[2018-08-03 21:48:58 +0000] [1] [INFO] Reason: Worker failed to boot.

仅是我的猜测,此错误是由于缺少.tf文件的内省引起的,但是我对此可能完全错了。我还应该提到,我的docker容器对于我构建的不需要外部文件的模型(例如,简单的a + b = c类型模型)可以很好地工作。

任何对此的帮助将是巨大的!谢谢!

1 个答案:

答案 0 :(得分:0)

Acumos不直接支持添加任意文件类型依赖项,不幸的是,它不会自动推断它们。那里有Python依赖项的Requirements机制。还有其他方法可以在不使用外部文件的情况下构建经过预训练的Tensorflow模型。请参阅Acumos开源存储库(https://gerrit.acumos.org)中的某些模型。如果在转储或推送之前将模型(以及任何外部文件的内容,例如.txt)加载到内存中,Python Acumos Client将正确地对其进行序列化,这就是典型的用法模式。在此处查看Tensorflow示例:https://github.com/acumos/acumos-python-client/blob/master/examples/tensorflow_example.py。您可以仅反序列化Tensorflow模型,而不是从头开始构建模型。然后,该示例的其余部分仍然适用。 。 您可能要尝试的另一件事是在包含所需文件的子目录中创建一个包,并使用标准的“需求”机制来创建该包。我相信Acumos客户端在创建表示模型的存档时,只是打包了package目录中的所有内容。但是请先尝试其他建议。