-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Describe the bug
Trying to load DynUNet weights from a PyTorch lightning checkpoint via load_from_checkpoint does not work, after having updated MONAI from version 1.2 to 1.3.
To Reproduce
Steps to reproduce the behavior:
- Define
class TimeAsSpatialModule(pl.LightningModule): - Train
- Checkpoints are saved automatically
pip install --upgrade monai- Execute
TimeAsSpatialModule.load_from_checkpoint(...) - Error
RuntimeError: Error(s) in loading state_dict for TimeAsSpatialModule:
Missing key(s) in state_dict: "loss_function.dice.class_weight", "loss_function.binary_cross_entropy.pos_weight".
Expected behavior
Model is loaded without issues.
Environment
================================
Printing MONAI config...
================================
MONAI version: 1.3.0
Numpy version: 1.24.1
Pytorch version: 2.0.1+cu117
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: 865972f7a791bf7b42efbcd87c8402bd865b329e
MONAI __file__: C:\Dev\Kitware\python\.venv\Lib\site-packages\monai\__init__.py
Optional dependencies:
Pytorch Ignite version: NOT INSTALLED or UNKNOWN VERSION.
ITK version: 5.3.0
Nibabel version: 5.1.0
scikit-image version: NOT INSTALLED or UNKNOWN VERSION.
scipy version: 1.11.2
Pillow version: 9.3.0
Tensorboard version: 2.14.0
gdown version: NOT INSTALLED or UNKNOWN VERSION.
TorchVision version: 0.15.2+cu117
tqdm version: 4.66.1
lmdb version: NOT INSTALLED or UNKNOWN VERSION.
psutil version: 5.9.5
pandas version: 2.1.0
einops version: NOT INSTALLED or UNKNOWN VERSION.
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: NOT INSTALLED or UNKNOWN VERSION.
pynrrd version: NOT INSTALLED or UNKNOWN VERSION.
clearml version: NOT INSTALLED or UNKNOWN VERSION.
For details about installing the optional dependencies, please visit:
https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies
================================
Printing system config...
================================
System: Windows
Win32 version: ('10', '10.0.22621', 'SP0', 'Multiprocessor Free')
Win32 edition: Professional
Platform: Windows-10-10.0.22621-SP0
Processor: AMD64 Family 25 Model 33 Stepping 0, AuthenticAMD
Machine: AMD64
Python version: 3.11.0
Process name: python.exe
Command: ['C:\\Program Files\\Python311\\python.exe', '-c', 'import monai; monai.config.print_debug_info()']
Open files: [popenfile(path='C:\\Windows\\System32\\en-US\\kernel32.dll.mui', fd=-1), popenfile(path='C:\\Windows\\System32\\en-US\\tzres.dll.mui', fd=-1), popenfile(path='C:\\Windows\\System32\\en-US\\KernelBase.dll.mui', fd=-1)]
Num physical CPUs: 12
Num logical CPUs: 24
Num usable CPUs: 24
CPU usage (%): [64.7, 89.1, 59.6, 74.1, 71.1, 62.7, 66.0, 66.2, 65.7, 64.7, 59.2, 65.9, 61.5, 60.7, 58.4, 54.8, 50.4, 52.6, 54.9, 56.0, 50.2, 52.9, 52.1, 50.7]
CPU freq. (MHz): 3001
Load avg. in last 1, 5, 15 mins (%): [0.0, 0.0, 0.0]
Disk usage (%): 82.9
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 63.9
Available memory (GB): 24.3
Used memory (GB): 39.6
================================
Printing GPU config...
================================
Num GPUs: 1
Has CUDA: True
CUDA version: 11.7
cuDNN enabled: True
NVIDIA_TF32_OVERRIDE: None
TORCH_ALLOW_TF32_CUBLAS_OVERRIDE: None
cuDNN version: 8500
Current device: 0
Library compiled for CUDA architectures: ['sm_37', 'sm_50', 'sm_60', 'sm_61', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'compute_37']
GPU 0 Name: NVIDIA GeForce RTX 3090
GPU 0 Is integrated: False
GPU 0 Is multi GPU board: False
GPU 0 Multi processor count: 82
GPU 0 Total memory (GB): 24.0
GPU 0 CUDA capability (maj.min): 8.6
Metadata
Metadata
Assignees
Labels
No labels