Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wupeng1989 opened this issue Jul 22, 2023 · 1 comment

Comments

@wupeng1989
Copy link

wupeng1989 commented Jul 22, 2023

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

    model.load_state_dict(state_dict)

`

@HobbitLong
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants