Stable Diffusion Tutorial - 1024x1024 High Resolution Images with Standard Consumer GPU - 100% Free

Поділитися
Вставка
  • Опубліковано 7 вер 2024
  • If you already have the Stable Diffusion repository up and running, skip to 15:45.
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    For anyone running on less than 10 GB of VRAM, you will need to add two lines of code in the txt2imghd.py file:
    1. Find the line of code that says: model = instantiate_from_config(config.model)
    2. Immediately below it add a line that reads: model.half()
    3. Find the line of code that says: init_image = repeat(init_image, ... b=batch_size)
    4. Immediately below it add a line that reads: init_image = init_image.half()
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    Step-by-step tutorial walk through of installation and use of Stable Diffusion Art Generation AI model to create high resolution images. Previously one needed over 40GB of VRAM, this will enhance the resolution of the images generated for 11GB or less cards. Intended for NVIDIA graphics cards only.
    Comment below with your prompt ideas!
    Credit to lstein and jquesnelle for the great improvements to the main repo:
    Link to main code on GitHub: github.com/lst...
    Link to additional upsample code on GitHub: github.com/jqu...
    Thumbnail background image generated by Stable Diffusion.

КОМЕНТАРІ • 88

  • @ArindamPalAndy
    @ArindamPalAndy Рік тому +4

    By the way, great intro to the upscaling script. I modified the following param:
    --passes to 3, and the code basically loops on upscaling. Resulting image is 4306x4306 - it takes a long time but so very worth it for high detailed images

  • @Holy_fuck_its_Ninjesus
    @Holy_fuck_its_Ninjesus 2 роки тому +1

    Awesome, the future is here! Before this function, I used free services to run images through neural networks that increase resolution, but now there will be less unnecessary actions. Thanks for the new detailed video!

  • @enhorningmjolk
    @enhorningmjolk Рік тому +3

    Thanks! Your the only person that actually made it BEGINNER friendly. As in I literally never coded anything in my life but I was able to follow and set it up. Thanks a ton!!!

  • @lloydsloan1349
    @lloydsloan1349 2 роки тому +2

    I love how easy it is to follow your instructions. You know your subject and communicate it well. Keep up the great work!

  • @pastuh
    @pastuh Рік тому +1

    I will look at this video today,because recent trained model can render correctly only in 1024 resolution.. Somehow I don't think other users can generate such high images.. I hope I will find there info

  • @MrJruhl1
    @MrJruhl1 Рік тому

    Just stumbled upon your video and channel, I love how clear and concise you explain this. I was able to follow with no issues whatsoever and refer back to key points. Thanks!

  • @RamonChiNangWong078
    @RamonChiNangWong078 2 роки тому +1

    thanks for the halve hour explaination of Stable diffusion, now let me see how I can convert those old mining cards into a art server

  • @amanKumar-xl4fw
    @amanKumar-xl4fw Рік тому

    just finished making my first track! thanks bro for all the help with learning soft soft. much love

  • @kamikaze-ub9kz
    @kamikaze-ub9kz Рік тому

    Your tutorial videos are amazing. I decided to go back to creating soft after 16 years. soft soft is so easy to get into, but also offers

  • @taaum1338
    @taaum1338 Рік тому

    My town was two small to really quarantine we only had like 25 infectious people.

  • @mohitsurani6204
    @mohitsurani6204 Рік тому

    arrow forward once to get "Analog app 1 TE" like he uses in the video or simply find one you'd like to use alternatively instead.

  • @MultiDarkZen
    @MultiDarkZen Рік тому

    it took me awhile to get mine to work so here is the prompt I used with optimizedSD python optimizedSD/optimized_txt2imghd.py --prompt "your prompt here" --H 512 --W 512 --seed 27 --n_iter 2 make sure OptimizedSD is installed in the main root folder where you have stable diffusion also rename txt2imghd as optimized_txt2imghd and place it into the OptimizedSD folder you placed into the SD main root folder, this is also a good way to use SD if you have low VRAM. It's also a lot faster as well :D

  • @spearcy
    @spearcy Рік тому

    I think the ema version of the ckpt file is for people who are working on improving the code to create new versions.

  • @courtney7681
    @courtney7681 Рік тому

    no module named torch..? for text 2 img, even thoo pytorch is installed

  • @timothyrebecca2446
    @timothyrebecca2446 Рік тому

    tested on ios12 as well. so far it's good to use

  • @JamesPound
    @JamesPound 2 роки тому

    If you’re only interested in the upscale image and not the more detailed one, it would take significantly less time and vram to just run that instead

    • @theprincipalcomponent
      @theprincipalcomponent  2 роки тому

      Great point. I prefer to generate both, sometimes the “ud” is better depending on the prompt. But definitely would save a lot of time to comment this part out in the code

    • @phillewis1646
      @phillewis1646 2 роки тому

      I'd like to output "ud" but am unable to find how. Any pointers?

  • @PANTHERA369
    @PANTHERA369 Рік тому

    So this is no different essentially than running a 512 stable diffusion image through openjourney then imputing that file into cupscale and running ESRGAN 4x on it right
    This just automatically upscales the 512 image correct ?

    • @PANTHERA369
      @PANTHERA369 Рік тому

      Ive been running my selected 512 images into cupscale , but if this somehow is creating better quality let me know. But im pretty sure I understand there is no difference

  • @heavyicerx
    @heavyicerx 2 роки тому

    I think I got everything installed and configured properly, but when I try to run a prompt, I get about 10 "Running DDIM Sampling with 45 timesteps", and then it crashes back to the ldm environment with no errors on the console.

  • @beetjebutje4948
    @beetjebutje4948 Рік тому

    I thought I was baller with a 3080Ti 12GB. Until I installed Stable Diffusion

  • @joakowanshunlerun
    @joakowanshunlerun Рік тому

    I have an Intel Iris Plus graphic card. Do I have any alternative? Thank you

  • @baytaadarell
    @baytaadarell Рік тому

    Hi, I have 4090 and when I launch the script with --W 1024 --H 1024, I have that error :
    RuntimeError: CUDA out of memory. Tried to allocate 16.00 GiB (GPU 0; 23.99 GiB total capacity; 12.16 GiB already allocated; 8.81 GiB free; 12.28 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
    how to allocate more memory? thanks

  • @wongtongwing8694
    @wongtongwing8694 Рік тому

    You could make a basic template to start with every ti you start a new .

  • @neutralmst6855
    @neutralmst6855 2 роки тому +1

    Hey there, when I tryed to run the txt2imghd.py it does not only not find the module "watermark", but ... every model. It starts with
    Traceback (most recent call last):
    File "C:\XmyuserdataX\Stable-Diffusion\scripts\txt2imghd.py", line 2, in
    import cv2
    ModuleNotFoundError: No module named 'cv2'
    if I comment it out it will just continue and not find anything. What can I do in this case?

    • @neutralmst6855
      @neutralmst6855 2 роки тому

      I did not use "python" before that. That's why, on my way to comment out Watermark again :D

    • @aleksandersuur9475
      @aleksandersuur9475 2 роки тому

      don't comment it out, install the missing modules

  • @inkpaper_
    @inkpaper_ 2 роки тому

    " lavapipe is not a conformant vulkan implementation, testing use only." - seems like WSL 2 does not support Vulkan API right now, are there any workarounds to use realesrgan for upscaling in WSL?

  • @JuanPretorius
    @JuanPretorius Рік тому

    I'm getting an error and I feel stupid. realesrgan-ncnn-vulkan not found, although I did put it in the repository. Anyone got any ideas?
    File "/home/juantjie/miniconda3/envs/ldm/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'realesrgan-ncnn-vulkan'

  • @lucasdidthis
    @lucasdidthis 2 роки тому +1

    Thanks for the tip with this script and the easy to follow tutorial! One Problem, though: Does the script not allow for parameters in the prompt? I've tried to change the dimensions (w and h) while doing a prompt, but it always takes the parameters defined in the py-script. Do I really have to change them every time in the script? Or am I doing something wrong? Any idea how to change the script if necessary to allow parameters in the prompt? Thanks again, Cheers

    • @ramah808
      @ramah808 Рік тому

      Instead of just typing:
      python scripts\txt2imghd.py
      you can add arguments that are defined in the script (starting at lines 216), such as:
      python scripts\txt2imghd.py --H 768 --W 768
      This will result in an image with dimensions of 768x768

    • @ramah808
      @ramah808 Рік тому

      you can by pass the upscaling process by using:
      python scripts\txt2imghd.py --passes 0 --prompt
      This way you can generate more images faster, then you can go back to the seeds you like and re-generate them with upscaling by changing the 0 back to a 1:
      python scripts\txt2imghd.py --passes 1 --prompt

  • @koboltvlog4908
    @koboltvlog4908 2 роки тому

    watermark thing worked for me not sure what it does but i didn't have to REM it

  • @deadtotheworld
    @deadtotheworld 2 роки тому

    2 questions is there a way to get a log for txt2imghd so I can see the different seeds per picture. I created multiple and I don’t know how to find their seed because it was 5 pictures generated after the seed I entered first.
    Is there a way I can get all the pictures generated to be upscaled. Right now only the 1 picture gets upscaled. I probably have to enter the amount somewhere I’m guessing

  • @GoSuDubai
    @GoSuDubai Рік тому

    Thank you, now need to find a way how to create 1080p without buying a100 80gb card :)
    With A100, possible to generate 1980x1080?

  • @mr.franco4972
    @mr.franco4972 Рік тому

    Do SD and others AI only work using Nvidia Gpus? It did not not work with AMDs Radeon or Intel GPUs??

  • @ashishdeshpande5849
    @ashishdeshpande5849 2 роки тому

    Your response will be very much appreciated to this burning query!
    I really need help understanding whether if I will be able to use stable diffusion in any form in my final year project with a laptop that has a nvidia gtx 1650(4gb) graphics card?

    • @theprincipalcomponent
      @theprincipalcomponent  Рік тому

      This video likely won’t suit you with 4GB VRAM, however there are some optimized repos that sacrifice runtime for memory size that I’d suggest you look into

    • @ashishdeshpande5849
      @ashishdeshpande5849 Рік тому

      @@theprincipalcomponent Alright, that just saved a lot of my time! Thank you so much for your time and support!
      Really appreciate it!

  • @coquita1234
    @coquita1234 2 роки тому +1

    can you help me if its possible to use more than one gpu at the same time. i want to use all 28gb of vram from my 3 cards...cannot find a video about this but i read that its possible they just dont explain it....or not detail like your videos

    • @theprincipalcomponent
      @theprincipalcomponent  2 роки тому +1

      I’ve tried to find a solution for this as well, none exist as far as I am aware. This is because the whole model must be on the same card memory for inference

    • @coquita1234
      @coquita1234 2 роки тому

      @@theprincipalcomponent thank you, that put my mind at ease....i was going nuts trying to find a way to use all my cards. dont have a need for it but i thought it was possible and i couldnt stop thinking about it lol.

  • @banglakhobor0
    @banglakhobor0 2 роки тому

    decided to try it out.

  • @I_Hit_My_Kids
    @I_Hit_My_Kids 2 роки тому

    15:46 if you have already installed stable diffusion

  • @zecaveman1053
    @zecaveman1053 Рік тому

    clear guide worked well with for sharing.

  • @jlyn8228
    @jlyn8228 2 роки тому

    Great video! Free knowledge giver giveth.

  • @filmo
    @filmo 2 роки тому

    Try adding 'model.half()' in the load_model_from_config function under model = instantiate_from_config(config.model)

    • @natsudragneelthefiredragon
      @natsudragneelthefiredragon 2 роки тому

      I'm curious, what happens to make it work better this way? Something to do with more precision?

    • @filmo
      @filmo 2 роки тому +1

      @@natsudragneelthefiredragon .half() reduces the model parameters from f32 (4 bytes) to f16 (2 bytes). Thus the model size in memory is reduced by 50%. A f16 float is less precise than a f32 float, but for purposes of this model, the lack of precision isn’t that noticeable. My guess is that if you ran the exact same prompt on a full vs half model there might be some variations in what it conjures up.

    • @natsudragneelthefiredragon
      @natsudragneelthefiredragon 2 роки тому

      @@filmo Thanks for the simple explanation, on the normal Stable Diffusion with my RTX 3070 Ti 8 GB I could only do 448 x 448 or 258 x 768 and so on, no 512 x 512 or greater
      Plus the model might have better results for a bigger image anyway

    • @filmo
      @filmo 2 роки тому +1

      @@natsudragneelthefiredragon using .half you will get 512x512 on a 3070 (8GB) as I’ve got the same device. Try increasing the dimensions by increments of 32 to see what the max would be.

    • @natsudragneelthefiredragon
      @natsudragneelthefiredragon 2 роки тому

      @@filmo Yeah, I should try that

  • @Dr.M.Driver
    @Dr.M.Driver Рік тому

    how the hell do I reset everything I got lost and not the git repository stuff is in the wrong place god knows where

  • @marcoberetta1045
    @marcoberetta1045 2 роки тому

    Hey, nice video, but what do i have to do to not get de "ud" version? Because this one takes too much time

  • @edwardwilliams2564
    @edwardwilliams2564 Рік тому

    The full version of the ckpt file is for training purposes.
    ua-cam.com/video/lztn6qLc9UE/v-deo.html

  • @HalkerVeil
    @HalkerVeil 2 роки тому

    Can anyone explain how to get Stable Diffusion to use multiple GPU's?
    Now that mining rigs are offline, it would be an obvious use case.

    • @theprincipalcomponent
      @theprincipalcomponent  Рік тому

      Not sure this has been done as far as I’m aware. Parallelized inference between multiple GPUs is quite a technological challenge since the compute graph is so “densely connected”. All computations rely on each other with no obvious place to make the separation

  • @fernaq7400
    @fernaq7400 2 роки тому

    Thanks a lot for the tutorials m8 but I still have a question
    is there a way to get it back to "prompt" automatically after it's done with one image? or do I just have to re write python scripts/txt2imghd.py all the time?
    I know nothing about coding so I don't know if I can add something to the code to make it re run itself after it's finished

    • @theprincipalcomponent
      @theprincipalcomponent  2 роки тому

      There’s definitely a way to alter the code to continue on with another prompt, but perhaps not best suited to be explained in a comment. But you can always re-run the python scripts/txt2imghd.py command by pushing the up arrow key (or any previously run command) instead of always typing it out again

    • @fernaq7400
      @fernaq7400 2 роки тому

      ​@@theprincipalcomponent well what a fool I was for not thinking about that, thanks a lot :D

  • @owenpaxton4664
    @owenpaxton4664 2 роки тому

    Hi, I've followed this but now, after adding the code that's in the description, when I run the txt2imghd.py script, instead of asking for a prompt it just goes straight into generating a random image. Not sure why

    • @LeWorm45
      @LeWorm45 Рік тому

      Pretty sure the prompt goes into the same command that runs the script, see if that works. I haven't tried it yet though I am about to install it xd

  • @James-ip1tc
    @James-ip1tc 2 роки тому

    I heard that stable diffusion excels at 512 x 512 High resolutions are just an upscale

    • @theprincipalcomponent
      @theprincipalcomponent  2 роки тому +1

      Yes exactly, the second application downloaded in the video is an upscaler

  • @PhocusJoe
    @PhocusJoe 2 роки тому

    I have a different AI upscaler I use separately on the whole image It works a bit better for me and runs a lot faster. I did see that you have an inpaint.py in your stable diffusion folder there. Have you gotten inpainting working with stable diffusion? If so would you mind sharing how you did it?

    • @theprincipalcomponent
      @theprincipalcomponent  2 роки тому

      Haven’t experimented with it yet, which upscaler are you using?

    • @everrethamilton2673
      @everrethamilton2673 2 роки тому

      Which upscaler are you using?

    • @PhocusJoe
      @PhocusJoe 2 роки тому

      ​@@everrethamilton2673 I am not using it inside the pipepine, I only upscale after the fact with another script. I am using realesrgan-ncnn-vulkan with realesrgan-x4plus.

    • @PhocusJoe
      @PhocusJoe 2 роки тому

      @@theprincipalcomponent I am not using it inside the pipepine, I only upscale after the fact with another script. I am using realesrgan-ncnn-vulkan with realesrgan-x4plus.

  • @nathan-uk8bq
    @nathan-uk8bq 2 роки тому

    can u do a tutorial for doing image to image. can't figure out how to get the script to work

    • @theprincipalcomponent
      @theprincipalcomponent  2 роки тому

      I haven’t tried it out myself yet, a couple others have requested this as well, might have to take a look!

  • @zecaveman1053
    @zecaveman1053 Рік тому

    Thanks man

  • @Holy_fuck_its_Ninjesus
    @Holy_fuck_its_Ninjesus Рік тому

    Hello, let's make a video about stable diffusion 2.0

  • @jeromecanoy1999
    @jeromecanoy1999 2 роки тому

    what i have to do ni soft stuido?

  • @MitrichDX
    @MitrichDX 2 роки тому

    maybe img2img hd?)

  • @HTehnique
    @HTehnique Рік тому

    Thanks for the guide, it took me WAY long to actually manage to get it to work - why? Probably because I kept typing - "phyton scripts/txt2imghd.py" =D
    As to the watermark, apparently it's simply there to aid the Stable Diffusion's AI to learn more - rather than anything else. This bit of information I randomly stumbled upon yesterday (somewhere on Reddit) whilst trying to find a way to increase the resolution of my pictures as 512x512 ain't enough for me. That was before watching this video in full.

  • @slashkeyAI
    @slashkeyAI 2 роки тому

    nice

  • @skyeralbert461
    @skyeralbert461 Рік тому +1

    you sound like Elon Musk

  • @Quantowski
    @Quantowski 2 роки тому

    I would not call 3080 a standard consumer card :)

    • @theprincipalcomponent
      @theprincipalcomponent  Рік тому

      Fair point! Models of this sort have typically required something like A100 with 40+ GB and $10k+. This one can actually run on cheaper cards than the 3080. even so it’s on the order of hundreds of dollars instead of tens of thousands, which is what the title refers to :)

  • @chrislloyd1734
    @chrislloyd1734 2 роки тому

    pip install transformers==4.19.2 diffusers invisible-watermark

    • @XaYaZaZa
      @XaYaZaZa 2 роки тому +1

      Getting rid of it is better anyway

  • @francisturgeon3333
    @francisturgeon3333 2 роки тому

    Help Me !!!!!! How do i fix this.... After i copy and paste (python scripts\txt2imghd.py) It start right away to make 4 of the same pictures and i did not right a prompt yet ? In Python i have this message ? (This IS NOT expected if you are initializing CLIPTextModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model). I do my best am french and sometime it hard can someone help me :) I dit everything like you said and make change in the txt2imghd script and make the change in the comment to !! :)
    And by the way your video are so helpfull 10/10

  • @LeandroNMartinez
    @LeandroNMartinez Рік тому

    Would a AMD Radeon rx6700 12GB work?