daswer123 / xtts-finetune-webui

Slightly improved official version for finetune xtts
154 stars 52 forks source link

"is a directory" error when attempting to train #26

Open jurassicjordan opened 1 month ago

jurassicjordan commented 1 month ago

Traceback (most recent call last): File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/queueing.py", line 459, in call_prediction output = await route_utils.call_process_api( File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/route_utils.py", line 232, in call_process_api output = await app.get_blocks().process_api( File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/blocks.py", line 1533, in process_api result = await self.call_function( File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/blocks.py", line 1151, in call_function prediction = await anyio.to_thread.run_sync( File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, args) File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/utils.py", line 678, in wrapper response = f(args, kwargs) File "/home/jordancruz/Tools/xtts-finetune-webui/xtts_demo.py", line 339, in train_model os.remove(run_dir) IsADirectoryError: [Errno 21] Is a directory: '/home/jordancruz/Tools/xtts-finetune-webui/finetune_models/run' Traceback (most recent call last): File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/queueing.py", line 459, in call_prediction output = await route_utils.call_process_api( File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/route_utils.py", line 232, in call_process_api output = await app.get_blocks().process_api( File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/blocks.py", line 1533, in process_api result = await self.call_function( File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/blocks.py", line 1151, in call_function prediction = await anyio.to_thread.run_sync( File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, args) File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/utils.py", line 678, in wrapper response = f(args, kwargs) File "/home/jordancruz/Tools/xtts-finetune-webui/xtts_demo.py", line 339, in train_model os.remove(run_dir) IsADirectoryError: [Errno 21] Is a directory: '/home/jordancruz/Tools/xtts-finetune-webui/finetune_models/run'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/queueing.py", line 497, in process_events response = await self.call_prediction(awake_events, batch) File "/home/jordancruz/anaconda3/envs/xttsFT/lib/python3.10/site-packages/gradio/queueing.py", line 468, in call_prediction raise Exception(str(error) if show_error else None) from error Exception: None

tom2698 commented 1 month ago

I ran into the same issue after training a model, inferencing then going back to the data processing tab, removing the clip and adding a new one then trying to train. The hacky fix was just to delete the finetune models folder and restart the program.

jurassicjordan commented 1 month ago

I ran into the same issue after training a model, inferencing then going back to the data processing tab, removing the clip and adding a new one then trying to train. The hacky fix was just to delete the finetune models folder and restart the program.

this would be my fix but I havent even trained a single model yet

TickStop commented 1 week ago

It seems like the reason for this error is that os.remove will only delete empty folders. When training a new model, the folder "finetune_models/run" will already exist and have files of the previously trained model inside. shutil.rmtree, on the other hand, will delete a folder along with all its contents.

To fix this right away, you can open the file "xtts_demo.py" in a text editor and replace

if run_dir.exists():
    os.remove(run_dir)

which you can find close to def train_model with this:

if run_dir.exists():
    shutil.rmtree(run_dir)