santi-pdp/pase

load pretrained worker weights

MittalShruti opened this issue · 2 comments

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

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 commented

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.