open-mmlab / mmselfsup

OpenMMLab Self-Supervised Learning Toolbox and Benchmark
https://mmselfsup.readthedocs.io/en/latest/
Apache License 2.0
3.14k stars 429 forks source link

Converting mmengine weight for models to pytorch state dicts? #783

Open ayushnangia opened 1 month ago

ayushnangia commented 1 month ago

I'm working on using some pretrained models from mmselfsup in a separate PyTorch project. However, I'm having trouble converting the mmengine-formatted weights to standard PyTorch state dicts.

Specifically:

Is there a recommended way to convert mmengine model weights to PyTorch state dicts?

Are there any gotchas or key differences to be aware of in the weight formats?

Is there existing utility code in mmselfsup or a related library to handle this conversion?

If not, would it be helpful to add such a conversion utility to mmselfsup?