bofenghuang commited on
Commit
4e5f717
1 Parent(s): e7f1a2d

Remove the incompatible attribute `conv_pointwise_type` from the `model_config.yaml` file

Browse files

Hi!

I've tried to load the model using the following code snippet

```python
import nemo.collections.asr as nemo_asr
asr_model = nemo_asr.models.EncDecHybridRNNTCTCBPEModel.from_pretrained(model_name="nvidia/stt_fr_fastconformer_hybrid_large_pc")
```

However, I got the following error

```
File ~/asr/NeMo/nemo/collections/asr/models/rnnt_models.py:56, in EncDecRNNTModel.__init__(self, cfg, trainer)
54 # Initialize components
55 self.preprocessor = EncDecRNNTModel.from_config_dict(self.cfg.preprocessor)
---> 56 self.encoder = EncDecRNNTModel.from_config_dict(self.cfg.encoder)
58 # Update config values required by components dynamically
59 with open_dict(self.cfg.decoder):

File ~/asr/NeMo/nemo/core/classes/common.py:468, in Serialization.from_config_dict(cls, config, trainer)
465 # Hydra 1.x API
466 elif '_target_' in config and _HAS_HYDRA:
467 # regular hydra-based instantiation
--> 468 instance = hydra.utils.instantiate(config=config)
469 else:
470 instance = None

File ~/anaconda3/envs/nemo/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py:226, in instantiate(config, *args, **kwargs)
223 _convert_ = config.pop(_Keys.CONVERT, ConvertMode.NONE)
224 _partial_ = config.pop(_Keys.PARTIAL, False)
--> 226 return instantiate_node(
227 config, *args, recursive=_recursive_, convert=_convert_, partial=_partial_
228 )
229 elif OmegaConf.is_list(config):
230 # Finalize config (convert targets to strings, merge with kwargs)
231 config_copy = copy.deepcopy(config)

File ~/anaconda3/envs/nemo/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py:347, in instantiate_node(node, convert, recursive, partial, *args)
342 value = instantiate_node(
343 value, convert=convert, recursive=recursive
344 )
345 kwargs[key] = _convert_node(value, convert)
--> 347 return _call_target(_target_, partial, args, kwargs, full_key)
348 else:
349 # If ALL or PARTIAL non structured or OBJECT non structured,
350 # instantiate in dict and resolve interpolations eagerly.
351 if convert == ConvertMode.ALL or (
352 convert in (ConvertMode.PARTIAL, ConvertMode.OBJECT)
353 and node._metadata.object_type in (None, dict)
354 ):

File ~/anaconda3/envs/nemo/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py:97, in _call_target(_target_, _partial_, args, kwargs, full_key)
95 if full_key:
96 msg += f"\nfull_key: {full_key}"
---> 97 raise InstantiationException(msg) from e

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

It seems like the `conv_pointwise_type` attribute is not compatible with the current version which I've installed from the main branch.

I've deleted the relevant attribute in `model_config.yaml` and then repacked to .nemo file using

```python
asr_model.save_to("stt_fr_fastconformer_hybrid_large_pc.nemo")
```

Then I can load the model successfully using

```python
asr_model = nemo_asr.models.EncDecHybridRNNTCTCBPEModel.restore_from("stt_fr_fastconformer_hybrid_large_pc.nemo")
```

Finally, I would like to submit this PR to modify the online version, so that users can seamlessly load it from the Hugging Face Hub.

Thanks in advance!

stt_fr_fastconformer_hybrid_large_pc.nemo CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:262c9db122e872875452aff67f92e73b9d2833010203c460653baf4fe4640476
3
  size 459233280
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:965b9c612c90b747cfe9f83ae7f1637a9d08d3e116a873633c134d6fb7c81ba0
3
  size 459233280