I got error in running VAD code 
State: closed | Pull request: no
Labels: name: bug

I run the code in https://github.com/NVIDIA/NeMo/blob/main/tutorials/asr/06_Voice_Activiy_Detection.ipynb, however I got an error while runing below cell:

      1 # NeMo's "core" package
----> 2 import nemo
      3 # NeMo's ASR collection - this collections contains complete ASR models and
      4 # building blocks (modules) for ASR
      5 import nemo.collections.asr as nemo_asr

11 frames
/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/apply_func.py in <module>()
     23 TORCHTEXT_AVAILABLE = importlib.util.find_spec("torchtext") is not None
     24 if TORCHTEXT_AVAILABLE:
---> 25     from torchtext.data import Batch
     26 else:
     27     Batch = type(None)

ImportError: cannot import name 'Batch' from 'torchtext.data' (/usr/local/lib/python3.7/dist-packages/torchtext/data/__init__.py)

and I got another error when I run below cell:
AttributeError                            Traceback (most recent call last)
<ipython-input-40-2e00f7ee79ea> in <module>()
----> 1 exp_dir = exp_manager(trainer, config.get("exp_manager", None))

1 frames
/content/MyVADNeMo/nemo/utils/exp_manager.py in get_log_dir(trainer, exp_dir, name, version, explicit_log_dir, use_datetime_version)
    428         if trainer.logger.save_dir:
    429             if exp_dir:
--> 430                 raise LoggerMisconfigurationError(
    431                     "The pytorch lightning trainer that was passed to exp_manager contained a logger, the logger's "
    432                     f"save_dir was not None, and exp_dir ({exp_dir}) was not None. If trainer.logger.save_dir "

AttributeError: 'Trainer' object has no attribute 'is_slurm_managing_tasks'.

Thanks in advance!

Hi @fnsrc Thanks for reporting this.
Did you run the first cell about the installation? Are you using the docker container? Would you mind share the version of the packages you are using?  Thanks!

Looks like it's related to this[ PyTorch-lightning version issue](https://github.com/PyTorchLightning/pytorch-lightning/issues/6210)  
We are investigating that.  We will update and pin the version in tutorials and release a container soon.  A temporary fix is to downgrade them 
`pip install torchtext==0.8.0 torch==1.7.1 pytorch-lightning==1.2.2`

Actually Pytorch-lightning version 1.2.3 fixes the  `pytorch_lightning/utilities/apply_func.py` problem.
I tried to keep torch 1.8.0, and just upgraded `pytorch-lightning==1.2.3`. Then fixes this and it run in the next problem. https://github.com/NVIDIA/NeMo/issues/1868
If you stick with torch version at 1.7.1, is necessary the change pytorch-lightning, because intentionally it was limited to `pytorch-lightning>=1.1.0,<=1.1.5`.
Better do your workaround like myself https://github.com/tiborkiss/NeMo/commit/d3bcb9045c8682ed91687de80f2a0290c6375c4c
Then deploy with `./redeploy.sh`

Hopefully will be sorted out all incompatibilities with torch 1.8.0 and with pytorch-lightning>=1.2.3, until that time we must workaround.

Thanks for your response.
I run this notebook code on colab and I replaced "!pip install torchtext==0.8.0 torch==1.7.1 pytorch-lightning==1.2.2" instead of  "!pip install torchaudio==0.6.0 -f https://download.pytorch.org/whl/torch_stable.html" in first cell and also I also tried some versions like "!pip install torchtext==0.8.0 torch==1.7.1 pytorch-lightning==1.2.3" and "!pip install torchtext==0.8.0 torch==1.8.0 pytorch-lightning==1.2.3", however I got an error again in below cell:
AttributeError                            Traceback (most recent call last)
<ipython-input-17-2e00f7ee79ea> in <module>()
----> 1 exp_dir = exp_manager(trainer, config.get("exp_manager", None))

1 frames
/content/NeMo/nemo/utils/exp_manager.py in get_log_dir(trainer, exp_dir, name, version, explicit_log_dir, use_datetime_version)
    428 
    429         if version is None:
--> 430             if trainer.is_slurm_managing_tasks:
    431                 logging.warning("Running on a slurm cluster. exp_manager will not add a version number.")
    432                 version = ""

AttributeError: 'Trainer' object has no attribute 'is_slurm_managing_tasks'

Thanks in advance!


@fnsrc your version selection is not converge to a stable, compatible setup.
Look at these four versions, these are ok. https://github.com/tiborkiss/NeMo/commit/d3bcb9045c8682ed91687de80f2a0290c6375c4c
I created a fork, where I pin the versions, then when I use from notebooks, I just simply pull that
```
BRANCH = 'stick-torch-171'
!python -m pip install git+https://github.com/tiborkiss/NeMo.git@$BRANCH#egg=nemo_toolkit[all]
```
But that is just a workaround. It's a tradeof.. if you want to not have too much things modified in notebooks you touch, only two lines (above), than this could be a handy workaround, if you want to not be interrupted by sporadic incompatibility errors.

Thanks for your response @tiborkiss.
I run first cell of the notebook code with these changes:


!pip install wget
!apt-get install sox libsndfile1 ffmpeg
!pip install unidecode

BRANCH = 'stick-torch-171'
!python -m pip install git+https://github.com/tiborkiss/NeMo.git@$BRANCH#egg=nemo_toolkit[all]

!pip install torchaudio==0.6.0 -f https://download.pytorch.org/whl/torch_stable.html


However, I got again an error in below cell:


OSError                                   Traceback (most recent call last)
<ipython-input-5-327743e4f6ae> in <module>()
      1 # NeMo's "core" package
----> 2 import nemo
      3 # NeMo's ASR collection - this collections contains complete ASR models and
      4 # building blocks (modules) for ASR
      5 import nemo.collections.asr as nemo_asr

15 frames
/usr/lib/python3.7/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    362 
    363         if handle is None:
--> 364             self._handle = _dlopen(self._name, mode)
    365         else:
    366             self._handle = handle

OSError: /usr/local/lib/python3.7/dist-packages/torchtext/_torchtext.so: undefined symbol: _ZN3c104impl23ExcludeDispatchKeyGuardC1ENS_14DispatchKeySetE


Thanks in advance!

Thanks! 
It works now, when I run first cell as follows:

!pip install wget
!apt-get install sox libsndfile1 ffmpeg
!pip install unidecode

BRANCH = 'stick-torch-171'
!python -m pip install git+https://github.com/tiborkiss/NeMo.git@$BRANCH#egg=nemo_toolkit[all]

!pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
!pip install torchtext==0.8.0 pytorch-lightning==1.1.2 numpy>=1.18.2


Cool.
Installing torch at first, to me it was the test that NeMo's requirements don't override.
Anyway. Is ok for now, but we have to check the updates. In the next days I have to research with NeMo, therefore I have to take care of that. Later, it will be solved the problem anyway.


looks resolved now? Closing

I run the code in https://github.com/NVIDIA/NeMo/blob/main/tutorials/asr/06_Voice_Activiy_Detection.ipynb, however I got agin an error while runing below cell:

  1 # NeMo's "core" package
----> 2 import nemo
3 # NeMo's ASR collection - this collections contains complete ASR models and
4 # building blocks (modules) for ASR
5 import nemo.collections.asr as nemo_asr

11 frames
/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/apply_func.py in ()
23 TORCHTEXT_AVAILABLE = importlib.util.find_spec("torchtext") is not None
24 if TORCHTEXT_AVAILABLE:
---> 25 from torchtext.data import Batch
26 else:
27 Batch = type(None)

ImportError: cannot import name 'Batch' from 'torchtext.data' (/usr/local/lib/python3.7/dist-packages/torchtext/data/init.py)

and I got another error when I run below cell:
AttributeError Traceback (most recent call last)
in ()
----> 1 exp_dir = exp_manager(trainer, config.get("exp_manager", None))

1 frames
/content/MyVADNeMo/nemo/utils/exp_manager.py in get_log_dir(trainer, exp_dir, name, version, explicit_log_dir, use_datetime_version)
428 if trainer.logger.save_dir:
429 if exp_dir:
--> 430 raise LoggerMisconfigurationError(
431 "The pytorch lightning trainer that was passed to exp_manager contained a logger, the logger's "
432 f"save_dir was not None, and exp_dir ({exp_dir}) was not None. If trainer.logger.save_dir "

AttributeError: 'Trainer' object has no attribute 'is_slurm_managing_tasks'.

Thanks in advance!