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

Update Dockerfile for the new voice cloning system. #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

meteokr
Copy link

@meteokr meteokr commented Jun 26, 2023

Fixing some of the issues created by the new voice cloning system in the Dockerfile. as mentioned in #40 . I've tagged a specific python version as the base image, so if that ever needs to be updated, it should be easy peasy. I changed it to copy the project files from the cloned directory, rather than pulling from the git repo during build, better for reproducibility. I added ffmpeg into the image to handle audio files other than pure .wav.

I cannot test CUDA, as I don't have any hardware to test on. CPU speech generation works perfectly, and feels faster, though I've not run benchmarks on it. However, the actual voice cloning features error on CPU.

Traceback (most recent call last):
  File "/bark/.local/lib/python3.10/site-packages/gradio/routes.py", line 437, in run_predict
    output = await app.get_blocks().process_api(
  File "/bark/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1352, in process_api
    result = await self.call_function(
  File "/bark/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1077, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/bark/.local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/bark/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/bark/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/bark/.local/lib/python3.10/site-packages/gradio/helpers.py", line 602, in tracked_fn
    response = fn(*args)
  File "/bark/bark-gui/cloning/clonevoice.py", line 34, in clone_voice
    tokenizer = CustomTokenizer.load_from_checkpoint(f'./models/hubert/{tokenizer_lang}_tokenizer.pth').to(device)  # Automatically uses the right layers
  File "/bark/bark-gui/bark/hubert/customtokenizer.py", line 121, in load_from_checkpoint
    model.load_state_dict(torch.load(path))
  File "/bark/.local/lib/python3.10/site-packages/torch/serialization.py", line 809, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "/bark/.local/lib/python3.10/site-packages/torch/serialization.py", line 1172, in _load
    result = unpickler.load()
  File "/bark/.local/lib/python3.10/site-packages/torch/serialization.py", line 1142, in persistent_load
    typed_storage = load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
  File "/bark/.local/lib/python3.10/site-packages/torch/serialization.py", line 1116, in load_tensor
    wrap_storage=restore_location(storage, location),
  File "/bark/.local/lib/python3.10/site-packages/torch/serialization.py", line 217, in default_restore_location
    result = fn(storage, location)
  File "/bark/.local/lib/python3.10/site-packages/torch/serialization.py", line 182, in _cuda_deserialize
    device = validate_cuda_device(location)
  File "/bark/.local/lib/python3.10/site-packages/torch/serialization.py", line 166, in validate_cuda_device
    raise RuntimeError('Attempting to deserialize object on a CUDA '
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

During startup it does display forcecpu=True, so maybe something isn't respecting the config?

During the build, I do get this:
INFO | fairseq.tasks.text_to_speech | Please install tensorboardX: pip install tensorboardX
Should this be added as a dependency?

You are free to delay this merge until these are resolved, but other than voice cloning, this image works.


# Clone git repo
RUN git clone https://github.com/C0untFloyd/bark-gui

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, where sources supposed to be?

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

Successfully merging this pull request may close these issues.

2 participants