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.