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

nltk #332

Open
Freashapples opened this issue Nov 17, 2024 · 3 comments
Open

nltk #332

Freashapples opened this issue Nov 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Freashapples
Copy link

Does anyone know any solutions to this problem? First it starts off with this:

C:\Users\me\Downloads\OpenVoiceProject\.venv\lib\site-packages\torch\nn\utils\weight_norm.py:143: FutureWarning: torch.nn.utils.weight_normis deprecated in favor oftorch.nn.utils.parametrizations.weight_norm. WeightNorm.apply(module, name, dim)

Then this:

File "C:\Users\me\Downloads\OpenVoiceProject\voice.py", line 42, in openvoice_v2 model.tts_to_file(text, speaker_id, src_path, speed=speed)

Which leads to:

File "C:\Users\me\Downloads\OpenVoiceProject\.venv\lib\site-packages\nltk\data.py", line 579, in find raise LookupError(resource_not_found)

Finally:

`LookupError:


Resource averaged_perceptron_tagger_eng not found.
Please use the NLTK Downloader to obtain the resource:

import nltk
nltk.download('averaged_perceptron_tagger_eng')

For more information see: https://www.nltk.org/data.html

Attempted to load taggers/averaged_perceptron_tagger_eng/

Searched in:
- 'C:\Users\me/nltk_data'
- 'C:\Users\me\Downloads\OpenVoiceProject\.venv\nltk_data'
- 'C:\Users\me\Downloads\OpenVoiceProject\.venv\share\nltk_data'
- 'C:\Users\me\Downloads\OpenVoiceProject\.venv\lib\nltk_data'
- 'C:\Users\me\AppData\Roaming\nltk_data'
- 'C:\nltk_data'
- 'D:\nltk_data'
- 'E:\nltk_data'
**********************************************************************`

@dosubot dosubot bot added the bug Something isn't working label Nov 17, 2024
@kackcode
Copy link

Quick Fix for NLTK Module LookupError

Solution

To resolve this, download the required resource using one of the following methods:


Option 1: Terminal Command

Run this in your terminal:

python -m nltk.downloader averaged_perceptron_tagger

Option 2: In Python Script

Add this to your Python code:

import nltk
nltk.download('averaged_perceptron_tagger')

This will ensure the required resource is downloaded and available for use.

@Freashapples
Copy link
Author

C:\Users\me\AppData\Local\Programs\Python\Python39\lib\runpy.py:127: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour warn(RuntimeWarning(msg)) [nltk_data] Downloading package averaged_perceptron_tagger to [nltk_data] C:\Users\me\AppData\Roaming\nltk_data... [nltk_data] Package averaged_perceptron_tagger is already up-to- [nltk_data] date!

Was already updated and still does not work :(
Here is the full terminal. I am on python 3.9.13

PS C:\Users\me\Downloads\OpenVoiceProject> & c:/Users/me/Downloads/OpenVoiceProject/.venv/Scripts/python.exe c:/Users/me/Downloads/OpenVoiceProject/main.py pygame 2.6.1 (SDL 2.28.4, Python 3.9.9) Hello from the pygame community. https://www.pygame.org/contribute.html C:\Users\me\Downloads\OpenVoiceProject\.venv\lib\site-packages\torch\nn\utils\weight_norm.py:143: FutureWarning: torch.nn.utils.weight_normis deprecated in favor oftorch.nn.utils.parametrizations.weight_norm. WeightNorm.apply(module, name, dim) C:\Users\me\Downloads\OpenVoiceProject\.venv\lib\site-packages\wavmark\__init__.py:16: FutureWarning: You are using torch.loadwithweights_only=False(the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value forweights_onlywill be flipped toTrue. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=Truefor any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(resume_path, map_location=torch.device('cpu')) c:\users\me\downloads\openvoiceproject\modules\openvoice\openvoice\api.py:36: FutureWarning: You are usingtorch.loadwithweights_only=False(the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value forweights_onlywill be flipped toTrue. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=Truefor any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint_dict = torch.load(ckpt_path, map_location=torch.device(self.device)) Loaded checkpoint 'modules\OpenVoice\checkpoints_v2\converter/checkpoint.pth' missing/unexpected keys: [] [] OpenVoice version: v2 [(0.0, 58.8188125)] after vad: dur = 58.81798185941043 C:\Users\me\Downloads\OpenVoiceProject\.venv\lib\site-packages\torch\functional.py:704: UserWarning: stft with return_complex=False is deprecated. In a future pytorch release, stft will return complex tensors for all inputs, and return_complex=False will raise an error. Note: you can still call torch.view_as_real on the complex output to recover the old return format. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\SpectralOps.cpp:878.) return _VF.stft( # type: ignore[attr-defined] C:\Users\me\Downloads\OpenVoiceProject\.venv\lib\site-packages\torch\nn\utils\weight_norm.py:143: FutureWarning:torch.nn.utils.weight_normis deprecated in favor oftorch.nn.utils.parametrizations.weight_norm. WeightNorm.apply(module, name, dim) c:\users\me\downloads\openvoiceproject\modules\melotts\melo\download_utils.py:64: FutureWarning: You are using torch.loadwithweights_only=False(the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value forweights_onlywill be flipped toTrue. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=Truefor any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. return torch.load(ckpt_path, map_location=device) en-us c:\Users\me\Downloads\OpenVoiceProject\voice.py:41: FutureWarning: You are usingtorch.loadwithweights_only=False(the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value forweights_onlywill be flipped toTrue. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
source_se = torch.load(f'modules/OpenVoice/checkpoints_v2/base_speakers/ses/{speaker_key}.pth', map_location=self._device)

Text split to sentences.
Did you ever hear a folk tale about a giant turtle?

0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "c:\Users\me\Downloads\OpenVoiceProject\main.py", line 4, in
vs.openvoice_v2()
File "c:\Users\me\Downloads\OpenVoiceProject\voice.py", line 42, in openvoice_v2
model.tts_to_file(text, speaker_id, src_path, speed=speed)
File "c:\users\me\downloads\openvoiceproject\modules\melotts\melo\api.py", line 100, in tts_to_file
bert, ja_bert, phones, tones, lang_ids = utils.get_text_for_tts_infer(t, language, self.hps, device, self.symbol_to_id)
File "c:\users\me\downloads\openvoiceproject\modules\melotts\melo\utils.py", line 23, in get_text_for_tts_infer
norm_text, phone, tone, word2ph = clean_text(text, language_str)
File "c:\users\me\downloads\openvoiceproject\modules\melotts\melo\text\cleaner.py", line 12, in clean_text
phones, tones, word2ph = language_module.g2p(norm_text)
File "c:\users\me\downloads\openvoiceproject\modules\melotts\melo\text\english.py", line 242, in g2p
phone_list = list(filter(lambda p: p != " ", g2p(w)))
File "C:\Users\me\Downloads\OpenVoiceProject.venv\lib\site-packages\g2p_en\g2p.py", line 162, in call
tokens = pos_tag(words) # tuples of (word, tag)
File "C:\Users\me\Downloads\OpenVoiceProject.venv\lib\site-packages\nltk\tag_init
.py", line 168, in pos_tag
tagger = get_tagger(lang)
File "C:\Users\me\Downloads\OpenVoiceProject.venv\lib\site-packages\nltk\tag_init
.py", line 110, in get_tagger
tagger = PerceptronTagger()
File "C:\Users\me\Downloads\OpenVoiceProject.venv\lib\site-packages\nltk\tag\perceptron.py", line 183, in init
self.load_from_json(lang)
File "C:\Users\me\Downloads\OpenVoiceProject.venv\lib\site-packages\nltk\tag\perceptron.py", line 273, in load_from_json
loc = find(f"taggers/averaged_perceptron_tagger
{lang}/")
File "C:\Users\me\Downloads\OpenVoiceProject.venv\lib\site-packages\nltk\data.py", line 579, in find
raise LookupError(resource_not_found)
LookupError:


Resource averaged_perceptron_tagger_eng not found.
Please use the NLTK Downloader to obtain the resource:

import nltk
nltk.download('averaged_perceptron_tagger_eng')

For more information see: https://www.nltk.org/data.html

Attempted to load taggers/averaged_perceptron_tagger_eng/

Searched in:
- 'C:\Users\me/nltk_data'
- 'C:\Users\me\Downloads\OpenVoiceProject\.venv\nltk_data'
- 'C:\Users\me\Downloads\OpenVoiceProject\.venv\share\nltk_data'
- 'C:\Users\me\Downloads\OpenVoiceProject\.venv\lib\nltk_data'
- 'C:\Users\me\AppData\Roaming\nltk_data'
- 'C:\nltk_data'
- 'D:\nltk_data'
- 'E:\nltk_data'
**********************************************************************`

@Freashapples Freashapples closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2024
@Freashapples Freashapples reopened this Nov 17, 2024
@Georg-code
Copy link

I have the same issue, +1

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