You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @speediedan, thanks for creating this fine-tuning callback!
I want to fine-tune the torchvision.models.segmentation.deeplabv3_resnet50 dataset, which contains batch normalization parameters. As a first step, I would like to fine-tune in a simple two-step approach. Starting with the classification part and continue with the backbone. When I run the attached script finetuning-scheduler issues the following warning:
UserWarning: FinetuningScheduler configured the provided model to have 23 trainable parameters in phase 0 (the initial training phase) but the optimizer has subsequently been initialized with 129 trainable parameters. If you have manually added additional trainable parameters you may want to ensure the manually added new trainable parameters do not collide with the 182 parameters FinetuningScheduler has been scheduled to thaw in the provided schedule.
I think this is caused by freeze_before_training calling freeze which has a parameter train_bn which defaults to True and therefore sets requires_grad to True for every batch normalization parameter.
Downstream the code crashes because of parameters appearing in more than one parameter group (though, not in the attached sample, as the data does not fit the model, but it reproduces the initial bug).
Thanks for taking the time to file the issue @JohannesK14!
I've reproduced the issue, made the appropriate change in a02b864 and added the relevant test to avoid future reversions in this behavior.
The aforementioned commit should be included in either FTS 0.2.4 (if PL releases another patch version of 1.7) or will be in the first version of FTS 0.3 (0.3.0)
Your clear description and attention to detail in the reproduction really accelerated resolution, a model bug report! 🚀 🎉
Thanks again and glad you've found FTS of at a least some utility. Feel free to reach out anytime if you have other issues or want to share your use case. Best of luck with your work!
🐛 Bug
Hi @speediedan, thanks for creating this fine-tuning callback!
I want to fine-tune the torchvision.models.segmentation.deeplabv3_resnet50 dataset, which contains batch normalization parameters. As a first step, I would like to fine-tune in a simple two-step approach. Starting with the classification part and continue with the backbone. When I run the attached script finetuning-scheduler issues the following warning:
UserWarning: FinetuningScheduler configured the provided model to have 23 trainable parameters in phase 0 (the initial training phase) but the optimizer has subsequently been initialized with 129 trainable parameters. If you have manually added additional trainable parameters you may want to ensure the manually added new trainable parameters do not collide with the 182 parameters FinetuningScheduler has been scheduled to thaw in the provided schedule.
I think this is caused by freeze_before_training calling freeze which has a parameter train_bn which defaults to True and therefore sets requires_grad to True for every batch normalization parameter.
Downstream the code crashes because of parameters appearing in more than one parameter group (though, not in the attached sample, as the data does not fit the model, but it reproduces the initial bug).
To Reproduceimport torch
Expected behavior
Call freeze with train_bn=False, to avoid training the batch normalization parameters by default.
Environment
- GPU:
- NVIDIA GeForce RTX 3090
- available: True
- version: 11.3
- finetuning-scheduler: 0.2.3
- numpy: 1.23.3
- pyTorch_debug: False
- pyTorch_version: 1.12.1
- pytorch-lightning: 1.7.7
- tqdm: 4.64.1
- OS: Linux
- architecture:
- 64bit
- ELF
- processor: x86_64
- python: 3.10.6
- version: #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022
Additional context
The text was updated successfully, but these errors were encountered: