EveryVoiceTTS / EveryVoiceTTS/EveryVoice
Can't synthesize in demo if someone else left /tmp/gradio on the system
- Dominant language
- Python
- Stars
- 45
- Forks
- 4
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 14
Description
### Bug description
If you try to run the demo on a machine where another user ran it, and for some reason the temporary files in `/tmp/gradio` did not get cleaned up correctly, the demo starts but synthesizing in the demo systematically yields on error.
### How to reproduce the bug
Have another user run
```
mkdir /tmp/gradio
chmod 755 /tmp/gradio
```
Then run
```
everyvoice demo logs_and_checkpoints/FeaturePredictionExperiment/base/checkpoints/last.ckpt logs_and_checkpoints/VocoderExperiment/base/checkpoints/last.ckpt
```
and try to synthesize any files.
Note that gradio normally cleans up its temporary files, so the problem would only "naturally" come up if the demo crashed and could not run its normal clean up routine.
### Error messages and logs
The key part of the error log:
```
PermissionError: [Errno 13] Permission denied: '/tmp/gradio/dc71cb5cb269542f07afeb274a850cb2ff87cfec63fd48e69027beed8976e24b'
```
full log
```
Predicting DataLoader 0: 100%|████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 4.01it/s]^CTraceback (most recent call last):
File "/home/joanise/uvenvs/ev-py312/lib/python3.12/site-packages/gradio/queueing.py", line 625, in process_events
response = await route_utils.call_process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joanise/uvenvs/ev-py312/lib/python3.12/site-packages/gradio/route_utils.py", line 322, in call_process_api
output = await app.get_blocks().process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joanise/uvenvs/ev-py312/lib/python3.12/site-packages/gradio/blocks.py", line 2203, in process_api
data = await self.postprocess_data(block_fn, result["prediction"], state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joanise/uvenvs/ev-py312/lib/python3.12/site-packages/gradio/blocks.py", line 1991, in postprocess_data
await processing_utils.async_move_files_to_cache(
File "/home/joanise/uvenvs/ev-py312/lib/python3.12/site-packages/gradio/processing_utils.py", line 652, in async_move_files_to_cache
return await client_utils.async_traverse(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joanise/uvenvs/ev-py312/lib/python3.12/site-packages/gradio_client/utils.py", line 1129, in async_traverse
return await func(json_obj)
^^^^^^^^^^^^^^^^^^^^
File "/home/joanise/uvenvs/ev-py312/lib/python3.12/site-packages/gradio/processing_utils.py", line 625, in _move_to_cache
temp_file_path = await block.async_move_resource_to_block_cache(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joanise/uvenvs/ev-py312/lib/python3.12/site-packages/gradio/blocks.py", line 341, in async_move_resource_to_block_cache
temp_file_path = processing_utils.save_file_to_cache(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joanise/uvenvs/ev-py312/lib/python3.12/site-packages/gradio/processing_utils.py", line 279, in save_file_to_cache
temp_dir.mkdir(exist_ok=True, parents=True)
File "/home/joanise/.local/share/uv/python/cpython-3.12.10-linux-x86_64-gnu/lib/python3.12/pathlib.py", line 1311, in mkdir
os.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/tmp/gradio/dc71cb5cb269542f07afeb274a850cb2ff87cfec63fd48e69027beed8976e24b'
```
### Work-around
If you run
GRADIO_TEMP_DIR=. everyvoice demo ...
then gradio creates its temporary directory in your current working direct instead of in /tmp, so things work.
### Possible solution
Gradio lets the user pick a temporary directory via this `GRADIO_TEMP_DIR` environment variable, but not programmatically. A dirty solution would be to use `os.environ["GRADIO_TEMP_DIR"] = "."` before importing gradio, but I hope there's a cleaner way.
Contributor guide
Assessment
This issue has not been assessed yet.