Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

load pretrained worker weights #88

Open
MittalShruti opened this issue Feb 23, 2020 · 2 comments
Open

load pretrained worker weights #88

MittalShruti opened this issue Feb 23, 2020 · 2 comments

Comments

@MittalShruti
Copy link

Hi,

I am trying to load the pretrained workers (from #85)

Model that I am using:

from pase.models.pase import *

ps = pase(frontend=None,
      frontend_cfg=frontend_cfg,
      minions_cfg=minions_cfg,
      cls_lst=cls_lst, regr_lst=regr_lst,
      pretrained_ckpt=None,
      name='Pase_base')

To import worker weight (for 1 worker):

for m in ps.classification_workers:
  m.load_pretrained(ckpt_path='/workers/weights_M-mi-M-mi-721872.ckpt', load_last=True, verbose=True)
  break

Error I am getting:

Current Model keys:  5
Current Pt keys:  4
Loading matching keys:  ['minion.blocks.0.W.bias', 'minion.blocks.0.act.weight', 'minion.W.weight', 'minion.W.bias']
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-35-3cc20e1ab527> in <module>()
      1 for m in ps.classification_workers:
----> 2   m.load_pretrained(ckpt_path='/content/workers/weights_M-mi-M-mi-721872.ckpt', load_last=True, verbose=True)
      3   break

1 frames
/content/pase/models/modules.py in load_pretrained_ckpt(self, ckpt_file, load_last, load_opt, verbose)
    289             print('Loading matching keys: ', list(pt_dict.keys()))
    290         if len(pt_dict.keys()) != len(model_dict.keys()):
--> 291             raise ValueError('WARNING: LOADING DIFFERENT NUM OF KEYS')
    292             print('WARNING: LOADING DIFFERENT NUM OF KEYS')
    293         # overwrite entries in existing dict

ValueError: WARNING: LOADING DIFFERENT NUM OF KEYS
@AshishMittal
Copy link

AshishMittal commented May 2, 2020

Hi, I am getting a similar error whilst loading the pretrained worker weights.

classification worker: mi
Current Model keys:  5
Current Model keys:  ['minion.blocks.0.W.weight', 'minion.blocks.0.W.bias', 'minion.blocks.0.act.weight', 'minion.W.weight', 'minion.W.bias']
Current Pt keys:  4
Loading matching keys:  ['minion.blocks.0.W.bias', 'minion.blocks.0.act.weight', 'minion.W.weight', 'minion.W.bias']

I tried to load other workers as well, it looks like the first key minion.blocks.0.W.weight has a different shape in the pretrained workers.
In the model, shape of minion.blocks.0.W.weight = (256, 512, 1)
In the pretrained worker the shape of minion.blocks.0.W.weight = (256, 1024, 1)

I'd appreciate any help on this.

Regards,
Ashish

@uuwz
Copy link

uuwz commented Sep 7, 2023

Hello! I have been replicating this experiment recently, but during the process of making the dataset config file, do I know where to obtain these files. (-- train_scp data/LibriSpeed/libri_tr.scp -- test_scp data/LibriSpeed/libri_te.scp\

--Libri_ Dict data/LibriSpeed/Libri_ Dict. npy). I look forward to your reply very much. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants