Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Trouble loading weights file #149

Closed
peterdudfield opened this issue Jul 25, 2022 · 3 comments
Closed

Trouble loading weights file #149

peterdudfield opened this issue Jul 25, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@peterdudfield
Copy link
Contributor

file='epoch=78-step=323584.ckpt'

need to use python 3.10

error

model = FullModel.load_from_checkpoint('Documents/Github/nowcasting_forecast/epoch=78-step=323584.ckpt')
INFO:power_perceiver.pytorch_modules.satellite_predictor:kwargs for XResUNet = {'img_size': (128, 256), 'n_in': 15, 'n_out': 25, 'pretrained': False, 'blur_final': True, 'self_attention': True, 'last_cross': True, 'bottle': False}
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pytorch_lightning/core/saving.py", line 161, in load_from_checkpoint
    model = cls._load_model_state(checkpoint, strict=strict, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pytorch_lightning/core/saving.py", line 203, in _load_model_state
    model = cls(**_cls_kwargs)
  File "<string>", line 13, in __init__
  File "/Users/peterdudfield/Documents/Github/power_perceiver/power_perceiver/experiments/exp_027_longer_forecasts.py", line 626, in __post_init__
    self.satellite_predictor = SatellitePredictor()
  File "<string>", line 12, in __init__
  File "/Users/peterdudfield/Documents/Github/power_perceiver/power_perceiver/experiments/exp_027_longer_forecasts.py", line 266, in __post_init__
    self.satellite_predictor = XResUNet(
  File "/Users/peterdudfield/Documents/Github/power_perceiver/power_perceiver/pytorch_modules/satellite_predictor.py", line 31, in __init__
    self.model = create_unet_model(arch=arch, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fastai/vision/learner.py", line 243, in create_unet_model
    model = arch(pretrained)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fastai/vision/models/xresnet.py", line 99, in xse_resnext50
    def xse_resnext50(n_out=1000, pretrained=False, **kwargs):  return XResNet(SEResNeXtBlock, 4, g1, n_out=n_out, **se_kwargs2, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fastai/vision/models/xresnet.py", line 47, in __init__
    nn.Linear(block_szs[-1]*expansion, n_out),
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 96, in __init__
    self.weight = Parameter(torch.empty((out_features, in_features), **factory_kwargs))
TypeError: empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=NoneType), but expected one of:
 * (tuple of ints size, *, tuple of names names, torch.memory_format memory_format, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)
 * (tuple of ints size, *, torch.memory_format memory_format, Tensor out, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)
@peterdudfield peterdudfield added the bug Something isn't working label Jul 25, 2022
@peterdudfield
Copy link
Contributor Author

related to #132

@peterdudfield
Copy link
Contributor Author

Added a bug report on fastai - fastai/fastai#3745

@peterdudfield
Copy link
Contributor Author

I can now load it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

No branches or pull requests

1 participant