Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name '_is_local_file_protocol' from 'pytorch_lightning.callbacks.model_checkpoint' #9052

Open
eesaeedkarimi opened this issue Apr 29, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@eesaeedkarimi
Copy link

When I run
from nemo.collections.tts.models.base import SpectrogramGenerator
I get this error:
Traceback (most recent call last): File "/home/saeed/Codes/NeMo/tutorials/tts/Inference_ModelSelect.py", line 3, in <module> from nemo.collections.tts.models.base import SpectrogramGenerator File "/home/saeed/Codes/NeMo/nemo/collections/tts/__init__.py", line 15, in <module> from nemo.collections.tts import data, losses, models, modules File "/home/saeed/Codes/NeMo/nemo/collections/tts/models/__init__.py", line 16, in <module> from nemo.collections.tts.models.audio_codec import AudioCodecModel File "/home/saeed/Codes/NeMo/nemo/collections/tts/models/audio_codec.py", line 27, in <module> from nemo.collections.tts.losses.audio_codec_loss import ( File "/home/saeed/Codes/NeMo/nemo/collections/tts/losses/audio_codec_loss.py", line 21, in <module> from nemo.collections.asr.parts.preprocessing.features import FilterbankFeatures File "/home/saeed/Codes/NeMo/nemo/collections/asr/__init__.py", line 15, in <module> from nemo.collections.asr import data, losses, models, modules File "/home/saeed/Codes/NeMo/nemo/collections/asr/models/__init__.py", line 15, in <module> from nemo.collections.asr.models.aed_multitask_models import EncDecMultiTaskModel File "/home/saeed/Codes/NeMo/nemo/collections/asr/models/aed_multitask_models.py", line 29, in <module> from nemo.collections.asr.metrics import BLEU, WER File "/home/saeed/Codes/NeMo/nemo/collections/asr/metrics/__init__.py", line 15, in <module> from nemo.collections.asr.metrics.bleu import BLEU File "/home/saeed/Codes/NeMo/nemo/collections/asr/metrics/bleu.py", line 22, in <module> from nemo.collections.asr.parts.submodules.multitask_decoding import AbstractMultiTaskDecoding File "/home/saeed/Codes/NeMo/nemo/collections/asr/parts/submodules/multitask_decoding.py", line 23, in <module> from nemo.collections.asr.parts.submodules.multitask_beam_decoding import ( File "/home/saeed/Codes/NeMo/nemo/collections/asr/parts/submodules/multitask_beam_decoding.py", line 21, in <module> from nemo.collections.asr.modules.transformer import BeamSearchSequenceGenerator File "/home/saeed/Codes/NeMo/nemo/collections/asr/modules/__init__.py", line 15, in <module> from nemo.collections.asr.modules.audio_modules import ( File "/home/saeed/Codes/NeMo/nemo/collections/asr/modules/audio_modules.py", line 21, in <module> from nemo.collections.asr.modules.conformer_encoder import ConformerEncoder File "/home/saeed/Codes/NeMo/nemo/collections/asr/modules/conformer_encoder.py", line 26, in <module> from nemo.collections.asr.models.configs import CacheAwareStreamingConfig File "/home/saeed/Codes/NeMo/nemo/collections/asr/models/configs/__init__.py", line 15, in <module> from nemo.collections.asr.models.configs.asr_models_config import ( File "/home/saeed/Codes/NeMo/nemo/collections/asr/models/configs/asr_models_config.py", line 27, in <module> from nemo.core.config import modelPT as model_cfg File "/home/saeed/Codes/NeMo/nemo/core/config/modelPT.py", line 22, in <module> from nemo.utils import exp_manager File "/home/saeed/Codes/NeMo/nemo/utils/exp_manager.py", line 43, in <module> from nemo.utils.callbacks import NeMoModelCheckpoint, PreemptionCallback File "/home/saeed/Codes/NeMo/nemo/utils/callbacks/__init__.py", line 16, in <module> from nemo.utils.callbacks.nemo_model_checkpoint import NeMoModelCheckpoint File "/home/saeed/Codes/NeMo/nemo/utils/callbacks/nemo_model_checkpoint.py", line 24, in <module> from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint, _is_local_file_protocol ImportError: cannot import name '_is_local_file_protocol' from 'pytorch_lightning.callbacks.model_checkpoint'

I also can't find a function or variable named _is_local_file_protocol in the 'pytorch_lightning.callbacks.model_checkpoint'.

Environment overview

I have used a python virtual environment and installed the requirements with these commands:
apt-get update && apt-get install -y libsndfile1 ffmpeg pip install Cython pip install nemo_toolkit['tts']

Environment details

My pytorch-lightning version is 1.4.0

@eesaeedkarimi eesaeedkarimi added the bug Something isn't working label Apr 29, 2024
@migueljette
Copy link

I had the same issue and updated to pytorch-lightning=2.2.1 and it worked.
Somehow, when I installed everything from scratch, using pip install nemo_toolkit['all'], it did not install the right pytorch-lightning. If you look at the requirements files, it says it requires at least 2.2.1:

cat requirements/requirements_lightning.txt
cloudpickle
fiddle
hydra-core>1.3,<=1.3.2
omegaconf<=2.3
pytorch-lightning>=2.2.1
torchmetrics>=0.11.0
transformers>=4.36.0
wandb
webdataset>=0.2.86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants