metric-learning-divide-and-conquer icon indicating copy to clipboard operation
metric-learning-divide-and-conquer copied to clipboard

correction for the code

Open SidraHanif180 opened this issue 4 years ago • 3 comments

Hi,

Thanks for the code.

Lately, I worked with the code and found out that there are two slights errors in the code, my observations are for python version 3.7.

  1. In function lib/data/loader/util.py at Line 54, batch_size =-1 should be batch_size =-1.

  2. function lib/data/loader/util.py at Line 94, yield b, dls[i].dataset should be yield b, dls[i]._dataset.

These may be tying error or just because of the different python versions, but the code worked for me after fixing them.

SidraHanif180 avatar Dec 24 '19 22:12 SidraHanif180

I fixed the errors in a branch here

https://github.com/theRealSuperMario/metric-learning-divide-and-conquer/tree/pytorch14

I also added which pytorch version and Faissversion have to work together to get it going. It turns out that the Faissinterface has changed since the release which throws an error when running the code. The error is rooted here

https://github.com/CompVis/metric-learning-divide-and-conquer/blob/1766c2cffe1075692657898d2086af4bc9d92929/lib/faissext.py#L132

The new interface does not have Clustering.obj any more, but rather Kmeans.obj. Since this would be a quite big refactoring, I found it easiest to just downgrade to faiss==1.5.2 which binds the cuda version to 10.0 and thus pytorch=1.4.0.

To drive this point home, one has to

conda install pytorch torchvision faiss-gpu==1.5.2 cudatoolkit=10.0 -c pytorch

I can make a PR if interested.

theRealSuperMario avatar Jul 03 '20 14:07 theRealSuperMario

Thanks @theRealSuperMario ! Did you use python 3.7 ? Have you tested the training?

asanakoy avatar Jul 03 '20 14:07 asanakoy

  • [x] python3.7

Training is running

image

theRealSuperMario avatar Jul 03 '20 14:07 theRealSuperMario