Caffe2 MNIST tutorial: 2 problems that I met

1. When running this line of code: data_uint8, label = model.TensorProtosDBInput( [], ["data_uint8", "label"], batch_size=batch_size, db=db, db_type=db_type)We have :AttributeError: 'module' object has no attribute 'db_input'This c
摘要由CSDN通过智能技术生成

1. When running this line of code:

 data_uint8, label = model.TensorProtosDBInput(
        [], ["data_uint8", "label"], batch_size=batch_size,
        db=db, db_type=db_type)

We have :

AttributeError: 'module' object has no attribute 'db_input'

This change is not updated in the pre-built binary which conda install caffe2 gets.

https://github.com/ttumiel/pytorch/commit/cf5c587d78ff8805b248451feafd693daf3eea4e

  • Solution
    • a) build from source, that's updated
    • b) manually change caffe2/python/model_helper.py, as instructed in the document above

2. Problem: 

When running this line of code:

# Create the model helper for the train model
train_model = model_helper.ModelHelper(name="mnist_train", arg_scope=arg_scope)

we have:

RuntimeError: [enforce fail at db.h:196] db_. Cannot find db implementation of type lmdb (while trying to open test)
Error from operator:
output: "dbreader_test" name: "" type: "CreateDB" arg { name: "db" s: "test" } arg { name: "db_type" s: "lmdb" }frame #0: c10::ThrowEnforceNotMet(char const
, int, char const
, std::string const&, void const
) + 0x59 (0x2b87258a9479 in /home/hongy0a/condaenv/anaconda3/envs/mustwork36/lib/python3.6/site-packages/caffe2/python/../../torch/lib/libc10.so)

  • Solution:

reference: https://github.com/facebookarchive/caffe2/issues/1074

Need to change these lines of Cmake_Cache.txt


//Path to a file.
LMDB_INCLUDE_DIR:PATH=/Users/your_username/anaconda/envs/ml/include/

//Path to a library.
LMDB_LIBRARIES:FILEPATH=/Users/your_username/anaconda/envs/ml/lib/liblmdb.so

 

And then build pytorch(caffe2 has been merged into pytorch and now build pytorch automatically works for Caffe2) with this command:

 

USE_LMDB = ON python setup.py install

Problem solved.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值