C0untFloyd / bark-gui

🔊 Text-Prompted Generative Audio Model with Gradio
MIT License
674 stars 63 forks source link

Possible fairseq problems, container building errors #40

Open meteokr opened 1 year ago

meteokr commented 1 year ago

I am running the container version of this on a Linux host. The current Dockerfile doesn't build, so I made some small edits. Pip complains if the dependencies are installed on top of system packages, and while I'm comfortable with Docker I'm not very familiar with Python pkg management. I added python3-venv to the system package list, then changed the dependencies install steps to use a virtual environment and then installing so that I could get a build going.

FROM debian:stable

# Install system packages
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y \
        git \
        python3-venv \
        pip \
        ffmpeg

# Create non-root user
RUN useradd -m -d /bark bark

# Run as new user
USER bark
WORKDIR /bark

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

# Switch to git directory
WORKDIR /bark/bark-gui

# Append pip bin path to PATH
ENV PATH=$PATH:/bark/.local/bin

# Install dependancies
RUN python3 -m venv .venv &&\
        . .venv/bin/activate &&\
        pip install . &&\
        pip install -r requirements.txt

# List on all addresses, since we are in a container.
RUN sed -i "s/server_name: ''/server_name: 0.0.0.0/g" ./config.yaml

# Suggested volumes
VOLUME /bark/bark-gui/assets/prompts/custom
VOLUME /bark/bark-gui/models
VOLUME /bark/.cache/huggingface/hub

# Default port for web-ui
EXPOSE 7860/tcp

# Start script
CMD . .venv/bin/activate && python3 webui.py

This got a successful build, but the actual error I get on run is this.

Traceback (most recent call last):
  File "/bark/bark-gui/webui.py", line 21, in <module>
    from cloning.clonevoice import clone_voice
  File "/bark/bark-gui/cloning/clonevoice.py", line 4, in <module>
    from bark.hubert.pre_kmeans_hubert import CustomHubert
  File "/bark/bark-gui/bark/hubert/pre_kmeans_hubert.py", line 16, in <module>
    import fairseq
  File "/bark/bark-gui/.venv/lib/python3.11/site-packages/fairseq/__init__.py", line 20, in <module>
    from fairseq.distributed import utils as distributed_utils
  File "/bark/bark-gui/.venv/lib/python3.11/site-packages/fairseq/distributed/__init__.py", line 7, in <module>
    from .fully_sharded_data_parallel import (
  File "/bark/bark-gui/.venv/lib/python3.11/site-packages/fairseq/distributed/fully_sharded_data_parallel.py", line 10, in <module>
    from fairseq.dataclass.configs import DistributedTrainingConfig
  File "/bark/bark-gui/.venv/lib/python3.11/site-packages/fairseq/dataclass/__init__.py", line 6, in <module>
    from .configs import FairseqDataclass
  File "/bark/bark-gui/.venv/lib/python3.11/site-packages/fairseq/dataclass/configs.py", line 1104, in <module>
    @dataclass
     ^^^^^^^^^
  File "/usr/lib/python3.11/dataclasses.py", line 1220, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/usr/lib/python3.11/dataclasses.py", line 1210, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory

Is this an error on my python install, or something else?

C0untFloyd commented 1 year ago

Good job on the adapted dockerfile, may I include this into the repo? Sorry for answering late, I'm by no means a docker expert. Googled this error and indeed it seems to be caused by your python version: https://github.com/huggingface/datasets/issues/5230

I'm running Bark successfully with Python 3.10.

rohitsainier commented 1 year ago

i am facing the same issue with version python 3.11.3 i cannot degrade the version as i have some other stuff which require 3.11 File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 815, in _getfield raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default factory @C0untFloyd

only happing when i am trying to clone the voice