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

Minor fix #10381

Merged
merged 5 commits into from
May 18, 2023
Merged

Minor fix #10381

merged 5 commits into from
May 18, 2023

Conversation

Sakura-Luna
Copy link
Collaborator

@Sakura-Luna Sakura-Luna commented May 14, 2023

This PR tries to close #10331

@AUTOMATIC1111
Copy link
Owner

Changing --extra-index-url to --index-url makes the install fail for the first time user when it tries to find packages required by torch and fails because we only have nvidia-torch url available.

As for the question mark in image names, I'd rather remove the question mark than downgrade gradio for it.

@Sakura-Luna
Copy link
Collaborator Author

Sakura-Luna commented May 14, 2023

In the previous pr, there was an example where extra-index-url did not work but index-url worked. But this is just consistent with the official one.
image

@AUTOMATIC1111
Copy link
Owner

Well, I tried --index-url on an empty install and it failed for me.

@Sakura-Luna
Copy link
Collaborator Author

Not sure what PyTorch does, both look like they only index pytorch.org.

@Sakura-Luna
Copy link
Collaborator Author

As for the question mark in image names, I'd rather remove the question mark than downgrade gradio for it.

I checked it and it has nothing to do with Gradio and WebUI, it's an environment related issue.

@AUTOMATIC1111 AUTOMATIC1111 changed the base branch from master to dev May 17, 2023 17:35
@AUTOMATIC1111
Copy link
Owner

All right. There is a problem. Tests here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/6b51cc7530dd70037681c108a65c55d52ed918ef/.github/workflows/run_tests.yaml#LL26C11-L26C64 install CPU torch using the same command. So if the command is changed in the way this PR is suggesting, test will fail. We can edit edit tests to explicitly specify the command there, but then we'd have to keep torch version updated in two places: in launch and in tests. So the question is, is this fix really useful?

@hyuan-kamuda
Copy link

Changes from:
torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118")

to

torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118")

It does not work? Still has problem of "RuntimeError: Detected that PyTorch and torchvision were compiled with different CUDA versions. PyTorch has CUDA Version=11.7 and torchvision has CUDA Version=11.8. Please reinstall the torchvision that matches your PyTorch install."

@Sakura-Luna
Copy link
Collaborator Author

Sakura-Luna commented May 18, 2023

It does not work? Still has problem of "RuntimeError: Detected that PyTorch and torchvision were compiled with different CUDA versions. PyTorch has CUDA Version=11.7 and torchvision has CUDA Version=11.8. Please reinstall the torchvision that matches your PyTorch install."

Try using the --reinstall-torch parameter, or remove venv.

@hyuan-kamuda
Copy link

It does not work? Still has problem of "RuntimeError: Detected that PyTorch and torchvision were compiled with different CUDA versions. PyTorch has CUDA Version=11.7 and torchvision has CUDA Version=11.8. Please reinstall the torchvision that matches your PyTorch install."

Try using the --reinstall-torch parameter, or remove venv.

I moved old venv to "venvback" , and re-run .webui.sh (with modified launch.py as above suggested) , it will re-install venv, just got same result of "RuntimeError: Detected that PyTorch and torchvision were compiled with different CUDA versions. PyTorch has CUDA Version=11.7 and torchvision has CUDA Version=11.8. Please reinstall the torchvision that matches your PyTorch install."

@Sakura-Luna
Copy link
Collaborator Author

What are your startup parameters?

@hyuan-kamuda
Copy link

What are your startup parameters?

Launching Web UI with arguments: --xformers --share --enable-insecure-extension-access --listen

@Sakura-Luna
Copy link
Collaborator Author

Sakura-Luna commented May 18, 2023

Try removing --xformers and remove venv, does it work?

@hyuan-kamuda
Copy link

Try removing --xformers and remove venv, does it work?

Try removing --xformers and remove venv, does it work?

yeah, it can work . will it work for later launch adding --xformers back?

@Sakura-Luna
Copy link
Collaborator Author

yeah, it can work . will it work for later launch adding --xformers back?

This is caused by the incompatibility of xformers with the current PyTorch.

@Sakura-Luna
Copy link
Collaborator Author

To fix this, xformers needs to be upgraded to 0.0.20.dev539.

@hyuan-kamuda
Copy link

To fix this, xformers needs to be upgraded to 0.0.20.dev539.

I see, thanks lot for explains!

@AUTOMATIC1111
Copy link
Owner

To fix this, xformers needs to be upgraded to 0.0.20.dev539.

I have xformers 0.0.17 as specified by repo and it works out of the box with no problems. Is this linux specific?

@Sakura-Luna
Copy link
Collaborator Author

xformers did not update CI to PyTorch 2.0.1 until today. facebookresearch/xformers@a721581

@Sakura-Luna
Copy link
Collaborator Author

At present, only dev539 should be effective, not sure if they update the old version.

@Sakura-Luna
Copy link
Collaborator Author

I noticed that Linux uses a different installation command, so the problem should only occur in Linux, and the solution is to modify the command.

if (not is_installed("xformers") or args.reinstall_xformers) and args.xformers:
if platform.system() == "Windows":
if platform.python_version().startswith("3.10"):
run_pip(f"install -U -I --no-deps {xformers_package}", "xformers", live=True)
else:
print("Installation of xformers is not supported in this version of Python.")
print("You can also check this and build manually: https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Xformers#building-xformers-on-windows-by-duckness")
if not is_installed("xformers"):
exit(0)
elif platform.system() == "Linux":
run_pip(f"install {xformers_package}", "xformers")

@AUTOMATIC1111 AUTOMATIC1111 merged commit 3885f8a into dev May 18, 2023
@Sakura-Luna Sakura-Luna deleted the minor-fix branch May 18, 2023 15:42
@404-xianjin
Copy link

404-xianjin commented May 26, 2023

hi, I use the latest stable-diffusion-webui, and now I also encounter this error. how can i solve it
image
Whenever I encounter this error, I need to perform some steps to access the stable diffusion webui normally

  1. rm -rf venv/
  2. ./webui.sh
    I don't know what to do, please help me. Thanks
    @Sakura-Luna @AUTOMATIC1111

@Sakura-Luna
Copy link
Collaborator Author

Sakura-Luna commented May 26, 2023

hi, I use the latest stable-diffusion-webui, and now I also encounter this error. how can i solve it

master branch does not contain this fix, switch to dev or rc branch.

@404-xianjin
Copy link

image
I checked the launch.py under stable diffusion and found that the command you modified is normally in this file. Even then, switch to dev or rc branch?

@Sakura-Luna
Copy link
Collaborator Author

run_pip(f"install -U -I --no-deps {xformers_package}", "xformers")

You can clearly see that they are inconsistent, of course, you can also directly modify them to be the same, and then delete venv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants