Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Commit 6095ade doesn't check for existing temporary folder #10787

Closed
1 task done
fabbarix opened this issue May 28, 2023 · 4 comments
Closed
1 task done

[Bug]: Commit 6095ade doesn't check for existing temporary folder #10787

fabbarix opened this issue May 28, 2023 · 4 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@fabbarix
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

Commit 6095ade doesn't check for existing target folder, so if /tmp/gradio doesn't exist it will fail to show the final image.

Note that /tmp/gradio is not there when images are saved.

Steps to reproduce the problem

  1. Remove folder /tmp/gradio - if it exists
  2. Generate an image
  3. Fails with FileNotFoundError: [Errno 2] No such file or directory: '/tmp/gradio/xxxxxxxxxx.png'

What should have happened?

It should have created the image in the folder, after ensuring that the folder was there.

Commit where the problem happens

6095ade

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Linux

What device are you running WebUI on?

Nvidia GPUs (RTX 20 above)

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--xformers

List of extensions

No

Console logs

100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.81it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:03<00:00,  5.50it/s]
Traceback (most recent call last):█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:03<00:00,  5.42it/s]
  File "/opt/mrwho/Projects/ml/automatic/stable-diffusion-webui/venv/lib/python3.11/site-packages/gradio/routes.py", line 422, in run_predict
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mrwho/Projects/ml/automatic/stable-diffusion-webui/venv/lib/python3.11/site-packages/gradio/blocks.py", line 1326, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mrwho/Projects/ml/automatic/stable-diffusion-webui/venv/lib/python3.11/site-packages/gradio/blocks.py", line 1260, in postprocess_data
    prediction_value = block.postprocess(prediction_value)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mrwho/Projects/ml/automatic/stable-diffusion-webui/venv/lib/python3.11/site-packages/gradio/components.py", line 4461, in postprocess
    file = self.pil_to_temp_file(img, dir=self.DEFAULT_TEMP_DIR)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mrwho/Projects/ml/automatic/stable-diffusion-webui/modules/ui_tempdir.py", line 55, in save_pil_to_file
    file_obj = tempfile.NamedTemporaryFile(delete=False, suffix=".png", dir=dir)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/tempfile.py", line 702, in NamedTemporaryFile
    file = _io.open(dir, mode, buffering=buffering,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/tempfile.py", line 699, in opener
    fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/tempfile.py", line 395, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/gradio/tmp9r7i2awg.png'

Additional information

No response

@fabbarix fabbarix added the bug-report Report of a bug, yet to be confirmed label May 28, 2023
@fabbarix fabbarix changed the title [Bug]: Commit 6095ade doesn't check for existing temporaty folder [Bug]: Commit 6095ade doesn't check for existing temporary folder May 28, 2023
@sololll
Copy link

sololll commented May 29, 2023

Oh,so this is a bug.

I asked , no reply yet.
#10825

@tomvb
Copy link

tomvb commented Jun 5, 2023

Same issue on macos

@bjornlarssen
Copy link

Same issue on Colab. I was training embeddings most of the day, testing them (so I did generate images), went away for a while, came back to this. Nothing changed, WebUI 1.4.0 before and after. No clue what to do. Colab deletes everything when I disconnect, so the folder wasn't there before and isn't there now.

@akx akx added the platform:mac Issues that apply to Apple OS X, M1, M2, etc label Jul 26, 2023
@catboxanon catboxanon removed the platform:mac Issues that apply to Apple OS X, M1, M2, etc label Aug 3, 2023
@catboxanon
Copy link
Collaborator

Fixed in #12717

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

6 participants