daswer123 / xtts-finetune-webui

Slightly improved official version for finetune xtts
198 stars 69 forks source link

IsADirectoryError: [Errno 21] Is a directory: './xtts-finetune-webui/finetune_models/run' #43

Closed krones9000 closed 1 week ago

krones9000 commented 1 month ago

Hi. Apologies as I would suggest this as an edit but still getting my head around github etc. Basically I encountered the error in the title when trying to run the finetune training on linux (after creating the dataset).

Debugging the error, it appears that instead of (line 361) "os.remove(run_dir)" it should read "shutil.rmtree(run_dir)", as the error indicates that the code is attempting to use os.remove() to delete a directory, which is not allowed because os.remove() is only for removing files.

Swapping that line does indeed allow the training to run for me.

I may have made a mistake or I may have caused the error somehow but hopefully you can either help me understand what I got wrong or implement the fix if it is indeed a working fix :)

TheMechanicX32 commented 1 month ago

Long story short, os.remove can't remove the 'run' directory because it can't remove directories. Replacing the line like you did is the correct way to remove directories, which fixes the error. That's why the shutil framework is used instead of the os framework.

I also got the same error and fixed it the same way you did.

Alternatively, you can just manually delete the run directory.