Skip to content

Unable to convert any Model from .nemo to .riva #38

@LL-AI-dev

Description

@LL-AI-dev

Hardware - GPU (T4)
Hardware - CPU
Operating System - ubuntu 20.04 running on AWS EC2 g4dn.2xlarge instance

I am currently trying to convert a model (several of different types but for now not even a FastPitch model is working)
In the past i had deployed several nemo pipelines to riva but that developing environment was lost during some updates and I have not been able to convert and deploy any nemo models since. I believe this lost environment was using nemo 1.20.0 and riva & nemo2riva version 2.13.1, however using those versions does not seem to work for me anymore.

Recently I have been testing several versions of nemo, nemo2riva and riva using the dockerfile below in order to deploy models. (will update with testing data as I continue to try and retry combinations)

FROM nvcr.io/nvidia/nemo:24.01.framework

#get a simple fastpitch model to convert
RUN wget --content-disposition \
    'https://api.ngc.nvidia.com/v2/models/org/nvidia/team/nemo/tts_en_fastpitch/IPA_1.13.0/files?redirect=true&path=tts_en_fastpitch_align_ipa.nemo' \
    -O tts_en_fastpitch_align_ipa.nemo

#without nemo_text_processing it errors with "TypeError: Can't instantiate abstract class ModelPT with abstract methods list_available_models, setup_training_data, setup_validation_data"
#without lhotse it also gets the same TypeError
RUN pip install nemo_text_processing
RUN pip install lhotse

#install nemo2riva
RUN pip install nvidia-pyindex
RUN pip install nemo2riva==2.14.0

#run the test
CMD nemo2riva --out FP_ipa.riva --key tlt_encode tts_en_fastpitch_align_ipa.nemo

As you can see in the dockerfile, it is using a pretrained model from ngc, however I get the same error even on a .nemo model that was trained using the latest nemo version

The error relates to nvidia-eff and being unable to encrypt the model. This error is consistent regardless of the nemo image used. I have also tried using a pytorch base image but this results in the same errors. I tried using a riva-servicemaker image too but that had an issue arising because the image uses python 3.8 but nemo has required 3.10 for a long time.

I really need some help resolving this as development is being delayed as I cannot update any ASR, NLP, or TTS models currently. How can I resolve this?

INFO: generated new fontManager
INFO: NumExpr defaulting to 8 threads.
[NeMo I 2024-03-04 01:59:20 nemo2riva:38] Logging level set to 20
[NeMo I 2024-03-04 01:59:20 convert:36] Restoring NeMo model from 'tts_en_fastpitch_align_ipa.nemo'
GPU available: True (cuda), used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
`Trainer(limit_train_batches=1.0)` was configured so 100% of the batches per epoch will be used..
`Trainer(limit_val_batches=1.0)` was configured so 100% of the batches will be used..
`Trainer(limit_test_batches=1.0)` was configured so 100% of the batches will be used..
`Trainer(limit_predict_batches=1.0)` was configured so 100% of the batches will be used..
`Trainer(val_check_interval=1.0)` was configured so validation will run at the end of the training epoch..
 NeMo-text-processing :: INFO     :: Creating ClassifyFst grammars.
WARNING: Logging before flag parsing goes to stderr.
I0304 01:59:23.133829 139807560075072 tokenize_and_classify.py:86] Creating ClassifyFst grammars.
[NeMo W 2024-03-04 01:59:51 deprecated:65] Function ``g2p_backward_compatible_support`` is deprecated. But it will not be removed until a further notice. G2P object root directory `nemo_text_processing.g2p` has been replaced with `nemo.collections.tts.g2p`. Please use the latter instead as of NeMo 1.18.0.
[NeMo W 2024-03-04 01:59:52 experimental:26] `<class 'nemo.collections.tts.g2p.models.i18n_ipa.IpaG2p'>` is experimental and not ready for production yet. Use at your own risk.
[NeMo W 2024-03-04 01:59:53 i18n_ipa:124] apply_to_oov_word=None, This means that some of words will remain unchanged if they are not handled by any of the rules in self.parse_one_word(). This may be intended if phonemes and chars are both valid inputs, otherwise, you may see unexpected deletions in your input.
[NeMo W 2024-03-04 01:59:53 experimental:26] `<class 'nemo.collections.common.tokenizers.text_to_speech.tts_tokenizers.IPATokenizer'>` is experimental and not ready for production yet. Use at your own risk.
[NeMo W 2024-03-04 01:59:53 modelPT:165] If you intend to do training or fine-tuning, please call the ModelPT.setup_training_data() method and provide a valid configuration file to setup the train data loader.
    Train config : 
    dataset:
      _target_: nemo.collections.tts.torch.data.TTSDataset
      manifest_filepath: /data3/LJSpeech/nvidia_ljspeech_train.json
      sample_rate: 22050
      sup_data_path: /data3/LJSpeech/tmp_ignoreamb/
      sup_data_types:
      - align_prior_matrix
      - pitch
      n_fft: 1024
      win_length: 1024
      hop_length: 256
      window: hann
      n_mels: 80
      lowfreq: 0
      highfreq: 8000
      max_duration: null
      min_duration: 0.1
      ignore_file: null
      trim: false
      pitch_fmin: 65.40639132514966
      pitch_fmax: 2093.004522404789
      pitch_norm: true
      pitch_mean: 212.35873413085938
      pitch_std: 68.52806091308594
      use_beta_binomial_interpolator: true
    dataloader_params:
      drop_last: false
      shuffle: true
      batch_size: 32
      num_workers: 12
    
[NeMo W 2024-03-04 01:59:53 modelPT:172] If you intend to do validation, please call the ModelPT.setup_validation_data() or ModelPT.setup_multiple_validation_data() method and provide a valid configuration file to setup the validation data loader(s). 
    Validation config : 
    dataset:
      _target_: nemo.collections.tts.torch.data.TTSDataset
      manifest_filepath: /data3/LJSpeech/nvidia_ljspeech_val.json
      sample_rate: 22050
      sup_data_path: /data3/LJSpeech/tmp_ignoreamb/
      sup_data_types:
      - align_prior_matrix
      - pitch
      n_fft: 1024
      win_length: 1024
      hop_length: 256
      window: hann
      n_mels: 80
      lowfreq: 0
      highfreq: 8000
      max_duration: null
      min_duration: null
      ignore_file: null
      trim: false
      pitch_fmin: 65.40639132514966
      pitch_fmax: 2093.004522404789
      pitch_norm: true
      pitch_mean: 212.35873413085938
      pitch_std: 68.52806091308594
      use_beta_binomial_interpolator: true
    dataloader_params:
      drop_last: false
      shuffle: false
      batch_size: 32
      num_workers: 8
    
[NeMo I 2024-03-04 01:59:53 features:289] PADDING: 1
[NeMo I 2024-03-04 01:59:54 save_restore_connector:249] Model FastPitchModel was successfully restored from /workspace/tts_en_fastpitch_align_ipa.nemo.
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/nlp-isc-exported-bert.yaml for nemo.collections.nlp.models.IntentSlotClassificationModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/tts-exported-fastpitchmodel.yaml for nemo.collections.tts.models.FastPitchModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/tts-exported-hifiganmodel.yaml for nemo.collections.tts.models.HifiGanModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/tts-exported-radttsmodel.yaml for nemo.collections.tts.models.RadTTSModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/asr-stt-exported-encdecctcmodel.yaml for nemo.collections.asr.models.EncDecCTCModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/nlp-tc-exported-bert.yaml for nemo.collections.nlp.models.TextClassificationModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/nlp-mt-exported-encdecmtmodel.yaml for nemo.collections.nlp.models.MTEncDecModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/nlp-tkc-exported-bert.yaml for nemo.collections.nlp.models.TokenClassificationModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/asr-stt-exported-encdectcmodelbpe.yaml for nemo.collections.asr.models.EncDecCTCModelBPE
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/asr-scr-exported-encdecclsmodel.yaml for nemo.collections.asr.models.classification_models.EncDecClassificationModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/nlp-qa-exported-bert.yaml for nemo.collections.nlp.models.QAModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/nlp-mt-exported-megatronnmtmodel.yaml for nemo.collections.nlp.models.MegatronNMTModel
[NeMo I 2024-03-04 01:59:54 schema:161] Loaded schema file /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/nlp-pc-exported-bert.yaml for nemo.collections.nlp.models.PunctuationCapitalizationModel
[NeMo I 2024-03-04 01:59:54 schema:200] Found validation schema for nemo.collections.tts.models.FastPitchModel at /usr/local/lib/python3.10/dist-packages/nemo2riva/validation_schemas/tts-exported-fastpitchmodel.yaml
[NeMo I 2024-03-04 01:59:54 schema:229] Checking installed NeMo version ... 1.23.0 OK (>=1.1)
[NeMo I 2024-03-04 01:59:54 artifacts:59] Found model at ./model_weights.ckpt
[NeMo I 2024-03-04 01:59:54 artifacts:136] Retrieved artifacts: dict_keys(['36d6b09d4dbc45dcb02222e1931e4c7c_lj_speech.tsv', '446fe5373191447190c14cdb8e967e58_ipa_cmudict-0.7b_nv22.08.txt', 'e2327d2f57dd41b88601774804001221_heteronyms-052722', 'model_config.yaml', 'mapping.txt'])
[NeMo I 2024-03-04 01:59:54 cookbook:78] Exporting model FastPitchModel with config=ExportConfig(export_subnet=None, export_format='ONNX', export_file='model_graph.onnx', encryption=True, autocast=True, max_dim=None, export_args={})
[NeMo I 2024-03-04 02:00:01 exportable:131] Successfully exported FastPitchModel to /tmp/tmp7gtd0omy/model_graph.onnx
[W] colored module is not installed, will not use colors when logging. To enable colors, please install the colored module: python3 -m pip install colored
[W] Attribute of type TYPE_PROTO is currently unsupported. Skipping attribute.
[W] colored module is not installed, will not use colors when logging. To enable colors, please install the colored module: python3 -m pip install colored
[W] Could not convert: UNDEFINED to a corresponding NumPy type. The original ONNX type will be preserved. 
[W] colored module is not installed, will not use colors when logging. To enable colors, please install the colored module: python3 -m pip install colored
[W] Attribute of type TYPE_PROTO is currently unsupported. Skipping attribute.
2024-03-04 02:00:01.862915635 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_980
2024-03-04 02:00:01.862971956 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_975
2024-03-04 02:00:01.862988821 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_960
2024-03-04 02:00:01.863000639 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_955
2024-03-04 02:00:01.863011349 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_951
2024-03-04 02:00:01.863026569 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_945
2024-03-04 02:00:01.863059506 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_911
2024-03-04 02:00:01.863083302 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_906
2024-03-04 02:00:01.863103596 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_891
2024-03-04 02:00:01.863122579 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_886
2024-03-04 02:00:01.863142365 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_882
2024-03-04 02:00:01.863161463 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_876
2024-03-04 02:00:01.863180990 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_842
2024-03-04 02:00:01.863202010 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_837
2024-03-04 02:00:01.863224208 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_822
2024-03-04 02:00:01.863235010 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_817
2024-03-04 02:00:01.863244066 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_813
2024-03-04 02:00:01.863256423 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_807
2024-03-04 02:00:01.877913305 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_1055
2024-03-04 02:00:01.877951197 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_1050
2024-03-04 02:00:01.877967245 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_1035
2024-03-04 02:00:01.877974987 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_1030
2024-03-04 02:00:01.877984501 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_1026
2024-03-04 02:00:01.877994518 [W:onnxruntime:, unsqueeze_elimination.cc:20 Apply] UnsqueezeElimination cannot remove node Unsqueeze_1020
Traceback (most recent call last):
  File "/usr/local/bin/nemo2riva", line 8, in <module>
    sys.exit(nemo2riva())
  File "/usr/local/lib/python3.10/dist-packages/nemo2riva/cli/nemo2riva.py", line 49, in nemo2riva
    Nemo2Riva(args)
  File "/usr/local/lib/python3.10/dist-packages/nemo2riva/convert.py", line 87, in Nemo2Riva
    export_model(
  File "/usr/local/lib/python3.10/dist-packages/nemo2riva/cookbook.py", line 141, in export_model
    create_artifact(
  File "/usr/local/lib/python3.10/dist-packages/nemo2riva/artifacts.py", line 92, in create_artifact
    af.encrypt()
  File "<frozen eff.core.file>", line 128, in encrypt
PermissionError: Cannot encrypt the artifact without encryption

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions