You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Installed this library with pip install git+https://github.com/suno-ai/bark.git
And then basically copy and pasted the starter code in the readme file:
from transformers import AutoProcessor, BarkModel
import scipy
import os
os.environ["SUNO_OFFLOAD_CPU"] = "True"
os.environ["SUNO_USE_SMALL_MODELS"] = "True"
processor = AutoProcessor.from_pretrained("suno/bark")
model = BarkModel.from_pretrained("suno/bark")
voice_preset = "v2/en_speaker_6"
inputs = processor("Hello, my dog is cute", voice_preset=voice_preset)
audio_array = model.generate(**inputs)
audio_array = audio_array.cpu().numpy().squeeze()
# write to a wav file:
sample_rate = model.generation_config.sample_rate
scipy.io.wavfile.write("bark_out.wav", rate=sample_rate, data=audio_array)
When I run this, I get the following two errors:
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "c:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\main.py", line 1, in <module>
from transformers import AutoProcessor, BarkModel
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\transformers\__init__.py", line 26, in <module>
from . import dependency_versions_check
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\transformers\dependency_versions_check.py", line 16, in <module>
from .utils.versions import require_version, require_version_core
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\transformers\utils\__init__.py", line 34, in <module>
from .generic import (
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\transformers\utils\generic.py", line 462, in <module>
import torch.utils._pytree as _torch_pytree
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\torch\__init__.py", line 2120, in <module>
from torch._higher_order_ops import cond
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\torch\_higher_order_ops\__init__.py", line 1, in <module>
from .cond import cond
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\torch\_higher_order_ops\cond.py", line 5, in <module>
import torch._subclasses.functional_tensor
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\torch\_subclasses\functional_tensor.py", line 42, in <module>
class FunctionalTensor(torch.Tensor):
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\torch\_subclasses\functional_tensor.py", line 258, in FunctionalTensor
cpu = _conversion_method_template(device=torch.device("cpu"))
C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\torch\_subclasses\functional_tensor.py:258: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\utils\tensor_numpy.cpp:84.)
cpu = _conversion_method_template(device=torch.device("cpu"))
C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\torch\nn\utils\weight_norm.py:134: FutureWarning: `torch.nn.utils.weight_norm` is deprecated in favor of `torch.nn.utils.parametrizations.weight_norm`.
WeightNorm.apply(module, name, dim)
C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\transformers\models\encodec\modeling_encodec.py:120: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
self.register_buffer("padding_total", torch.tensor(kernel_size - stride, dtype=torch.int64), persistent=False)
Traceback (most recent call last):
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\transformers\feature_extraction_utils.py", line 190, in convert_to_tensors
tensor = as_tensor(value)
^^^^^^^^^^^^^^^^
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\transformers\feature_extraction_utils.py", line 149, in as_tensor
return torch.tensor(value)
^^^^^^^^^^^^^^^^^^^
RuntimeError: Could not infer dtype of numpy.int64
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\main.py", line 13, in <module>
inputs = processor("Hello, my dog is cute", voice_preset=voice_preset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\transformers\models\bark\processing_bark.py", line 271, in __call__
voice_preset = BatchFeature(data=voice_preset, tensor_type=return_tensors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\transformers\feature_extraction_utils.py", line 79, in __init__
self.convert_to_tensors(tensor_type=tensor_type)
File "C:\Users\ikech\Documents\CodingProjects\BarkTextToSpeech\.venv\Lib\site-packages\transformers\feature_extraction_utils.py", line 196, in convert_to_tensors
raise ValueError(
ValueError: Unable to create tensor, you should probably activate padding with 'padding=True' to have batched tensors with the same length.
I'm a bit new to working with this library. Please assist if possible.
The text was updated successfully, but these errors were encountered:
Hi.
I am attempting to get bark set up on my local machine.
Here are the following steps that I have done:
transformers
package suingpip install transformers
pip install git+https://github.com/suno-ai/bark.git
When I run this, I get the following two errors:
I'm a bit new to working with this library. Please assist if possible.
The text was updated successfully, but these errors were encountered: