hackingmaterials / pv-vision

Image analysis tool for solar modules, assisted by deep learning.
BSD 3-Clause "New" or "Revised" License
35 stars 8 forks source link

Model is not loaded when cpu is used #11

Closed smttsp closed 5 months ago

smttsp commented 7 months ago

https://github.com/hackingmaterials/pv-vision/blob/5ffdd6f02ab045cbfcd48390094ff9b50f906c45/pv_vision/nn/modelhandler.py#L344

This code fails when the device is cpu. It should be updated as below

        self.model.load_state_dict(
            torch.load(path, map_location=torch.device(self.device))
        )
X-Chen97 commented 7 months ago

Hello! Thank you for pointing this out. If you are loading my model weights that were pretrained on GPU on a CPU device, your correction is necessary. I will update the codes.

smttsp commented 7 months ago

@X-Chen97

cool. thank you!

yahyaozturk commented 6 months ago

@smttsp thank you for the fix, I faced the same problem and the model works now.

X-Chen97 commented 5 months ago

fixed