NeMo icon indicating copy to clipboard operation
NeMo copied to clipboard

Restoring from pretrained checkpoint is broke for "stt_ua_fastconformer_hybrid_large_pc"

Open taras-sereda opened this issue 5 months ago • 4 comments

Hi folks! I'm trying to restore EncDecHybridRNNTCTCModel from checkpoint trained on Ukrainian

In [4]: from nemo.collections.asr.models import EncDecHybridRNNTCTCBPEModel
In [5]: model = EncDecHybridRNNTCTCBPEModel.from_pretrained("stt_ua_fastconformer_hybrid_large_pc")

model can't be restored because of keyword argument conv_pointwise_type

InstantiationException: Error in call to target 'nemo.collections.asr.modules.conformer_encoder.ConformerEncoder':
TypeError("ConformerEncoder.__init__() got an unexpected keyword argument 'conv_pointwise_type'")

Search through NeMo repository I only found conv_pointwise_type keyword in one PR, and nowhere in the code base, that looks suspicious. Is there any recommendation how one would make that checkpoint compatible?

Env:

  • Nemo version: nemo_toolkit==1.23.0
  • OS: Ubuntu 22.04

taras-sereda avatar Mar 23 '24 18:03 taras-sereda

I figured how to load the parameters, though with the hack.

  1. I obtained model's config by doing this:
ckpt_name = "stt_ua_fastconformer_hybrid_large_pc"
cfg = nemo_asr.models.EncDecHybridRNNTCTCBPEModel.from_pretrained(model_name=ckpt_name, return_config=True)
omegaconf.OmegaConf.save(cfg, f="cfg.yaml")
  1. then I commented out the conv_pointwise_type attribute of encoder's parameters.

  2. loaded model by providing a patched config:

model = nemo_asr.models.EncDecHybridRNNTCTCBPEModel.from_pretrained(
    model_name=ckpt_path,
    override_config_path="./cfg_modified.yaml",

The above hack works, though I wonder if the loaded model works correctly? Also it will be good to update the official checkpoints in the NGC registry.

Same issue happens to stt_ru_fastconformer_hybrid_large_pc russian checkpoint.

taras-sereda avatar Mar 24 '24 18:03 taras-sereda

Thank you for reporting the issue and the fix ! We'll take a look soon. I think we updated the huggingface version but not NGC

titu1994 avatar Mar 24 '24 18:03 titu1994

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 24 '24 01:04 github-actions[bot]

Still relevant for https://catalog.ngc.nvidia.com/orgs/nvidia/teams/nemo/models/stt_ru_fastconformer_hybrid_large_pc docker: nvcr.io/nvidia/nemo:24.01.speech

And this model has a different tokenizer from the one in ngc. https://huggingface.co/nvidia/stt_ru_fastconformer_hybrid_large_pc/tree/main

kzelias avatar Apr 24 '24 14:04 kzelias