Issue while importing-> from nemo.collections import nlp
State: closed | Pull request: no
Labels: name: bug

name: stale

TypeError                                 Traceback (most recent call last)
Cell In[9], line 2
      1 from nemo.utils.exp_manager import exp_manager
----> 2 from nemo.collections import nlp
      4 # import os
      5 # import wget 
      6 # import torch
      7 # import pytorch_lightning as pl
      8 # from omegaconf import OmegaConf

File [~/virtual_env/lib/python3.9/site-packages/nemo/collections/nlp/__init__.py:15](http://34.124.175.223:1080/home/jobin_abraham01/virtual_env/lib/python3.9/site-packages/nemo/collections/nlp/__init__.py#line=14)
      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.nlp import data, losses, models, modules
     16 from nemo.package_info import __version__
     18 # Set collection version equal to NeMo version.

File [~/virtual_env/lib/python3.9/site-packages/nemo/collections/nlp/data/__init__.py:16](http://34.124.175.223:1080/home/jobin_abraham01/virtual_env/lib/python3.9/site-packages/nemo/collections/nlp/data/__init__.py#line=15)
      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.nlp.data.data_utils import *
---> 16 from nemo.collections.nlp.data.entity_linking.entity_linking_dataset import EntityLinkingDataset
     17 from nemo.collections.nlp.data.information_retrieval.information_retrieval_dataset import (
     18     BertInformationRetrievalDataset,
     19 )
     20 from nemo.collections.nlp.data.language_modeling.l2r_lm_dataset import (
     21     L2RLanguageModelingDataset,
     22     TarredL2RLanguageModelingDataset,
     23 )

File [~/virtual_env/lib/python3.9/site-packages/nemo/collections/nlp/data/entity_linking/__init__.py:15](http://34.124.175.223:1080/home/jobin_abraham01/virtual_env/lib/python3.9/site-packages/nemo/collections/nlp/data/entity_linking/__init__.py#line=14)
      1 # Copyright (c) 2021, 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.nlp.data.entity_linking.entity_linking_dataset import EntityLinkingDataset

File [~/virtual_env/lib/python3.9/site-packages/nemo/collections/nlp/data/entity_linking/entity_linking_dataset.py:22](http://34.124.175.223:1080/home/jobin_abraham01/virtual_env/lib/python3.9/site-packages/nemo/collections/nlp/data/entity_linking/entity_linking_dataset.py#line=21)
     19 import torch
     21 from nemo.collections.nlp.data.data_utils.data_preprocessing import find_newlines, load_data_indices
---> 22 from nemo.core.classes import Dataset
     23 from nemo.utils import logging
     25 __all__ = ['EntityLinkingDataset']

File [~/virtual_env/lib/python3.9/site-packages/nemo/core/__init__.py:16](http://34.124.175.223:1080/home/jobin_abraham01/virtual_env/lib/python3.9/site-packages/nemo/core/__init__.py#line=15)
      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 import nemo.core.neural_types
---> 16 from nemo.core.classes import *

File [~/virtual_env/lib/python3.9/site-packages/nemo/core/classes/__init__.py:20](http://34.124.175.223:1080/home/jobin_abraham01/virtual_env/lib/python3.9/site-packages/nemo/core/classes/__init__.py#line=19)
     17 import omegaconf
     18 import pytorch_lightning
---> 20 from nemo.core.classes.common import (
     21     FileIO,
     22     Model,
     23     PretrainedModelInfo,
     24     Serialization,
     25     Typing,
     26     is_typecheck_enabled,
     27     typecheck,
     28 )
     29 from nemo.core.classes.dataset import Dataset, IterableDataset
     30 from nemo.core.classes.exportable import Exportable, ExportFormat

File [~/virtual_env/lib/python3.9/site-packages/nemo/core/classes/common.py:40](http://34.124.175.223:1080/home/jobin_abraham01/virtual_env/lib/python3.9/site-packages/nemo/core/classes/common.py#line=39)
     37 from omegaconf import DictConfig, OmegaConf
     39 import nemo
---> 40 from nemo.core.classes.mixins.hf_io_mixin import HuggingFaceFileIO
     41 from nemo.core.config.templates.model_card import NEMO_DEFAULT_MODEL_CARD_TEMPLATE
     42 from nemo.core.connectors.save_restore_connector import SaveRestoreConnector

File [~/virtual_env/lib/python3.9/site-packages/nemo/core/classes/mixins/__init__.py:28](http://34.124.175.223:1080/home/jobin_abraham01/virtual_env/lib/python3.9/site-packages/nemo/core/classes/mixins/__init__.py#line=27)
     16 from nemo.core.classes.mixins.adapter_mixin_strategies import (
     17     ResidualAddAdapterStrategy,
     18     ResidualAddAdapterStrategyConfig,
     19     ReturnResultAdapterStrategy,
     20     ReturnResultAdapterStrategyConfig,
     21 )
     22 from nemo.core.classes.mixins.adapter_mixins import (
     23     AdapterModelPTMixin,
     24     AdapterModuleMixin,
     25     get_registered_adapter,
     26     register_adapter,
     27 )
---> 28 from nemo.core.classes.mixins.hf_io_mixin import HuggingFaceFileIO

File [~/virtual_env/lib/python3.9/site-packages/nemo/core/classes/mixins/hf_io_mixin.py:27](http://34.124.175.223:1080/home/jobin_abraham01/virtual_env/lib/python3.9/site-packages/nemo/core/classes/mixins/hf_io_mixin.py#line=26)
     22 from huggingface_hub.utils import SoftTemporaryDirectory
     24 from nemo.utils import logging
---> 27 class HuggingFaceFileIO(ABC):
     28     """
     29     Mixin that provides Hugging Face file IO functionality for NeMo models.
     30     It is usually implemented as a mixin to `ModelPT`.
   (...)
     34     - `push_to_hf_hub()`: Push a model to the hub.
     35     """
     37     @classmethod
     38     def get_hf_model_filter(cls) -> ModelFilter:

File [~/virtual_env/lib/python3.9/site-packages/nemo/core/classes/mixins/hf_io_mixin.py:161](http://34.124.175.223:1080/home/jobin_abraham01/virtual_env/lib/python3.9/site-packages/nemo/core/classes/mixins/hf_io_mixin.py#line=160), in HuggingFaceFileIO()
    152             all_results.append(result)
    154     return all_results
    156 def push_to_hf_hub(
    157     self,
    158     repo_id: str,
    159     *,
    160     pack_nemo_file: bool = True,
--> 161     model_card: Optional['ModelCard'] | object | str = None,
    162     commit_message: str = "Push model using huggingface_hub.",
    163     private: bool = False,
    164     api_endpoint: Optional[str] = None,
    165     token: Optional[str] = None,
    166     branch: Optional[str] = None,
    167     allow_patterns: Optional[Union[List[str], str]] = None,
    168     ignore_patterns: Optional[Union[List[str], str]] = None,
    169     delete_patterns: Optional[Union[List[str], str]] = None,
    170 ):
    171     """
    172     Upload model checkpoint to the Hub.
    173 
   (...)
    208         The url of the uploaded HF repo.
    209     """
    210     if "/" not in repo_id or len(repo_id.split("/")) != 2:

TypeError: unsupported operand type(s) for |: '_UnionGenericAlias' and 'type'

Python 3.10 is the minimum for NeMo

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.