Skip to content

Comments

Fix cpu use for fastai2#5

Open
gisellegran wants to merge 1 commit intoAuroraLHT:masterfrom
gisellegran:fix-cpu-usage
Open

Fix cpu use for fastai2#5
gisellegran wants to merge 1 commit intoAuroraLHT:masterfrom
gisellegran:fix-cpu-usage

Conversation

@gisellegran
Copy link
Contributor

This handles fix for the following error which occurs when trying to run CRYSPNet predict.py on machine with no cuda.

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False.

Cause of the error:
'defaults.device = torch.device('cpu')' is for fastai and does not work with fastai2.

Solution
Use boolean variable 'cpu' to indicate if cpu should be used. Pass this as input when loading models since these can already take 'cpu' as a parameter.

Note:
This solution was not tested on a CUDA machine, i.e. the use of CUDA was not tested.

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

Successfully merging this pull request may close these issues.

1 participant