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

Model Loading faliure when running on CPU #4

Open
WGraterol64 opened this issue Mar 28, 2021 · 0 comments
Open

Model Loading faliure when running on CPU #4

WGraterol64 opened this issue Mar 28, 2021 · 0 comments

Comments

@WGraterol64
Copy link

WGraterol64 commented Mar 28, 2021

On eval.py whenever your not running on a GPU accelerated environment you get an error on line 108 of eval.py, i.e, whenever you run model.load_state_dict(torch.load(modelPath)). The solution for this issue is to add the parameter map_location=torch.device('cpu') on the call if you're running on CPU.

The soluition code snippet would be

# loading model...
print('Loading model from: {}'.format(modelPath))
if args.cuda :
    model.load_state_dict(torch.load(modelPath))
else :
    model.load_state_dict(torch.load(modelPath, map_location=torch.device('cpu')))
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

1 participant