Conversation
…en(filename,'rb') and likewise for 'w' to 'wb'
…py, output is the same. Add a few more unicode checks. Tested with caffe2 commit https://github.com/caffe2/caffe2/tree/1898ed34e8d53f68a9079bd615697b7ec11dfa62
…ecoding in python 2 but doesnt in python 3)
@jasonbunk Thanks, it is cool and useful for me ,but i have some questions, Should i install caffe2 with python3?Thank you for your reply |
Yep. Just made this gist to build the latest caffe2 from source, in a virtual environment, assuming OpenCV 3.2+ is already installed. It doesn't need sudo privileges, unless you need to install the caffe2 prerequisites (build-essential, git, etc.). https://gist.github.com/jasonbunk/9d61a49cc8402f32b1dabcf7b85bdcc6 Not sure if it's exporting |
I meet another error when use this PR and use 2to3 to run detectron under python3. the "import Queue" in lib/utils/coordinator.py would be refactor as "import queue", which is duplicate with the variable name in functions. |
Instead of using |
I started this pull request to identify some of the minimal changes holding back using Detectron with Python 3. There are plenty of small things, like renaming |
That's fair, this is definitely an easier and self-contained merge (which I hope will be accepted soon). Also, note that I'd recommend not renaming cPickle to pickle. Instead, I'd replace |
I am using python 3, and have made the changes you mentioned. When I run the command,
|
@ir413 & @rbgirshick Do you think that if this PR is rebased & modified according to the current master you will consider to merge it ? There are 11 upvotes on it so it seems there is great support from the community to bring Python 3 support directly in the official repo. |
@gadcam we look forward to supporting Python 3, but until recently were blocked by a boring internal issue on our end. Updating this PR may help speed things up, but I cannot guarantee that this exact PR will be merged. Given the broad set of changes, we may incorporate some of the edits here as well as make other changes that we decide are necessary. |
…nger a keyword in python3)
…ts in the tests/ folder, since some like test_restore_checkpoint require some setup)
@rbgirshick Hi, any progress on this issue please? |
@rbgirshick Why not merging this one ? md5sum = urllib.request.urlopen(url_md5sum).read().strip() to md5sum = urllib.request.urlopen(url_md5sum).read().strip().decode('utf-8') @jasonbunk could you include this fix in your awesome PR ? |
It needs significant testing and we just haven't had time for that. Sorry for the slow progress and thanks for your patience. @ir413 is planning to look into py3 support, so hopefully we will resolve this soon. |
so ,hava someone build detectron(https://github.com/jasonbunk/Detectron) and caffe2 with python3 sucess? and works well? |
@JaosonMa I used this patch only for inference and it works well! |
@gadcam @jasonbunk terminate called after throwing an instance of 'caffe2::EnforceNotMet' forgot this Q: it need 2 gpus ,but i only hava one ,so after change it , the test passed! |
finally , it sucess!!! |
Python 3 support required a significant amount of testing and finding corner cases involving serializing json and pickle files. We've landed support in commits 101-104. |
This leaves the code as Python 2, but sets up the ability to use
2to3
for porting to Python 3 by fixing issues that2to3
can't fix by itself. The messiest parts are inlib/core/config.py
and the differences between data typesbytes
,str
, andunicode
. Notes on the porting process are recorded here: PYTHON2_TO_PYTHON3_NOTES.md. Tests intests/
should pass for both Python 2.7 and 3.5, as well astools/infer_simple.py
.