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

---> 83 from pytorch_lightning.loggers import TensorBoardLogger, LightningLoggerBase, WandbLogger 84 except ImportError: #223

Closed
girlsending0 opened this issue Feb 14, 2024 · 3 comments

Comments

@girlsending0
Copy link

❓ Questions & Help

I install the pytorch-lightening version 2.0.1.
And I meet below issue.
LighteningLoggerBase is not in pytorch version 2.0.1, and I want to know what is the suitable version of pytorch lightening in openspeech.

Thank you.

Details


ImportError Traceback (most recent call last)
File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/utils.py:83
82 import pytorch_lightning as pl
---> 83 from pytorch_lightning.loggers import TensorBoardLogger, LightningLoggerBase, WandbLogger
84 except ImportError:

ImportError: cannot import name 'LightningLoggerBase' from 'pytorch_lightning.loggers' (/home/hanjh/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/pytorch_lightning/loggers/init.py)

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
Cell In[1], line 6
4 import rnnt
5 import lightning as L
----> 6 import openspeech

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/init.py:23
1 # MIT License
2 #
3 # Copyright (c) 2021 Soohwan Kim and Sangchun Ha and Soyoung Cho
(...)
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 # SOFTWARE.
---> 23 import openspeech.criterion
24 import openspeech.datasets
25 import openspeech.data

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/criterion/init.py:70
68 if subfile.endswith(".py"):
69 python_file = subfile[: subfile.find(".py")] if subfile.endswith(".py") else subfile
---> 70 module = importlib.import_module(f"openspeech.criterion.{file}.{python_file}")
71 continue
73 path = os.path.join(criterion_dir, file)

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/importlib/init.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/criterion/transducer/transducer.py:29
27 from .. import register_criterion
28 from ..transducer.configuration import TransducerLossConfigs
---> 29 from ...utils import WARPRNNT_IMPORT_ERROR
30 from ...tokenizers.tokenizer import Tokenizer
33 @register_criterion("transducer", dataclass=TransducerLossConfigs)
34 class TransducerLoss(nn.Module):

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/utils.py:85
83 from pytorch_lightning.loggers import TensorBoardLogger, LightningLoggerBase, WandbLogger
84 except ImportError:
---> 85 raise ValueError(PYTORCH_LIGHTNING_IMPORT_ERROR)
87 DUMMY_SIGNALS, _ = librosa.load(librosa.ex('choice'))
88 DUMMY_FEATURES = librosa.feature.melspectrogram(DUMMY_SIGNALS, n_mels=80)

ValueError:
Openspeech requires the pytorch-lightning library but it was not found in your environment. You can install it with pip:
pip install pytorch-lightning

@upskyy
Copy link
Member

upskyy commented Feb 15, 2024

@girlsending0

The code was written in pytorch-lightning==1.14.0.
cc. #186

Thank you.

@girlsending0
Copy link
Author

@upskyy

thank you. I fix that problem.
And another error was revealed,

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/init.py:23
1 # MIT License
2 #
3 # Copyright (c) 2021 Soohwan Kim and Sangchun Ha and Soyoung Cho
(...)
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 # SOFTWARE.
---> 23 import openspeech.criterion
24 import openspeech.data
25 import openspeech.dataclass

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/criterion/init.py:70
68 if subfile.endswith(".py"):
69 python_file = subfile[: subfile.find(".py")] if subfile.endswith(".py") else subfile
---> 70 module = importlib.import_module(f"openspeech.criterion.{file}.{python_file}")
71 continue
73 path = os.path.join(criterion_dir, file)

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/importlib/init.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/criterion/transducer/transducer.py:27
24 import torch.nn as nn
25 from omegaconf import DictConfig
---> 27 from ...tokenizers.tokenizer import Tokenizer
28 from ...utils import WARPRNNT_IMPORT_ERROR
29 from .. import register_criterion

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/tokenizers/init.py:75
73 if file.endswith(".py"):
74 vocab_name = file[: file.find(".py")] if file.endswith(".py") else file
---> 75 module = importlib.import_module(f"openspeech.tokenizers.{vocab_name}")

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/importlib/init.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/tokenizers/init.py:69
67 if subfile.endswith(".py"):
68 tokenizer_name = subfile[: subfile.find(".py")] if subfile.endswith(".py") else subfile
---> 69 module = importlib.import_module(f"openspeech.tokenizers.{file}.{tokenizer_name}")
70 continue
72 path = os.path.join(tokenizer_dir, file)

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/importlib/init.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/tokenizers/librispeech/subword.py:29
26 from omegaconf import DictConfig
28 from openspeech.dataclass.configurations import TokenizerConfigs
---> 29 from openspeech.datasets.librispeech.preprocess.subword import SENTENCEPIECE_MODEL_NAME
30 from openspeech.tokenizers import register_tokenizer
31 from openspeech.tokenizers.tokenizer import Tokenizer

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/datasets/init.py:60
58 if subfile.endswith(".py"):
59 data_module_name = subfile[: subfile.find(".py")] if subfile.endswith(".py") else subfile
---> 60 module = importlib.import_module(f"openspeech.datasets.{file}.{data_module_name}")

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/importlib/init.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/datasets/aishell/lit_data_module.py:32
29 import wget
30 from omegaconf import DictConfig
---> 32 from openspeech.data.audio.data_loader import AudioDataLoader
33 from openspeech.data.audio.dataset import SpeechToTextDataset
34 from openspeech.data.sampler import RandomSampler, SmartBatchingSampler

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/data/init.py:71
69 if module_file.endswith(".py"):
70 module_name = module_file[: module_file.find(".py")] if module_file.endswith(".py") else module_file
---> 71 module = importlib.import_module(f"openspeech.data.audio.{file}.{module_name}")

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/importlib/init.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/data/audio/mfcc/mfcc.py:26
23 import numpy as np
24 from omegaconf import DictConfig
---> 26 from ....utils import LIBROSA_IMPORT_ERROR
27 from ... import register_audio_feature_transform
28 from ...audio.mfcc.configuration import MFCCConfigs

File ~/bin/miniconda3/envs/EEGToText/lib/python3.8/site-packages/openspeech/utils.py:88
85 raise ValueError(PYTORCH_LIGHTNING_IMPORT_ERROR)
87 DUMMY_SIGNALS, _ = librosa.load(librosa.ex("choice"))
---> 88 DUMMY_FEATURES = librosa.feature.melspectrogram(DUMMY_SIGNALS, n_mels=80)
89 DUMMY_INPUTS = torch.FloatTensor(DUMMY_FEATURES).transpose(0, 1).unsqueeze(0).expand(3, -1, -1)
90 DUMMY_INPUT_LENGTHS = torch.IntTensor([1070, 900, 800])

TypeError: melspectrogram() takes 0 positional arguments but 1 was given

this problem occur because version..
I check #186, I don't found libsora.

Can I know libsora version?

@girlsending0
Copy link
Author

Oh I found.
I install libsora==0.9.1, that problem is solved.
thank you

@upskyy upskyy closed this as completed Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants