nltk
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' **********************************************************************`
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.
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
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' **********************************************************************`
I have the same issue, +1
👉 Well, here is how it can be solved w.r.t a Linux system,
-
Go to nltk_data and download averaged_perceptron_tagger_eng
-
Unzip all the
*.jsonfiles in the folder$HOME/nltk_data/taggers/averaged_perceptron_tagger_eng -
Re-run the model
☕ Hope, maybe it helps !
downloading the nltk data manually worked ! thank @JustABeginning
downloading the nltk data manually worked ! thank @JustABeginning
Roll On !
I can confirm that manually download the NLTK data works on windows too:
Thank you! @kackcode, Option 2 worked for me on windows, I changed the download directory to C:\Users\me\AppData\Roaming\nltk_data. As per https://www.nltk.org/data.html for central installation, you can set the path to C:\nltk_data.
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.
for others: if this doesn't work you should read the error message. For me it was to download 'averaged_perceptron_tagger_eng'.