TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
State: closed | Pull request: no
Labels: name: bug

name: stale

import os
import wget
from omegaconf import OmegaConf
import json
import shutil
from faster_whisper import WhisperModel
import whisperx
import torch
from pydub import AudioSegment
from nemo.collections.asr.models.msdd_models import NeuralDiarizer
from deepmultilingualpunctuation import PunctuationModel
import re
import logging
import nltk
from whisperx.alignment import DEFAULT_ALIGN_MODELS_HF, DEFAULT_ALIGN_MODELS_TORCH
from whisperx.utils import LANGUAGES, TO_LANGUAGE_CODE

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [18], in <cell line: 10>()
      8 import torch
      9 from pydub import AudioSegment
---> 10 from nemo.collections.asr.models.msdd_models import NeuralDiarizer
     11 from deepmultilingualpunctuation import PunctuationModel
     12 import re

File ~/anaconda3/lib/python3.9/site-packages/nemo/collections/asr/__init__.py:15, in <module>
      1 # Copyright (c) 2020, NVIDIA CORPORATION.  All rights reserved.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
---> 15 from nemo.collections.asr import data, losses, models, modules
     16 from nemo.package_info import __version__
     18 # Set collection version equal to NeMo version.

File ~/anaconda3/lib/python3.9/site-packages/nemo/collections/asr/models/__init__.py:15, in <module>
      1 # Copyright (c) 2020, NVIDIA CORPORATION.  All rights reserved.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
---> 15 from nemo.collections.asr.models.asr_model import ASRModel
     16 from nemo.collections.asr.models.audio_to_audio_model import AudioToAudioModel
     17 from nemo.collections.asr.models.classification_models import EncDecClassificationModel, EncDecFrameClassificationModel

File ~/anaconda3/lib/python3.9/site-packages/nemo/collections/asr/models/aed_multitask_models.py:31, in <module>
     28 from torchmetrics.text import SacreBLEUScore
     29 from tqdm.auto import tqdm
---> 31 from nemo.collections.asr.data.audio_to_text_lhotse_prompted import (
     32     PromptedAudioToTextLhotseDataset,
     33     get_prompt_format_fn,
     34 )
     35 from nemo.collections.asr.models.asr_model import ASRModel, ExportableEncDecModel
     36 from nemo.collections.asr.parts.mixins import ASRBPEMixin

File ~/anaconda3/lib/python3.9/site-packages/nemo/collections/asr/data/audio_to_text_lhotse_prompted.py:22, in <module>
     19 from lhotse.dataset import AudioSamples
     20 from lhotse.dataset.collation import collate_vectors
---> 22 from nemo.collections.asr.data.audio_to_text_lhotse import TokenizerWrapper
     23 from nemo.collections.common.tokenizers import CanaryTokenizer, TokenizerSpec
     26 class PromptedAudioToTextLhotseDataset(torch.utils.data.Dataset):

File ~/anaconda3/lib/python3.9/site-packages/nemo/collections/asr/data/audio_to_text_lhotse.py:59, in <module>
     55         tokens = collate_vectors(tokens, padding_value=0)
     56         return audio, audio_lens, tokens, token_lens
---> 59 class TokenizerWrapper:
     60     """
     61     Provide a unified interface for NeMo Tokenizer, AggregateTokenizer, and (char) Parser.
     62     """
     64     def __init__(self, tokenizer):

File ~/anaconda3/lib/python3.9/site-packages/nemo/collections/asr/data/audio_to_text_lhotse.py:73, in TokenizerWrapper()
     70     else:
     71         self._impl = self._call_parser
---> 73 def __call__(self, text: str, lang: str | None = None):
     74     return self._impl(text, lang)
     76 def _call_agg_tokenizer(self, text: str, lang: str | None = None):

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

this is  what is got while importing the above ones

Please use `python 3.10`, this is issue with mismatch of versions of python

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.