fix a model inference problem on cpu #502
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
keypoint.ipynb
on a cpu-machine (macbook). And I got the following problem:map_location=torch.device(device)
option toload
function but it turns out one of the convolutions used in the model was not designed for 'half' precision when running on cpu and I got the following error.RuntimeError: "slow_conv2d_cpu" not implemented for 'Half'
half
precision option from the notebook and added_ = model.float().eval()
to run it on both cpu and gpu machines.I suppose a lot of folks like me will try it on cpu for demo test.
I have tested the fixed code on both cpu and gpu in google colab and the link is here:
https://colab.research.google.com/drive/1kqdVq-n8I0EcPRA2g7YYK70rArUmy6Ai?usp=sharing