NightShade99 / Self-Supervised-Vision

Implementations of some self-supervised methods for pre-training vision models
19 stars 3 forks source link

linear_evaluation #4

Open Fancy-78 opened 1 year ago

Fancy-78 commented 1 year ago

Hello, I encountered this problem after completing the training process, I wonder if the author has this problem and how to fix this problem, thanks.

Traceback (most recent call last): File "main.py", line 52, in model.train() File "/home/Self-Supervised-Vision/models/relic.py", line 211, in train self.perform_linear_eval() File "/home/Self-Supervised-Vision/models/relic.py", line 171, in perform_linear_eval test_linear_acc = eval_utils.linear_evaluation( File "/home/Self-Supervised-Vision/utils/eval_utils.py", line 52, in linear_evaluation fvecs, labels = batch["features"].to(device), batch["label"].to(device) TypeError: 'DataLoader' object is not subscriptable

NightShade99 commented 4 weeks ago

Hey, sorry for the extremely delayed response 😓. I had forgotten about this repo a couple years ago; came back to it today looking for a code snippet and noticed your issue.

I hadn't tested the linear probing code for any algorithm, hence I would fully expect it to be buggy (that's why you won't find linear probing results on the README either). I had a quick look at the code though, and I'm not sure why this error could be occurring.

Unfortunately, torch and torchvision versions used in the code are outdated and some APIs seem to have changed. I'm not able to test my code anymore, so it would be hard for me to find a fix. Nonetheless, I suppose it's too late to provide a solution now 😔.

If for some reason you still need to get this to work, let me know and I'll spend more time on this. Sorry again!