bark icon indicating copy to clipboard operation
bark copied to clipboard

Running example, hangs and then is killed

Open smithlt opened this issue 2 years ago • 9 comments

It hangs for a long time. Only output is:

$ python3.8 demo.py Killed

Any ideas? It's a Google Cloud instance.

$ uname -r 4.19.0-23-cloud-amd64

smithlt avatar Apr 30 '23 00:04 smithlt

which demo file is this? does it come from a fork or what does it contain?

gkucsko avatar Apr 30 '23 13:04 gkucsko

It's the first demo from the README

Edit: I also tried removing workbook audio playback (the last line) to see if that was the problem, no dice.

smithlt avatar Apr 30 '23 21:04 smithlt

Here's the complete file

$ cat demo.py
from bark import SAMPLE_RATE, generate_audio, preload_models
from IPython.display import Audio
from scipy.io.wavfile import write as write_wav

# download and load all models
preload_models()

# generate audio from text
text_prompt = """
     Hello, my name is Suno. And, uh — and I like pizza. [laughs] 
     But I also have other interests such as playing tic tac toe.
"""
audio_array = generate_audio(text_prompt)

smithlt avatar Apr 30 '23 21:04 smithlt

which Google Cloud instance type is this? CPU or GPU? If you run preload_models() by itself does it still crash?

mcamac avatar Apr 30 '23 21:04 mcamac

Machine configuration

Machine type n1-standard-1 CPU platform Intel Skylake Architecture — vCPUs to core ratio

—

Custom visible cores — Display device Disabled Enable to use screen capturing and recording tools GPUs 1 x NVIDIA T4

smithlt avatar May 01 '23 01:05 smithlt

Seems to hang in the same way when only preload_models() is included.

A bad dependency? Is there a docker image out there for running bark?

smithlt avatar May 01 '23 01:05 smithlt

don't you need to turn this into a proper script to run it? have you tried running it in a notebook or ipython?

gkucsko avatar May 01 '23 22:05 gkucsko

what does proper script mean

smithlt avatar May 05 '23 02:05 smithlt

hm, actually can you just try running it in ipython or a notebook and see what happens? wondering if you are for some reason just not seeing the logging messages that download the models etc.

gkucsko avatar May 05 '23 14:05 gkucsko

---instance-1:/opt/repos/bark$ ipython
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
Type 'copyright', 'credits' or 'license' for more information
IPython 8.13.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 

In [1]: from bark import SAMPLE_RATE, generate_audio, preload_models
   ...: from IPython.display import Audio
   ...: from scipy.io.wavfile import write as write_wav
   ...: 
   ...: # download and load all models
   ...: preload_models()
   ...: 
   ...: # generate audio from text
   ...: text_prompt = """
   ...:      Hello, my name is Suno. And, uh — and I like pizza. [laughs] 
   ...:      But I also have other interests such as playing tic tac toe.
   ...: """
   ...: audio_array = generate_audio(text_prompt)
No GPU being used. Careful, inference might be very slow!
Killed

Maybe getting it to use a GPU (different instance) might help?

smithlt avatar May 06 '23 22:05 smithlt

would definitely make it faster. on cpu it can take minutes or longer per sample

gkucsko avatar May 07 '23 23:05 gkucsko

gonna close for inactivity. feel free to reopen if not fixed

gkucsko avatar May 11 '23 18:05 gkucsko

I am getting the same issue. I do not know why it is killed.

I successfully ran it 2 times, but starting from the 3rd attempt it hangs and is killed. I am also running on CPU without a discreet GPU on this laptop.

Alnounou-UHCL avatar Oct 12 '23 15:10 Alnounou-UHCL

I experienced the same issue when running Bark on GCP, and I resolved it by increasing the amount of RAM to 16 GB.

Also, when running Bark, you'll quickly run out of storage, so also keep an eye on that.

mpastewski avatar Nov 20 '23 18:11 mpastewski

About that, do you know of a way to clear the allocated storage? When using a GPU I could clear the allocated memory as well as reduce the model sizes and that resolved my issues. I do not know how to do that for CPU runs, I can reduce the model sizes, but clearing them after I am done generating an audio file is where I'm stuck at.

Alnounou-UHCL avatar Nov 21 '23 00:11 Alnounou-UHCL