SupContrast icon indicating copy to clipboard operation
SupContrast copied to clipboard

file “main_linear.py”, line103, set_model(opt) ,if torch.cuda.is_available() is false, why model will not load_state_dict(state_dict)

Open wupeng1989 opened this issue 2 years ago • 1 comments

` if torch.cuda.is_available(): ......... model = model.cuda() classifier = classifier.cuda() criterion = criterion.cuda() cudnn.benchmark = True

    model.load_state_dict(state_dict)

`

wupeng1989 avatar Jul 22 '23 08:07 wupeng1989

Thanks for pointing it out. you are right, that's bad engineering Habit. I was assuming people using this code will had GPU.

Added the else error message.

HobbitLong avatar Aug 13 '23 19:08 HobbitLong