Skip to content

Pretraining weights #1085

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
sunshiding opened this issue Nov 29, 2021 · 4 comments
Closed

Pretraining weights #1085

sunshiding opened this issue Nov 29, 2021 · 4 comments
Assignees

Comments

@sunshiding
Copy link

Hello, when using pre-training weights, do I need to change "pretrained='open-mmlab://resnet50_v1c" to "pretrained='https://download.openmmlab.com/pretrain/third_party/resnet50_v1c-2cccc1ad.pth" to automatically load the weights?

If I do not make changes, the model weights will not be downloaded automatically?

@MengzhangLI
Copy link
Contributor

MengzhangLI commented Nov 29, 2021

Hi, thanks for your feedback. It is very terrible.

Could you check your training log to see whether init_cfg or pretrained keys exist?

Maybe you can attach your training log here to help us check whether pretrained is loaded.

Also, please fill out the error reports, e.g. mmcv and mmsegmentation versions.

Thank you very much!

@MengzhangLI MengzhangLI self-assigned this Nov 29, 2021
@cmFighting
Copy link

cmFighting commented Dec 1, 2021

Hello, I also encountered this problem. I found that the pre-trained model of the backbone network is not automatically loaded. This is the original training log. It can be found that although the parameters are updated to init_cfg, the pre-trained model is not actually loaded .

2021-12-01 10:25:10,157 - mmseg - INFO - Loaded 28000 images
/home/chenming/scm/code/st_seg/fffff/mmsegmentation-0.18.0/mmseg/models/backbones/resnet.py:432: UserWarning: DeprecationWarning: pretrained is a deprecated, please use "init_cfg" instead
  warnings.warn('DeprecationWarning: pretrained is a deprecated, '
/home/chenming/miniconda3/envs/k_net/lib/python3.7/site-packages/mmcv/utils/misc.py:324: UserWarning: "dropout" is deprecated in `FFN.__init__`, please use "ffn_drop" instead
  f'"{src_arg_name}" is deprecated in '

But when I add the following two lines at the end of resnet's init() function, the pre-trained model can be loaded correctly.

        logger = get_root_logger()
        load_checkpoint(self, pretrained, strict=False, logger=logger)

log is:

2021-12-01 10:25:51,036 - mmseg - INFO - Loaded 28000 images
/home/chenming/scm/code/st_seg/fffff/mmsegmentation-0.18.0/mmseg/models/backbones/resnet.py:432: UserWarning: DeprecationWarning: pretrained is a deprecated, please use "init_cfg" instead
  warnings.warn('DeprecationWarning: pretrained is a deprecated, '
2021-12-01 10:25:51,147 - mmseg - INFO - Use load_from_openmmlab loader
2021-12-01 10:25:51,537 - mmseg - WARNING - The model and loaded state dict do not match exactly

unexpected key in source state_dict: fc.weight, fc.bias

/home/chenming/miniconda3/envs/k_net/lib/python3.7/site-packages/mmcv/utils/misc.py:324: UserWarning: "dropout" is deprecated in `FFN.__init__`, please use "ffn_drop" instead
  f'"{src_arg_name}" is deprecated in '

@MengzhangLI
Copy link
Contributor

Hi, sorry to see that. Let us fix your problem ASAP.

I think it may be caused by our code upgrade from pretrained to init_cfg.

(1) Which version of MMCV and MMSegmentation you use?

(2) Could you try to update MMCV and MMSegmentation to latest version (which may also need to be compatible for your server) to see whether this problem still exist?

Thanks!

@sunshiding
Copy link
Author

Hi, sorry to see that. Let us fix your problem ASAP.

I think it may be caused by our code upgrade from pretrained to init_cfg.

(1) Which version of MMCV and MMSegmentation you use?

(2) Could you try to update MMCV and MMSegmentation to latest version (which may also need to be compatible for your server) to see whether this problem still exist?

Thanks!

Thank you very much for your patience, the problem has been solved perfectly.

aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this issue Mar 27, 2023
…nes (open-mmlab#1085)

* add enable sequential cpu offloading to other stable diffusion pipelines

* trigger ci

* fix styling

* interpolate before converting to device to avoid breking when cpu_offload is enabled with fp16

Co-authored-by: Pedro Gengo  <pedro.gabriel.lourenco@hotmail.com>

* style again I need to stop forgething this thing

* fix inpainting bug that could cause device misalignment

Co-authored-by: Pedro Gengo  <pedro.gabriel.lourenco@hotmail.com>

* Apply suggestions from code review

Co-authored-by: Pedro Gengo  <pedro.gabriel.lourenco@hotmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
wjkim81 pushed a commit to wjkim81/mmsegmentation that referenced this issue Dec 3, 2023
* [Doc] Merge doc folder (open-mmlab#1083)

* merge folders of en/zh_cn docs

* fix merge_docs.sh

* fix index.rst

* fix merge_docs.sh

* use shared menu

* fix merge_docs

* fix zh_cn doc link

* sort readme papers

* add voxelpose and cmu panoptic dataset into docs

* update readme

* Revert "[Doc] Merge doc folder (open-mmlab#1083)"

This reverts commit 31e40a8a8484cb52f70448703396712afb6efc06.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants