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

fix: gradio's ValueError about fetching extensions files #8492

Merged
merged 6 commits into from
Mar 12, 2023
Merged

fix: gradio's ValueError about fetching extensions files #8492

merged 6 commits into from
Mar 12, 2023

Conversation

arenekosreal
Copy link
Contributor

@arenekosreal arenekosreal commented Mar 11, 2023

Describe what this pull request is trying to achieve.

Let all file paths that script try to read/write be absolute.

Currently, if we set --data-dir to a path like /path/to/data which is outside the repo, gradio will complain about that the /path/to/data/extensions is not inside of the working directory. This pull request helps with it, with this pull request, we can use any working directory. As for the issue mentioned before, we can use /path/to/webui for this repo and /path/to/data for keeping data, the only to do is setting working directory to /path/to

Additional notes and description of your changes

See #7028 for more info about the compilation of gradio

For some extensions and even some parts of this project, if they assume the working directory is always the repo's root, this pull request may be an incompatible change for them.

I have tested on my PC and it seems to work well, but I failed to run tests mentioned in wiki successfully even with unchanged code. So I let this pull request be a draft and prepare for more tests for this pull request. I think this pull request is ready to be reviewed.

What's more, output dir is outputs by default, which is always relative to working directory. But I don't find how to change it correctly. Maybe we should let it be relative to --data-dir or implementing #3776 is a good idea.

Environment this was tested in

List the environment you have developed / tested this on. As per the contributing page, changes should be able to work on Windows out of the box.

  • OS: Ubuntu 22.04
  • Browser: Librewolf(a Firefox fork)
  • Graphics card: NVIDIA GTX 1050Ti Mobile

Note: OS is actually an Arch Linux runs a Podman rootless container based on nvidia/cuda:11.7.1-runtime-ubuntu22.04 image with requirements installed.
Screenshots or videos of your changes

N/A

This may be helpful for
#7028,
because we won't change working directory to the repo now, instead,
we will use any working directory. If we set working directory to
a path contains repo and the custom --data-dir, the problem in this
issue should be solved.

Howewer, this may be treated as an incompatible change if some code
assume the working directory is always the repo.

Also, there may be another solution that always let --data-dir be the
subdirectory of the repo, but personally I think this may not be what
we actually need.

As this issue mainly influent on Docker and I am not familiar with
.bat files, updating webui.bat is skipped.

webui.sh: source env from repo instead $PWD
launch.py: using getcwd() instead curdir

launch.py: use absolute path for preparing

also remove chdir()

launch.py: use absolute path for test

launch.py: add default script_path and data_path
test/server_poll.py: fix absolute path
@arenekosreal arenekosreal marked this pull request as ready for review March 11, 2023 12:09
@AUTOMATIC1111 AUTOMATIC1111 merged commit adf723a into AUTOMATIC1111:master Mar 12, 2023
@AUTOMATIC1111
Copy link
Owner

modules.* should not be imported in launch.py.

AUTOMATIC1111 added a commit that referenced this pull request Mar 12, 2023
@AUTOMATIC1111
Copy link
Owner

There is a problem people are getting with webui.sh after this PR. See #8534.

@ParityError
Copy link
Contributor

Submitted pull request #8563 to solve the issue associated with #8534.

serg4kostiuk pushed a commit to talkable/stable-diffusion-webui that referenced this pull request Mar 22, 2023
fix: gradio's ValueError about fetching extensions files
serg4kostiuk pushed a commit to talkable/stable-diffusion-webui that referenced this pull request Mar 22, 2023
serg4kostiuk pushed a commit to talkable/stable-diffusion-webui that referenced this pull request Mar 22, 2023
serg4kostiuk pushed a commit to talkable/stable-diffusion-webui that referenced this pull request Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants