devidw / dswav

The Unlicense
15 stars 0 forks source link

Directory not automatically created & index.json missing #9

Open ArrowM opened 9 months ago

ArrowM commented 9 months ago

First of all, thank you for you work on this project! I am attempting to run this with Docker + WSL2. I'm getting some parts to work, but having issues with others. I'll document everything here.

EDIT

I'll leave my issue descriptions below, but I've figured out some fixes for them that I'll put here above. I'm pretty confused because the code in Docker's version of the files doesn't seem to match this repo, otherwise I'd make a PR.

Fixing # 2

/app/dswav/__main__.py:23 add

    if not os.path.exists(f"{config.project_path}/ds/wavs"):
        os.mkdir(f"{config.project_path}/ds/wavs")

This code seems to be in this repo, but missing from the docker code.

Fixing # 3

/app/dswav/ds.py:231 add

        if merge:

It seems like config.merges is populated with [""] by default, so it searches for ./index.json even if you leave the UI box blank. Adding the if statement skips the blank string. There might be a better solution, but this works well enough for me.

Fixing # 1 and # 4

I haven't fixed these, please consider them :)

Issues

1. Input Audio File Path

The way to format that path may not be immediately obvious to Windows users. A tooltip like:

formatted as ./projects/{project_name}/{audio_file}" where you replace project_name and audio_file. Do not use a full path

would be useful.

2. wavs directory not created automatically.

The {project}/ds directory is created automatically, but {project}/ds/wavs is not. As a result, the wav files are never written out and the rest of the process fails. I can make it manually for now, I'm not sure where automatic creation should be added in the code.

3. [Errno 2] No such file or directory: '/index.json'

  File "/app/dswav/__main__.py", line 34, in build_handler
    process(config)
  File "/app/dswav/ds.py", line 203, in process
    merge_sentences = add_merges(config)
                      ^^^^^^^^^^^^^^^^^^
  File "/app/dswav/ds.py", line 231, in add_merges
    with open(f"{merge}/index.json", "r") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/index.json'

This is where I am currently stuck. I'm assuming I need to put something in the last box of the Gradio UI, but even after reading the label "List of paths to folders with contents..." a few times, I still have no idea what I'm supposed to do. I'm hoping you could elaborate on what needs to be done with an index file. If it helps, I'm hoping to use this output formatted for TTS, LJSpeech.

4. Copying results out of the Docker container

It would be nice to automatically write out the result in the same directory as the input audio file. Or to have a CMD arg for a result output path. I'm guessing not everyone will know to look in the docker files.

devidw commented 8 months ago

Hey @ArrowM

Thanks for your notes

I'm pretty confused because the code in Docker's version of the files doesn't seem to match this repo, otherwise I'd make a PR.

Yea, so the initial version i pushed to the registry but the following changes i only pushed the code but not the updated image, hence the difference between those.

I just added some workflow config that will auto-rebuild & push the latest image on every push to main :)

It would be nice to automatically write out the result in the same directory as the input audio file. Or to have a CMD arg for a result output path. I'm guessing not everyone will know to look in the docker files.

How you do this with docker is mount part of you local fs into the docker container using a volume

In the readme the exmaple does it like this:

docker run \
  -p 7860:7860 \
  -v ./projects:/app/projects \ <--- v for volume goes here you map your local dir on the left to the in-container dir on the right
  ghcr.io/devidw/dswav:main

For your other points, these are valid notes, i was just iterating in fast steps on this repo without documenting everything so i can see how this might be confusing, let me put some simple docs into the readme when i get the chance