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

Bark+Vocos.ipynb fails on saving mp3 files with error about FFmpeg backend #36

Open
PolarNick239 opened this issue Nov 20, 2023 · 0 comments

Comments

@PolarNick239
Copy link

Thanks a lot for this repository! This is very useful and thanks a lot for great notebook about Bark+Vocos integration!

Error

I tried to follow notebook Bark+Vocos.ipynb but encountered the following error:

Traceback (most recent call last):
  File ".../bark_vocos_usage.py", line 66, in <module>
    torchaudio.save("encodec.mp3", encodec_output[None, :], 44100, compression=128)
  File ".../venv/lib/python3.10/site-packages/torchaudio/_backend/utils.py", line 312, in save
    return backend.save(
  File ".../venv/lib/python3.10/site-packages/torchaudio/_backend/ffmpeg.py", line 351, in save
    raise ValueError(
ValueError: ('FFmpeg backend expects non-`None` value for argument `compression` to be of ', "type `torchaudio.io.CodecConfig`, but received value of type <class 'int'>")

Workaround

For me it works if I replace these two last lines:

torchaudio.save("encodec.mp3", encodec_output[None, :], 44100, compression=128)
torchaudio.save("vocos.mp3", vocos_output, 44100, compression=128)

with these:

torchaudio.save("encodec.mp3", encodec_output[None, :], 44100, compression=torchaudio.io.CodecConfig(bit_rate=320))
torchaudio.save("vocos.mp3", vocos_output, 44100, compression=torchaudio.io.CodecConfig(bit_rate=320))

pip freeze

Just in case this will help somebody someday - for me it works after installing torch with pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 and IPython with pip install ipython. And these packages were finally installed:

annotated-types==0.6.0
asttokens==2.4.1
audioread==3.0.1
boto3==1.29.3
botocore==1.32.3
certifi==2022.12.7
cffi==1.16.0
charset-normalizer==2.1.1
cmake==3.25.0
decorator==5.1.1
einops==0.7.0
encodec==0.1.1
exceptiongroup==1.1.3
executing==2.0.1
filelock==3.9.0
fsspec==2023.10.0
funcy==2.0
huggingface-hub==0.19.4
idna==3.4
inflect==7.0.0
ipython==8.17.2
jedi==0.19.1
Jinja2==3.1.2
jmespath==1.0.1
joblib==1.3.2
lazy_loader==0.3
librosa==0.10.1
lit==15.0.7
llvmlite==0.41.1
MarkupSafe==2.1.3
matplotlib-inline==0.1.6
mpmath==1.3.0
msgpack==1.0.7
networkx==3.0
numba==0.58.1
numpy==1.24.1
packaging==23.2
parso==0.8.3
pexpect==4.8.0
Pillow==9.3.0
platformdirs==4.0.0
pooch==1.8.0
progressbar==2.5
prompt-toolkit==3.0.41
ptyprocess==0.7.0
pure-eval==0.2.2
pycparser==2.21
pydantic==2.5.1
pydantic_core==2.14.3
Pygments==2.17.1
python-dateutil==2.8.2
PyYAML==6.0.1
regex==2023.10.3
requests==2.28.1
rotary-embedding-torch==0.3.5
s3transfer==0.7.0
safetensors==0.4.0
scikit-learn==1.3.2
scipy==1.11.4
six==1.16.0
soundfile==0.12.1
soxr==0.3.7
stack-data==0.6.3
suno-bark @ git+https://github.com/suno-ai/bark.git@773624d26db84278a55aacae9a16d7b25fbccab8
sympy==1.12
threadpoolctl==3.2.0
tokenizers==0.13.3
torch==2.1.1+cu118
torchaudio==2.1.1+cu118
torchvision==0.16.1+cu118
tortoise-tts @ git+https://github.com/neonbjb/tortoise-tts@80f89987a5abda5e2b082618cd74f9c7411141dc
tqdm==4.66.1
traitlets==5.13.0
transformers==4.31.0
triton==2.1.0
typing_extensions==4.8.0
Unidecode==1.3.7
urllib3==1.26.13
vocos==0.1.0
wcwidth==0.2.10
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

1 participant