Error: cannot import name 'ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST' from 'transformers'  while using 
State: closed | Pull request: no
Labels: name: bug

I am using PunctuationCapitalizationModel which was installed using:
python3 -m pip install git+https://github.com/NVIDIA/NeMo.git@v1.20.0#egg=nemo_toolkit[nlp]

But got below error: 
Traceback (most recent call last):
  File "/opt/api/batch_asr_server.py", line 13, in <module>
    from consumer import Consumer, add_consumer_arguments
  File "/opt/api/consumer.py", line 9, in <module>
    from run import OfflineVadAsr, add_run_arguments
  File "/opt/ds-offline-vad-asr/run.py", line 69, in <module>
    from nemo.collections.nlp.models import PunctuationCapitalizationModel
  File "/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/__init__.py", line 15, in <module>
    from nemo.collections.nlp import data, losses, models, modules
  File "/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/models/__init__.py", line 16, in <module>
    from nemo.collections.nlp.models.duplex_text_normalization import (
  File "/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/models/duplex_text_normalization/__init__.py", line 15, in <module>
    from nemo.collections.nlp.models.duplex_text_normalization.duplex_decoder import DuplexDecoderModel
  File "/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/models/duplex_text_normalization/duplex_decoder.py", line 34, in <module>
    from nemo.collections.nlp.models.nlp_model import NLPModel
  File "/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/models/nlp_model.py", line 31, in <module>
    from nemo.collections.nlp.modules import BertModule
  File "/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/modules/__init__.py", line 16, in <module>
    from nemo.collections.nlp.modules.common import (
  File "/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/modules/common/__init__.py", line 18, in <module>
    from nemo.collections.nlp.modules.common.huggingface import (
  File "/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/modules/common/huggingface/__init__.py", line 19, in <module>
    from nemo.collections.nlp.modules.common.huggingface.huggingface_utils import (
  File "/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/modules/common/huggingface/huggingface_utils.py", line 18, in <module>
    from transformers import (
ImportError: cannot import name 'ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST' from 'transformers' (/usr/local/lib/python3.10/dist-packages/transformers/__init__.py)


I saw similar issue there : https://github.com/NVIDIA/NeMo/issues/9272 But, was not clear where this is fixed. Please help @titu1994 . Thanks

Please check https://github.com/NVIDIA/NeMo/issues/9272

I tried using : _python3 -m pip install git+https://github.com/NVIDIA/NeMo.git#egg=nemo_toolkit[all]_ 

After this, I am getting different errors:

Fused optimized group norm has not been installed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/models/language_modeling/megatron/gpt_layer_modelopt_spec.py", line 16, in <module>
    from megatron.core.fusions.fused_bias_dropout import get_bias_dropout_add
**ModuleNotFoundError: No module named 'megatron'**

After this, I did **pip install megatron,** which gave another error:
**ModuleNotFoundError: No module named 'transformer_engine'**

Then I tried installing transformer-engine using 
**pip install git+https://github.com/NVIDIA/TransformerEngine.git@stable**
, but engine crashed. Please suggest. Thanks

Hi @yonas-g @titu1994 
I am still facing this issue. Any suggestion. Thanks

Transformer engine is not that easy to install, please look at installation instructions in NeMo readme or use container. 

> Please check #9272

I checked and it using https://github.com/NVIDIA/NeMo/blob/main/requirements/requirements_lightning.txt#L7 it downgraded my transformers to 4.40.2 which fixed this problem as it pulled in https://github.com/huggingface/transformers/blob/v4.40.2/src/transformers/__init__.py#L1456

> > Please check #9272
> 
> I checked and it using https://github.com/NVIDIA/NeMo/blob/main/requirements/requirements_lightning.txt#L7 it downgraded my transformers to 4.40.2 which fixed this problem as it pulled in https://github.com/huggingface/transformers/blob/v4.40.2/src/transformers/__init__.py#L1456

Hi @raybellwaves  @uni-manjunath-ke,

Yes, some of the modules were removed from transformers >= 4.41. If you want to use it, please, install transformers version <= 4.40.2.