无法在Caffe2中打开lmdb数据库文件

时间:2018-10-07 06:49:03

标签: pytorch caffe2

我从Ubuntu的源代码安装了Caffe2。 我不使用Anaconda,而我的python是python2。

which python给了我

/usr/bin/python

我可以在python中导入lmdb。 我可以从page

运行教程

我在测试示例之一时遇到的问题是“无法打开lmdb文件”。

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-19-c9a97f268658> in <module>()
      1 # The parameter initialization network only needs to be run once.
      2 # Now all the parameter blobs are initialized in the workspace.
----> 3 workspace.RunNetOnce(train_model.param_init_net)
      4 
      5 # Creating an actual network as a C++ object in memory.

/home/pytorch/build/caffe2/python/workspace.py in RunNetOnce(net)
    199         C.Workspace.current._last_failed_op_net_position,
    200         GetNetName(net),
--> 201         StringifyProto(net),
    202     )
    203 

/home/pytorch/build/caffe2/python/workspace.py in CallWithExceptionIntercept(func, op_id_fetcher, net_name, *args, **kwargs)
    178 def CallWithExceptionIntercept(func, op_id_fetcher, net_name, *args, **kwargs):
    179     try:
--> 180         return func(*args, **kwargs)
    181     except Exception:
    182         op_id = op_id_fetcher()

RuntimeError: [enforce fail at db.h:190] db_. Cannot open db: /home/caffe2_notebooks/tutorial_data/mnist/mnist-train-nchw-lmdb of type lmdbError from operator: 
output: "dbreader_/home/caffe2_notebooks/tutorial_data/mnist/mnist-train-nchw-lmdb" name: "" type: "CreateDB" arg { name: "db_type" s: "lmdb" } arg { name: "db" s: "/home/caffe2_notebooks/tutorial_data/mnist/mnist-train-nchw-lmdb" }

我拥有所有文件,并且具有读取权限。

我用USE_LMDB=ON编译了pytorch。

我看到了相同的问题,但是找不到他们如何解决问题。 我的笔记本电脑系统体积很小,只有Ubuntu 16.4, with Nvidia Cuda GeForce GT 750M,所以型号很旧。

然后我在一页上找到了。他们通过更改lbdb.cc中的LMDB_MAP_SIZE解决了该问题。所以我改用4G,但仍然有错误。

constexpr size_t LMDB_MAP_SIZE = 4294967296;//4gb 1099511627776;  // 1 TB

问题出在这一行

workspace.RunNetOnce(train_model.param_init_net)

如何解决该问题?

0 个答案:

没有答案