PyTorch 2.0.0 is now GA #8691
Replies: 32 comments 112 replies
-
With torch 2.0 you don't need xformers library for inference. You can replace all arguments related to xformers with |
Beta Was this translation helpful? Give feedback.
-
So are you saying I can just edit my webui user .bat file and add the following to increase my preformance? pip3 instald==2.0.0+cu118 --force-reinstall --extra-index-url https://download.pytorch.org/whl/cu118 Im sorry I am new to all these pythons and pips and gits I did once before mess with downloading CUDNN and some dlls etc. but I am pretty sure i messed up automatic completely doing that and had to start from scratch again. Right now it says I have 1.13 and cu117 and torchvision 0.14 and cu117 If anyone can do a step by step for those of us a little slower on this stuff to make it so I can squeeze some more outta this 4090 would be eternally grateful. |
Beta Was this translation helpful? Give feedback.
-
Note to all. I've updated the initial post above with a warning about xformers and modified the pip install to get rid of some dependency warnings. I should create a feature request such that if a user has torch 2.0 installed and they use "--xformers" it won't install it unless it can find a torch 2.0 compatible version of it. The only way you can use both is to do a manual build of xformers. When I was installing the nightly build before the GA came out and before I knew about SDP I used: each time after I changed my torch version and wait about 5 minutes for it to build. I have no idea if this "build-via-pip-install" works on Windows. |
Beta Was this translation helpful? Give feedback.
-
at the end, its:
and for launch flags, you can use either |
Beta Was this translation helpful? Give feedback.
-
Torch 2.0 is slower for me. Numbers are from performance column of System Info extension.
GPU hits max clock speeds and 100% utilization during the test. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm trying to follow the instructions, but I'm not sure I'm doing things properly. First I changed my .bat file to this:
But when I launched the UI with this script, nothing happened (no install of PyTorch 2.0). So I entered manually the following command in my command line to force installation :
It seemed to install properly, but when I then run the UI, I get around only 3.1 it/s with my RTX 2060. If instead I use xformers, with those commandline_args, I get around 4.1 it/s
So it seems xformers are still much better for me. Do you think I did something wrong? Are there some instructions I can type to check if everything is setup properly? Thank you! |
Beta Was this translation helpful? Give feedback.
-
To every one here. If you are struggling to know for sure whether your hacks or torch 2.0 is setup correctly do the following please. python3 -c 'import torch;print(f"torch {torch.__version__}, cuda {torch.version.cuda}, cudnn {torch.backends.cudnn.version()}")' Windows webui.bat: Add it just before the TWO launch.py lines. You will then know for sure whether you have what you think you have correctly installed. |
Beta Was this translation helpful? Give feedback.
-
Does anyone with an amd card know if there is any benefit to updating pytorch? and how did he do it? pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2 |
Beta Was this translation helpful? Give feedback.
-
shouldn't this be applied as an official pull request, or no? |
Beta Was this translation helpful? Give feedback.
-
Man I got excited thought I could add a couple lines to the web ui user batch file and now I'm over here not even getting an output on my torch version beside the one at the bottom of automatic1111. I have no idea if its even activated. Considering I spend entire days trying to fiddle with even a single update and this is my first github/python app I have been playing around with I figuerd it would have clicked by now and I could just know to go into x y or z file and add this or that I thought I was pretty smart. Is there a place to better learn the basics of this stuff or is it just trial and error for a couple years that gets you to a point where you intrinsically know to add x y z to a given file to get what you want. Right now I Feel like I need a litteral youtube video or screen cap or exact copy and paste of exactly where in each file each thing goes etc. and I honestly feel bad asking so many questions |
Beta Was this translation helpful? Give feedback.
-
Yeah I'll check it out soon that was what I was talking about I am running
to work rn but I never got any kind of error like he did though which
makes me wonder if I put it in the correct spot. Anyways I'll get it going
…On Fri, Mar 17, 2023 at 8:38 PM aifartist ***@***.***> wrote:
Man I got excited thought I could add a couple lines to the web ui user
batch file and now I'm over here not even getting an output on my torch
version beside the one at the bottom of automatic1111. I have no idea if
its even activated. Considering I spend entire days trying to fiddle with
even a single update and this is my first github/python app I have been
playing around with I figuerd it would have clicked by now and I could just
know to go into x y or z file and add this or that I thought I was pretty
smart.
Is there a place to better learn the basics of this stuff or is it just
trial and error for a couple years that gets you to a point where you
intrinsically know to add x y z to a given file to get what you want. Right
now I Feel like I need a litteral youtube video or screen cap or exact copy
and paste of exactly where in each file each thing goes etc. and I honestly
feel bad asking so many questions
I wish I knew what you were talking about. Since you are saying "getting
an output on my torch version" are you referring to the python command I
gave to print the "torch version"? If so did you see Mickoko92 comment
above that he had to switch the single/double quotes to get it to work.
—
Reply to this email directly, view it on GitHub
<#8691 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVJSB5V27JNWDR2G3NTXXF3W4T7XHANCNFSM6AAAAAAV57LGOA>
.
You are receiving this because you were mentioned.Message ID:
<AUTOMATIC1111/stable-diffusion-webui/repo-discussions/8691/comments/5350835
@github.com>
--
Pete Stueve
|
Beta Was this translation helpful? Give feedback.
-
FYI, I deleted my VENV folder first then added the lines. The first thing that happened was torh 2 got installed with cuda 118. Hopefully nothing messes it up. Shouldn't I have to change something in the launch.py? Since it references cu117? Collecting torch
The detected CUDA version (12.1) mismatches the version that was used to compile |
Beta Was this translation helpful? Give feedback.
-
Doesn't this conflict with the launch.py line? And can't it be installed just by changing said line? torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117") |
Beta Was this translation helpful? Give feedback.
-
So I gave this a run for comparison purposes on my rig with a 3080 10Gb card. (Which can be memory challenged at times, if only I knew then what I know now.) I saw very minimal speed improvements on benchmark iterations (~5%) with pyTorch 2.0 and SDP flags, versus using Xformers. I also discovered that my maximum Hires Resolutions had dropped signicantly, I was hitting out-of-memory errors at resolutions that worked before. For example, with Xformers and Medvram flag, I could hi-res a 640x768 image to 1600x1920. (2.5x) So, it appears that for earlier gen cards - due to memory issues and no noticeable speed gains, this is something of a downgrade. I've reverted to using Xformers again. |
Beta Was this translation helpful? Give feedback.
-
Going to add my 5 cents to this discussion. I made a separate install, just to avoid any possible conflicts with my current setup and for easier testing/comparing. I'm using 1660 Super with 6GB VRAM, so I'm most likely not even a target audience for these improvements. I will use the same prompt, same checkpoint, one lora and Coyote-A/ultimate-upscale-for-automatic1111 then hires fix. Args for comparsion: (note: Most commonly used samplers, Coyote-A/ultimate-upscale-for-automatic1111 params: using Euler a, x2 with R-ESRGAN 4x+, chess type, 512 tile, mask 12, padding 32, denoising strength 0.3 Hires fix params: upscaler R-ESRGAN 4x, hires steps 10, denoising strength 0.6, upscale by 1.5
VRAM info from vladmandic/sd-extension-system-info after generations with
VRAM info from vladmandic/sd-extension-system-info after generations with
VRAM info from vladmandic/sd-extension-system-info after generations with hires fix
VRAM info from vladmandic/sd-extension-system-info after generations with hires fix
|
Beta Was this translation helpful? Give feedback.
-
I'm on an RTX 2060 mobile with 6 GB VRAM. It worked perfectly. On 30 steps of My process is as follows: I opened cmd in the install folder and ran Edit: Unfortunately I can't seem to hires fix anymore... The memory usage is slightly too high and it gets stuck. |
Beta Was this translation helpful? Give feedback.
-
I get a really good performance bump with this on my 4070 Ti. However, I run faster out of VRAM when using HiresFix which is really a problem. Before I used to be able to generate images at 1280x720 and upscale them 2x to 2440x1440. Which was nice for wallpapers. Ocassionally this already crashed and I had to use 1.8x instead of 2x in the HighresFix and use normal upscaling to WQHD size after. Now I cannot even use HighresFix 1.8x. Even when setting --medvram. How to fix the VRAM problems? |
Beta Was this translation helpful? Give feedback.
-
Has anyone tried to use I am not familiar with the codebase so I am not sure if this would require a major rewrite or not. |
Beta Was this translation helpful? Give feedback.
-
So after the changes, it seems faster but my gens also seem worse quality. Am i crazy? |
Beta Was this translation helpful? Give feedback.
-
Anyone else running into this error on Linux? Running Fedora 37
|
Beta Was this translation helpful? Give feedback.
-
xformers dev/rc481 pre-built Torch 2.0.0+cu118 builds are now available on pip as of yesterday: |
Beta Was this translation helpful? Give feedback.
-
On a side note, the pull request I was waiting for which added BFloat16 support to nn.functional.interpolate barely missed Torch 2.0.0 GA (only available in torch-2.0.0.dev20230228 Nightly or newer), which was disappointing. This means I'll personally need to continue using Nightly builds until Torch 2.1.0 GA. So for anyone still dealing with VAE NaN (black output) issues on Ampere+, you'd need to wait until Torch 2.1.0 GA to be able to use BFloat16 VAE bias (without additional torch modifications), which resolves the VAE NAN issue without needing to use --no-half-vae. For that reason, if webui were planning to migrate all users to fully to Torch 2.x in the near future, it may be better to wait until 2.1.0 release rather than migrating to 2.0.0 then 2.1.0 shortly after (which my guess wouldn't happen, leaving users on 2.0.0 for a long time). |
Beta Was this translation helpful? Give feedback.
-
Will replacing \stable-diffusion-webui\venv\Lib\site-packages\torch\lib with \cudnn-windows-x86_64-8.8.1.3_cuda11-archive\bin be improved?Everything else remains unchanged |
Beta Was this translation helpful? Give feedback.
-
I updated using this instruction (no xformers) I looked into this further and it appears |
Beta Was this translation helpful? Give feedback.
-
if you read the though history, it tells that SDP is not fix-all. SDP appears better than Xformers when you have a high-end GPU and you're CPU bound and Xformers are better when you're have a low-end GPU. For any mid-range GPU/CPU combo, they are nearly identical. |
Beta Was this translation helpful? Give feedback.
-
i am trying to run dreambooth on runpod unfortunately pytorch team removed xformers older version here the errors and steps i tried to solve the problem I have installed Torch 2 via this command on RunPod io instance
Everything installed perfectly fine With Torch 1 and Cuda 11.7, I was not getting any error but with Torch 2 the below error produced
How to fix? It is using unix On Windows same prodecure working very well Using Automatic1111 web UI to use Stable Diffusion this above i couldnt solve therefore i have done the following things apt update after installing all above now i have this warning and training never progress
now when i run below python code i see everything looking good
test.py result
it is able to generate images with 15.58it which is very fast any help appreciated very much |
Beta Was this translation helpful? Give feedback.
-
@FurkanGozukara don't copy &paste same message on multiple discussions. i answered in a different thread. |
Beta Was this translation helpful? Give feedback.
-
So, mostly for the sake of newcomers to this discussion with not much context,
|
Beta Was this translation helpful? Give feedback.
-
i've created a pr #9191 |
Beta Was this translation helpful? Give feedback.
-
Anyone getting something like this with Hires fix?
Everything else works. Only happens with hires fix on just after 100%. |
Beta Was this translation helpful? Give feedback.
-
PyTorch 2.0.0 is now GA in the last 24 hours and has the cuDNN v8.7 fix if you get the correct version of it.
In other words, no more file copying hacks.
However, there are two versions of 2.0.0.
torch==2.0.0+cu117 Still uses cuDNN 8.5
and
torch==2.0.0+cu118 Uses cuDNN 8.7
Also the default repo's for "pip install torch" only has the cu117 version.
Thus you need to use the extra url thing as follows:
Danger danger... If you let A1111 install your xformers it will downgrade your pytorch.
I missed this when I first created this post because I always built xformers to install it on Linux. Thus I got an xformers compatible with torch 2.0.
Either don't use xformers because sdp seems to work just as well or you'll need to get a xformers for torch 2.0 and don't ask me where to download it from. I don't know.
https://pytorch.org/blog/pytorch-2.0-release/
@vladmandic
Beta Was this translation helpful? Give feedback.
All reactions