Stable Diffusion in Code (AI Image Generation) - Computerphile

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ต.ค. 2022
  • Mike Continues his look at AI Image Generation with Stable Diffusion
    Mike's code: colab.research.google.com/dri...
    Jonathan: johnowhitaker/sta...
    / computerphile
    / computer_phile
    This video was filmed and edited by Sean Riley.
    Computer Science at the University of Nottingham: bit.ly/nottscomputer
    Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

ความคิดเห็น • 442

  • @paulspaws1521
    @paulspaws1521 ปีที่แล้ว +362

    I'm sorry but , "unlock your face with your phone" just cracked me up..

    • @deadfr0g
      @deadfr0g ปีที่แล้ว +37

      This is inadvertently an excellent poetic description of someone using the selfie camera to apply makeup.

    • @zwenkwiel816
      @zwenkwiel816 ปีที่แล้ว +12

      Unlock your phace with your fone

    • @afog
      @afog ปีที่แล้ว +4

      I think he was referring to using the Energizer Power Max P18K whilst in bed... :)

    • @davidm2.johnston684
      @davidm2.johnston684 ปีที่แล้ว +2

      Hahahaha didn't even notice!

    • @absalomdraconis
      @absalomdraconis ปีที่แล้ว +4

      I am reminded of an odd commercial from a few years ago: "apply directly to the forehead".

  • @bustedd66
    @bustedd66 ปีที่แล้ว +70

    this guy makes sense. I want more of him teaching SD and how it works.

  • @DampeS8N
    @DampeS8N ปีที่แล้ว +278

    I've been using Stable Diffusion to _deCGI_ images. Take a screenshot from a game, run it through SD with a low noise rate, give it a detailed description of everything in the picture and it produces pretty solid photo recreations of the images. Also, often, it gets possessed by Eldritch gods and spews out monsters.

    • @zwenkwiel816
      @zwenkwiel816 ปีที่แล้ว +21

      So win-win, right?

    • @MattRose30000
      @MattRose30000 ปีที่แล้ว +5

      now do it in real time with DLSS and you've got something huge

    • @DampeS8N
      @DampeS8N ปีที่แล้ว +17

      @@MattRose30000 This is a long way off. It isn't just that it currently takes my 3090 Ti about 5 minutes to do one frame at 1024x1024 but also it can't be playing a game at the same time and also-also it would be very disorienting because each frame will be a _different_ photo that isn't consistent from frame to frame but probably the worst part is that _you need to write a text prompt that reflects what is in the scene for each frame somehow._

    • @FayezButts
      @FayezButts ปีที่แล้ว

      @@DampeS8N that’s great. Have you messed around with reusing seeds across different frames? I imagine if you get an output you like you’d want to reuse that seed

    • @dibbidydoo4318
      @dibbidydoo4318 ปีที่แล้ว +1

      @@DampeS8N making text to video is the easy part, making video to text is the hard part.

  • @BernardJollans
    @BernardJollans ปีที่แล้ว +40

    If anyone is stuck with the code. The "i" should be a "t" in this line in the loop:
    ```
    latents = scheduler.step(noise_pred, i, latents)["prev_sample"]
    ```

    • @alenmathew8115
      @alenmathew8115 9 หลายเดือนก่อน +1

      Did you get the code working?. for me it's showing "unsupported operand type(s) for /: 'DecoderOutput' and 'int'" in line 59

    • @Phobos221B
      @Phobos221B 9 หลายเดือนก่อน +8

      @@alenmathew8115 in the last few lines, change this line
      image = (image / 2 + 0.5).clamp(0, 1) to this image = (image.sample / 2 + 0.5).clamp(0, 1)

    • @peepdawg8995
      @peepdawg8995 9 หลายเดือนก่อน

      man this helped me. thanks bro :)

    • @mayurpatil9871
      @mayurpatil9871 7 หลายเดือนก่อน

      Thanks man because of you I solved this error

    • @romainflorentz5771
      @romainflorentz5771 5 หลายเดือนก่อน

      Also in the Image Loop section, this needs to be moved inside the for loop :
      ```
      # Prep Scheduler
      scheduler.set_timesteps(num_inference_steps)
      ```

  • @IceMetalPunk
    @IceMetalPunk ปีที่แล้ว +122

    The very concept of embeddings is amazing to me. It's literally "organize concepts themselves into points in space, where similar things are closer together, in many many dimensions; now you can do arithmetic on *the meanings of words, phrases, and sentences.* " Want to add the meaning of "horse" and the meaning of "male"? Well, just add these vectors together and the resulting coordinates will point right at "stallion"!
    They amaze me so much that, when I watched Everything, Everywhere, All At Once for the first time, I completely geeked out when I realized their description of the organization of the multiverse is effectively a well-embedded latent space 😅

    • @floydmaseda
      @floydmaseda ปีที่แล้ว +15

      @@mrteco4236 It literally is and is done all the time.

    • @IceMetalPunk
      @IceMetalPunk ปีที่แล้ว +15

      @@mrteco4236 It's... common, in fact. There's a whole video on this channel about embeddings. And it's how CLIP fundamentally works...

    • @TheColorman
      @TheColorman ปีที่แล้ว +1

      This is super fascinating, especially as someone studying Data Science just learning about vector spaces and their many uses!

    • @alexanderkirilov7820
      @alexanderkirilov7820 ปีที่แล้ว

      @@mrteco4236 lol

    • @Emperorhirohito19272
      @Emperorhirohito19272 ปีที่แล้ว

      @@mrteco4236 that is literally what it does bro

  • @YSPACElabs
    @YSPACElabs ปีที่แล้ว +33

    I've been playing with Stable Diffusion (specifically the "InvokeAI" fork because I don't have 10gb VRAM), and I've found out that spamming the end with keywords like "realistic, 4k, trending on artstation, 8k, photorealistic, hyperrealistic" has more effect on how good the output image is than I thought.

    • @ShankarSivarajan
      @ShankarSivarajan ปีที่แล้ว +11

      You should try negative prompts.

    • @nicoliedolpot7213
      @nicoliedolpot7213 ปีที่แล้ว +4

      to add, try emphasis "((x))" for specific objects.
      Edit: you can also use x(y), y being the weight value for that tag.

  • @morphman86
    @morphman86 ปีที่แล้ว +200

    Mike asked himself what the use case for mixing two prompts is.
    I used this only yesterday, to produce a photorealistic painting of an owlbear from DnD...
    So it has practical uses!

    • @MushookieMan
      @MushookieMan ปีที่แล้ว +41

      Maybe google is planning to create new, even more impossible captchas. "Select all the cat-dogs in the picture"

    • @dembro27
      @dembro27 ปีที่แล้ว +5

      Does it hoot or roar??

    • @IceMetalPunk
      @IceMetalPunk ปีที่แล้ว +3

      @@dembro27 It hoots and growls, in fact, here at Aguefort's Adventuring Academy!

    • @euchale
      @euchale ปีที่แล้ว

      Its how I make my fish people too for tabletop. Tons of applications for DnD

    • @morphman86
      @morphman86 ปีที่แล้ว

      @@euchale You get half-decent tieflings if you ask for a quarter human, a half lizard and the last quarter goat.

  • @christopherg2347
    @christopherg2347 ปีที่แล้ว +78

    "Simple, you just chip away all the stone that doesn't look like David."

    • @housellama
      @housellama ปีที่แล้ว +12

      "I saw the angel in the marble and carved until I set him free" - Michalangelo

  • @byteborg
    @byteborg ปีที่แล้ว +5

    I love it how you simplify and explain this heap of complexity that is in generative models like this. You gave me the impulse to play around with it, inspite of being pretty complicated code due to the depth of the abstraction. It's a lot of fun to fantasize about something and have the model come up with a visual representation.

  • @jeffwads
    @jeffwads ปีที่แล้ว +123

    SD is just outstanding. It can mimic the other projects and the 1.4/1.5 models will be public domain. You can't beat that.

    • @zwenkwiel816
      @zwenkwiel816 ปีที่แล้ว +9

      Lol just add "dall-e 2" to your prompts XD

    • @paryska991
      @paryska991 ปีที่แล้ว +9

      1.5 model just went public today i think

    • @StefanReich
      @StefanReich ปีที่แล้ว +1

      @@paryska991 Ye

    • @dgo4490
      @dgo4490 ปีที่แล้ว +5

      You can beat that with human creativity that doesn't require billions of calculations per second to brute force a synthetic result.

    • @zwenkwiel816
      @zwenkwiel816 ปีที่แล้ว +10

      @@dgo4490 doesn't it though?

  • @Yupppi
    @Yupppi ปีที่แล้ว +4

    I really liked the stable diffusion that came with the webui that you could install on your own computer, to avoid quotas or subscription costs, and it provided easy to use UI as well. With inpaint feature inside the UI as well. Shoutouts to people who make those applications from the rough code for regular people to use.

  • @lucamatteobarbieri2493
    @lucamatteobarbieri2493 ปีที่แล้ว +3

    I like how your channel has adapted to the advent of the machine learning boom we are experiencing

  • @simplesimon4561
    @simplesimon4561 ปีที่แล้ว +116

    I would like to see a version of the code where it shows the result of each step, so you can see the noise getting reduced with each iteration

    • @JalexRosa
      @JalexRosa ปีที่แล้ว +6

      me too!!

    • @gianluca.g
      @gianluca.g ปีที่แล้ว +11

      I think I'm going to do it. I'm downloading the source code and save a png for each step

    • @AlphaNovaOfficial
      @AlphaNovaOfficial ปีที่แล้ว +7

      Not necessarily what you're after, but if you "interrupt" a run, you can see what it's current progress was. Depending on your steps and how early you catch it, I've seen some very interesting early "noisy" images that were themselves inspiration for other images!

    • @ReneArmenta19
      @ReneArmenta19 ปีที่แล้ว +2

      There is already a script for that

    • @m0nkeyb0i666
      @m0nkeyb0i666 ปีที่แล้ว +13

      If you run automatic1111 there’s a setting for that, uses slightly more vram, but it’s great to watch it work

  • @paultapping9510
    @paultapping9510 ปีที่แล้ว +108

    "there are questions of ethics, there are questions on how it's trained. Let's leave those for another time"
    well, if that doesn't just sum up the tech industry.

    • @monad_tcp
      @monad_tcp ปีที่แล้ว +7

      what ethics ? its just a tool, and its highly dependent on human input.

    • @paultapping9510
      @paultapping9510 ปีที่แล้ว

      @Luiz remember the AI chatbot that became incurably racist because it was trained on data scraped from 4chan amongst other places? That sort of thing.

    • @purplewine7362
      @purplewine7362 ปีที่แล้ว +6

      that sums up every industry. you think people didn't copy art before ai? it's just a tool

    • @paultapping9510
      @paultapping9510 ปีที่แล้ว +6

      @@purplewine7362 lol, not even close to the point I was making. Never mind.

    • @purplewine7362
      @purplewine7362 ปีที่แล้ว +1

      @@paultapping9510 you weren't trying to make any point, otherwise you would have clarified. You were just trying to sound smart.
      Also, liking your own comments is pathetic.

  • @jenka1980
    @jenka1980 ปีที่แล้ว +1

    Love Mikes explanations, somehow he manages explain so complicated stuff in so simple and understandable way.
    It will be interesting to know Mikes opinion om Midjourney as it's seems like the winner for now among the picture creation AIs.

  • @serta5727
    @serta5727 ปีที่แล้ว +5

    So amazing ❤ I love stable diffusion
    Playing around the few last weeks

  • @angeleeh
    @angeleeh ปีที่แล้ว +1

    Mike is a legend, truly great videos with him

  • @aorusaki
    @aorusaki ปีที่แล้ว

    This video finally explained the code to me in a simple way! Now im less confused!!! Amazing extra documentation from you guys

  • @DeKubus
    @DeKubus ปีที่แล้ว

    Immediately recognized the book on Dr. Ponds desk - Prof. Paar was one of my teachers when I studied IT sec. Nice to see it outside of Germany too!

  • @TaranovskiAlex
    @TaranovskiAlex ปีที่แล้ว +3

    Awesome explanation, thank you!

  • @3dlabs99
    @3dlabs99 ปีที่แล้ว +6

    We need an entire "Frogs on stilts" channel.

  • @thomasnicolet9561
    @thomasnicolet9561 ปีที่แล้ว +16

    The current version of the reference notebook is already deprecated due to Hugging Face's API changes :)
    You try to operate on "image", which is now a DecoderOutput class:
    image = (image/ 2 + 0.5).clamp(0, 1)
    It is fixed by unpacking its tensor attribute with its sample method:
    image = (image.sample / 2 + 0.5).clamp(0, 1)

    • @Dancedfsk8
      @Dancedfsk8 ปีที่แล้ว +2

      The rest of the notebook is hard to fix, I tried but in vain. I think I'll wait for Mike's update.

    • @victorwesterlund4826
      @victorwesterlund4826 ปีที่แล้ว +3

      Same goes for pil_to_latent():
      AutoencoderKL.encode() returns a AutoencoderKLOutput class:
      return 0.18215 * latent.mode()
      The desired DiagonalGaussianDistribution class is now a property ("latent_dist") of this new class:
      return 0.18215 * latent.latent_dist.mode()

    • @Dancedfsk8
      @Dancedfsk8 ปีที่แล้ว +2

      in img2img,
      I just extract the code of add_noise and used int instead of floatTesnsor.
      Change add_noise function to the following.
      also notice the for loop now loop 51 times.
      Not sure if this is correct, but at least it works.
      # View a noised version
      noise = torch.randn_like(encoded) # Random noise
      for i in tqdm(range(51)):
      scheduler.sigmas = scheduler.sigmas.to(device=encoded.device, dtype=encoded.dtype)
      scheduler.timesteps = scheduler.timesteps.to(encoded.device)
      sigma = scheduler.sigmas[i].flatten()
      while len(sigma.shape) < len(encoded.shape):
      sigma = sigma.unsqueeze(-1)
      noisy_samples = encoded + noise * sigma
      img = latents_to_pil(noisy_samples)[0]

    • @aaron6807
      @aaron6807 ปีที่แล้ว +1

      @@victorwesterlund4826 What is the 0.18215 for? I keep seeing it in the code but I can't find an explanation for what is does or how it's derived

  • @serta5727
    @serta5727 ปีที่แล้ว +13

    Mikes explanations Aretha best ❤

  • @CyberMuzHR
    @CyberMuzHR ปีที่แล้ว +14

    Great video! Can anyone recommend any other videos that explain the text encoding and the whole clipping process used to guide the image generation based on input prompt?

  • @_inetuser
    @_inetuser ปีที่แล้ว

    this is so interesting and has so many unexplored use cases

  • @gz6963
    @gz6963 ปีที่แล้ว

    great video and very educational
    I'd love to hear you guys talk about textual inversion

  • @semidemiurge
    @semidemiurge ปีที่แล้ว

    This was so helpful in understanding this new tech. thank you

  • @peterw1534
    @peterw1534 ปีที่แล้ว

    Wow this is actually pretty amazing. Fascinating stuff

  • @jytou
    @jytou หลายเดือนก่อน

    Excellent explanations, as always! Thanks!

  • @gaptastic
    @gaptastic ปีที่แล้ว

    this video just put me on a wonderful path, thank you!

  • @pmo1972
    @pmo1972 ปีที่แล้ว

    Excellent tutorial. Thank you.

  • @briancunning423
    @briancunning423 ปีที่แล้ว +2

    Great explanation.

  • @theemathas
    @theemathas ปีที่แล้ว +40

    I doubt DALL-E 2 is the “biggest” image generator. Stable Diffusion is probably bigger. In my circle, the biggest one is NovelAI, which is a Stable Diffusion variant specialized in anime-style images. Notably, its training data is probably the best image dataset out there in terms of detailed labels.
    It’s already been causing a lot of drama in the community. One notable case involved someone feeding a WIP drawing to img2img, posting it, claiming it as their own drawing. When the actual artist posts their finished image, this person then proceeds to accuse the artist of copying “their” art.

    • @dibbidydoo4318
      @dibbidydoo4318 ปีที่แล้ว

      Imagen by Google and NUWA-infinity by Microsoft are probably superior.

    • @felixjohnson3874
      @felixjohnson3874 ปีที่แล้ว +4

      Would your "circle" happen to fit after rule 33 and before rule 35?

    • @nicoliedolpot7213
      @nicoliedolpot7213 ปีที่แล้ว +4

      The danbooru property labeling format, to be exact. Training is rather easy as the images in the booru databases are human-labeled.

  • @HerleifJarle
    @HerleifJarle ปีที่แล้ว +1

    Thanks for the explanations of how AIs are being trained. I can see a slight hint of a neural network here. I think the advantage now is that companies like Bluewillow is utilizing discord to quickly gain testers free of charge even.

  • @PunmasterSTP
    @PunmasterSTP ปีที่แล้ว

    Stable Diffusion in code? More like “Super great explanation that’s solid gold!” 👍

  • @vanderkarl3927
    @vanderkarl3927 ปีที่แล้ว +6

    Seeing that GPT-2 vid reminded me: we haven't had Robert Miles on in a fair while. Is he just too busy?

    • @andybaldman
      @andybaldman ปีที่แล้ว +1

      I love his content.

  • @user-xv3yr5cm7f
    @user-xv3yr5cm7f 2 หลายเดือนก่อน

    great video. today SORA was launched, nad youvideos help to understand whats going on the background. many thanks!

  • @Tymon0000
    @Tymon0000 ปีที่แล้ว +3

    I generated thousands of images with stable diffusion. It's really fun and inpiring.

  • @FusionDeveloper
    @FusionDeveloper ปีที่แล้ว

    Thanks for this video.
    So the Steps is actually the Noise Level.

  • @heurve
    @heurve ปีที่แล้ว +2

    On line 56, the image is coming from the sample property of the DecoderOutput, change to
    55: with torch.no_grad():
    56: image = vae.decode(latents).sample

  • @Thinknotix
    @Thinknotix 7 หลายเดือนก่อน

    Is there a way to use 2 image prompts instead of 2 text prompts to get a 50/50 blend?

  • @dakotaknutson
    @dakotaknutson ปีที่แล้ว +14

    For anyone trying to get the notebook to work and is getting this error: "TypeError: unsupported operand type(s) for /: 'DecoderOutput' and 'int'" change "image = (image / 2 + 0.5).clamp(0, 1)" to "image = (image.sample / 2 + 0.5).clamp(0, 1)". As noted at the top of the notebook it seems the huggin API has changed.

    • @hipposhark
      @hipposhark ปีที่แล้ว

      wow thank you very much
      can confirm that this indeed solves it👍

    • @koh8614
      @koh8614 ปีที่แล้ว

      In my case it outputs a Hugging Face Tokens page warning? It says that I need a token? Is it free?

    • @hipposhark
      @hipposhark ปีที่แล้ว

      @@koh8614 yes it is free. you need to create an account on the hugging face website and generate a token from your profile.

    • @JavadZahiri
      @JavadZahiri ปีที่แล้ว

      Thank you

  • @6DAMMK9
    @6DAMMK9 ปีที่แล้ว +1

    Thank you for the SCIENTIFIC video!
    It got outta control after the "novelaileak", which it is very important to leave some information as realistic as it can.
    I'm quite sad about the sub-culture but I still have hope on the artist / researcher to snap out from the chaos.

  • @YeloPartyHat
    @YeloPartyHat ปีที่แล้ว

    Good timing with the NovelAI leaks

  • @mylittleparody2277
    @mylittleparody2277 ปีที่แล้ว

    Thank you for this video, it's really interesting!

  • @slimjimbigfoot589
    @slimjimbigfoot589 ปีที่แล้ว

    Amazing so stable diffusion helps un clutter all that extra pixel during the process of facial recognition.

  • @yuxiang3147
    @yuxiang3147 7 หลายเดือนก่อน

    Great video. However, could you explain what this line "latent_model_input = latent_model_input / ((sigma**2 + 1) ** 0.5)" does?

  • @amventures1
    @amventures1 8 หลายเดือนก่อน

    Can we add annotations along with the image in an image2image model? The annotations to tell us which part of the image needs to be regenerated. Like I want to change the background with the annotations to that background so it gives exactly the same person with a different background? Something like Photoshop Generative AI

  • @johnnyw525
    @johnnyw525 ปีที่แล้ว +1

    I didn't realise that this is basically the next evolution of the "AI Upscaling" technology that has been used to in videogame mods: Take an image and then add detail until it looks like what I think it's supposed to. It's still mind-bending how it results in what it does, but AI Upscaling wasn't so scary, so I suppose this feels a bit less scary now.

  • @levii2748
    @levii2748 ปีที่แล้ว

    I was waiting for this 🙏🙏🙏

  • @ozorg
    @ozorg ปีที่แล้ว

    Great one again!

  • @vorlon478
    @vorlon478 ปีที่แล้ว +2

    13:47 reminds me of the wave function collapse algorithm.

  • @Mutual_Information
    @Mutual_Information ปีที่แล้ว +12

    Anyone else surprised that diffusion models are the clear winners for image generation? And GANs have almost completely fallen from favor? I haven’t seen them in any recent SOTA work..

    • @timmyt1293
      @timmyt1293 ปีที่แล้ว +6

      Mmm isnt it still kinda a GAN? Stable diffusion uses a transformer block not just for the diffusion but for identifying what the actual image is from the diffusion output too. So isn't that technically a GAN? Generate images from the diffusion model, then try to categorize them through an adversarial transformer network?

    • @erikp7378
      @erikp7378 ปีที่แล้ว +9

      @@timmyt1293 Actually there is no adversarial training in diffusion models in general (in particular for stable diffusion model). The condition processing is used only for guidance (free classifier guidance in this case) and from a theoretical perspective the diffusions models are closer to hierarchical variational autoencoders where the encoders are fixed diffusion steps and decoders are denoising steps with the trained noise estimation model.

    • @JadeNeoma
      @JadeNeoma ปีที่แล้ว

      @@erikp7378 I wonder if you could impliment stable diffusion inside a GAN. So have the generator define the parameters for the stable diffusion based on an input and then give that to the classifier mixed in with non ai generated images

    • @dibbidydoo4318
      @dibbidydoo4318 ปีที่แล้ว

      @@JadeNeoma I don't know how that would work.

    • @erikp7378
      @erikp7378 ปีที่แล้ว

      @@JadeNeoma its depends on which parameters you have in mind but the main point is that the operations must remain differentiable in order to optimize the model. And in the case of hyper parameters inference it is not trivial in many cases (e.g. the number of steps)

  • @peekpen
    @peekpen ปีที่แล้ว

    I'll copy your transcript and feed it to open.ai's playground and ask him to re-interpret your addresss for images but for my own audio interpolation in music. Brilliant.

  • @GKinWor
    @GKinWor ปีที่แล้ว +1

    thanks for the video

  • @ukranaut
    @ukranaut ปีที่แล้ว

    Fascinating.

  • @martinoandreascarpolini5128
    @martinoandreascarpolini5128 ปีที่แล้ว +3

    [notebook error] Hello, Thanks for the fantastic video. I noticed that as of today the notebook does not run since there are some errors. I do not why, probably some library changed a bit.The first error is at line 50 of the cell with the first inference loop. Instead of 'i' there should be 't'. The second error appears at line 59. Now to access the image's tensor you have to write 'image["sample"]' instead of just 'image'.

  • @nocturne6320
    @nocturne6320 ปีที่แล้ว +4

    Could you do a video about the different samplers? (eg. DDIM, Euler, Euler a, etc.) That part of the process is still a mystery for me

    • @havz0r
      @havz0r ปีที่แล้ว +1

      Ddim, euler, lms, heun and dpm all produce identical results. The ones with "a" at the end (euler a, dpm2 a) are ancestral samplers and produce different results

    • @nocturne6320
      @nocturne6320 ปีที่แล้ว

      @@havz0r I ment how they work under the hood. They've already explained how the network generates images from noise, but not how the different samplers work

  • @aiartbx
    @aiartbx ปีที่แล้ว +1

    Hi Mike. This is the by far the most technically clear explanation of SD that I have seen so thank you for this! Now as you would be aware by now, the art community is up in arms against this tech and I would love to hear your opinion based on the factual knowledge you have.
    The main issue that keeps coming up is that SD tech is art theft because it steals copyrighted artwork then companies profit using the images. Another point artists are making is that SD is just a mish mash collage of original art so nothing generated by Ai is brand new.
    Would you agree or disagree with these points and why strictly based on from your technical knowledge.

  • @t.michaeltracy2046
    @t.michaeltracy2046 ปีที่แล้ว +4

    Great video, really informative. I was hoping to try out your Google Colab code, although it seems broken at the moment. Are there any updates regarding this announcement regarding the known bugs? "Note: There might be a handful of bugs at the moment. The developers of this stable diffusion implementation keep changing the api. Everyone should know not to make breaking api changes so regularly! I'll do a pass over the code and fix bugs as soon as I can. Am away this week :) thanks to Michael d for bringing this to my attention."

  • @ben_clifford
    @ben_clifford ปีที่แล้ว

    3:07 earned my like. I need to go see that now. 😂

  • @lolerskates876
    @lolerskates876 ปีที่แล้ว

    Thank you for trying to fix the code after the API update broke it

  • @jaymalby
    @jaymalby ปีที่แล้ว +11

    Well, xkcd did pick the number 4 by die roll. Seems a random enough seed to me.

    • @reinei1
      @reinei1 ปีที่แล้ว +2

      I had to scroll far too much to see this mentioned, but yes I agree 4 seemed quite a good random seed there...

  • @blenderpanzi
    @blenderpanzi 6 หลายเดือนก่อน

    If you mention another video please also link it in the description!

  • @cyndicorinne
    @cyndicorinne 10 หลายเดือนก่อน

    12:34 beautiful cityscapes 🏙️

  • @nkronert
    @nkronert ปีที่แล้ว +1

    This is literally the first episode of Computerphile ever that I didn't understand anything of what was explained. And judging from the comments I'm the only one. Looks like I totally missed the boat on this topic.

    • @dibbidydoo4318
      @dibbidydoo4318 ปีที่แล้ว

      what was confusing?

    • @nkronert
      @nkronert ปีที่แล้ว +2

      @@dibbidydoo4318 it wasn't actually confusing because there wasn't anything to confuse. I had literally never heard of these developments before.

    • @zwe1l1nkehaende
      @zwe1l1nkehaende ปีที่แล้ว

      @@nkronert this is the followup video on the topic, check out the first one, where the whole thing is explained.

    • @nkronert
      @nkronert ปีที่แล้ว +1

      @@zwe1l1nkehaende thanks. I already found it. But I still don't really get it 😊
      Doing some "best fit" on noise until a photorealistic image comes out still sounds like magic to me.

  • @andrewdunbar828
    @andrewdunbar828 ปีที่แล้ว

    Now Deep Dream Generator has just added a text to image diffusion generator too, and it's actually pretty decent.

  • @reecelawson2403
    @reecelawson2403 ปีที่แล้ว

    hi, could you guys make a video on what kernels are please?

  • @CrystalblueMage
    @CrystalblueMage ปีที่แล้ว +1

    If you can make images by removing noise from random noise. Can you make P solutions from NP solutions the same way by training on known P solutions having "noise" added to make them NP?

  • @grayaj23
    @grayaj23 ปีที่แล้ว

    "What amount of frog DO you want in this image?"
    I WANT ALL THE FROG.

  • @LinfordMellony
    @LinfordMellony ปีที่แล้ว

    Mind giving a quick review of Bluewillow and which software does it utiized? I think you guys break down the whole infrastructure which is actually very informative.

    • @bluesailormercury
      @bluesailormercury ปีที่แล้ว +1

      Somebody asked that in a Discord AMA a couple of days ago. They're not telling. But it's very likely Stable Diffusion, using a finetuned custom model, or several. So it should be the same infrastructure

  • @felixmerz6229
    @felixmerz6229 ปีที่แล้ว

    Only a matter of time until someone adapts this to 3d models. I mean, there are millions of 3d models on the internet in form of assets for all kind of engines and frameworks, all with a description to them, too.

  • @brym9159
    @brym9159 ปีที่แล้ว

    Mike said link to code in description!

  • @peterchindove7146
    @peterchindove7146 ปีที่แล้ว

    Pretty cool!

  • @carlmalia29
    @carlmalia29 ปีที่แล้ว

    love this tool but im having an error when trying to noise an image to run the AI over a guide image. the add_noise def returns an error of "AttributeError: 'int' object has no attribute 'to'". It come after the call line below any help would be amazing
    latents = scheduler.add_noise(encoded, noise, start_timestep)

  • @heurve
    @heurve ปีที่แล้ว +3

    On line 50, i should be changed to t (as we need the FloatTensor) 50: latents = scheduler.step(noise_pred, t, latents)["prev_sample"]

  • @Jianju69
    @Jianju69 ปีที่แล้ว +3

    A hybrid frog/snake is properly called a *SNOG*, obviously.

  • @morgan0
    @morgan0 ปีที่แล้ว

    so on the quality difference, dalle2 is 1024x but for some reason pretty heavily jpeg compressed, stable diffusion is 512x but (at least on replicate) much much less jpeg compressed, if at all (sometimes i’ve gotten stuff that looked compressed but it might’ve been from being trained on compressed images, not sure). so while it’s a lower resolution, i’ve found that it’s a higher quality image, but i’m sure there there are hosted versions that are much lower quality. also i’m not sure what differs between them for inpainting but i’ve found that for stable diffusion i can’t just add a mask, i have to inpaint stuff myself and get it somewhat close, otherwise i get variations on that part i was trying to get something else at

    • @morgan0
      @morgan0 ปีที่แล้ว +1

      oh and dalle2 is way way pricier than stable diffusion on replicate so i don’t know why they’re compressing the images so much, surely they should be able to afford storage for the images at the cost they charge

    • @deathstroyer
      @deathstroyer ปีที่แล้ว +1

      I would assume thats the imperfections resulting from the upsampling from 64x64 youre seeing

    • @morgan0
      @morgan0 ปีที่แล้ว

      @@deathstroyer oh yeah the autoencoder vs directly diffusing the image. would be cool to see someone fork stable diffusion and add on a non-autoencoded diffusion final step to make the output higher quality

    • @morgan0
      @morgan0 ปีที่แล้ว

      and it’s not a 64x image, it’s latent space

  • @miltiadiskoutsokeras9189
    @miltiadiskoutsokeras9189 ปีที่แล้ว +2

    I don't know if this is more amazing or more frightening. Brilliant stuff.

    • @andybaldman
      @andybaldman ปีที่แล้ว +1

      If you aren’t frightened, you aren’t paying attention.

    • @purplewine7362
      @purplewine7362 ปีที่แล้ว +3

      @@andybaldman if you're frightened, you're a luddite

    • @andybaldman
      @andybaldman ปีที่แล้ว

      @@purplewine7362 Or you've worked in the tech field long enough to know how dangerous this is, and how it will be used against people eventually. As happens with all tech.

  • @alikaperdue
    @alikaperdue 9 หลายเดือนก่อน

    @14:47 - idea: hand draw your animation sequence.Give the first to image and text to AI and get the result. Then hand the resulting image, your next hand drawn frame and the text to generate the 2nd frame. Continue the process so that each new frame is a combination of the last and what you want it to look like combined. In this way the "flicker" might be reduced.
    But I haven't seen what you're talking about. I may be off.

  • @meguellatiyounes8659
    @meguellatiyounes8659 ปีที่แล้ว

    what algorithms used in pakage managers? .

  • @realeques
    @realeques ปีที่แล้ว +2

    this whole topic blows my mind even more than when i first heard of deepfakes

  • @RaydenLGX
    @RaydenLGX ปีที่แล้ว

    So it is basically a morphing, blending and upscaling algorhythm of compressed/encoded data?

  • @uneek35
    @uneek35 ปีที่แล้ว +1

    Would love to see a test to see how it works when it's trained with a limited dataset.

  • @Monsterpala
    @Monsterpala 6 หลายเดือนก่อน

    "I have no idea what to use this for. There are website were people produce cool stuff." ... Rule 34 Sir.

  • @cyndicorinne
    @cyndicorinne 10 หลายเดือนก่อน

    I love this

  • @PaulFishwick
    @PaulFishwick ปีที่แล้ว

    I just watched this video. Obtained a Colab error on this statement: image = (image / 2 + 0.5).clamp(0, 1) . The error was: TypeError: unsupported operand type(s) for /: 'DecoderOutput' and 'int'

  • @the_proffesional1713
    @the_proffesional1713 8 หลายเดือนก่อน

    SD banned on Colab right?
    But some of people cracked it or bypass it and itd allows u to lauch SD on colab again, which is interesting. They probably changes something in the code of SD code to make them invisible as a unknown processed.

  • @ZT1ST
    @ZT1ST ปีที่แล้ว

    So I know you briefly mentioned the ethics of using these in the previous video (Usually around the trained images as I understand) - does Stable Diffusion allow you to not just supply that original image like the rabbit image you provided there, but the *entire* training set for a local training process based *only* on images you've provided/made/created/got permission to train based off of?

    • @Nerdule
      @Nerdule ปีที่แล้ว +4

      The trouble is that in order to specify "only include data you can learn from these specific images and no others", you'd need to retrain the entire network from zero, which costs six hundred thousand dollars worth of graphics card time.

  • @timeimp
    @timeimp ปีที่แล้ว +1

    "They are essentially the same, but quite different."
    Ah yes, the ol' computer science maxim of "same, but different"

  • @MadMan123654
    @MadMan123654 ปีที่แล้ว +2

    I would do just about anything for more Mike content!

  • @sebastianwette11
    @sebastianwette11 ปีที่แล้ว +2

    I wanted to ask if anyone got a simmilar error when running this line: "image = (image / 2 + 0.5).clamp(0, 1)" Error: "unsupported operand type(s) for /: 'DecoderOutput' and 'int'". Seems like to output of the vae decoding the latents is can not be used together with an int. Can anyone help?

    • @bret44
      @bret44 ปีที่แล้ว +3

      a comment below has come up with the fix: change image = vae.decode(latents) to image = vae.decode(latents).sample

  • @jaymayhoi
    @jaymayhoi ปีที่แล้ว

    so cool!

  • @methodof3
    @methodof3 ปีที่แล้ว

    Cartoons and anime are going to be so amazing in 5 to 10 years

    • @theemathas
      @theemathas ปีที่แล้ว

      Anime-style drawings are already a thing and is causing a lot of drama.

    • @bltzcstrnx
      @bltzcstrnx ปีที่แล้ว

      ​@@theemathas well, at least you can have unique wallpapers and profile pictures.

  • @Lodinn
    @Lodinn ปีที่แล้ว +1

    7:20 My man Mike knows that when you use a proper random function, the result would be 4. Guaranteed to be random!

  • @skwisgaarskwigelf331
    @skwisgaarskwigelf331 ปีที่แล้ว +2

    I was literally generating stable diffusion memes right now.

  • @sawyermclane6039
    @sawyermclane6039 ปีที่แล้ว

    When trying to run "pil_to_latent(im)", in the "Scheduling and Visualization" section, I'm getting "AttributeError: 'AutoencoderKLOutput' object has no attribute 'sample'". I've tried changing latent.mode() to latent.sample(), with no change.

    • @xormenterxormenter1883
      @xormenterxormenter1883 ปีที่แล้ว +2

      Replace it with this line:
      return 0.18215 * latent.latent_dist.mode() # or .mean or .sample

  • @pb-vj1qs
    @pb-vj1qs ปีที่แล้ว +3

    The code might have a bug, "TypeError: unsupported operand type(s) for /: 'DecoderOutput' and 'int'" on the line "image = (image / 2 + 0.5).clamp(0, 1)"

    • @alessandro_yt
      @alessandro_yt ปีที่แล้ว +1

      Same case here :(

    • @pb-vj1qs
      @pb-vj1qs ปีที่แล้ว +2

      change a line before to image = vae.decode(latents).sample, the .sample fixes it but now trying to get it to display

    • @alessandro_yt
      @alessandro_yt ปีที่แล้ว +1

      @@pb-vj1qs It worked now, thanks! The image is displayed here...

  • @gollolocura
    @gollolocura ปีที่แล้ว

    Me: "I'd like to order Rabbit"
    SD: "What percentage of Frog would you like with your Rabbit"

    • @threeMetreJim
      @threeMetreJim ปีที่แล้ว

      Depend on if you are in Yorkshire, UK; or Paris, France.

  • @Emperorhirohito19272
    @Emperorhirohito19272 ปีที่แล้ว +3

    Photoreal rarely works for me because the AI weirdiness is so obvious to the eye. I have really enjoyed creating images with various art styles though, it is extremely good at that. made some really competent artworks that (for me) are indistinguishable from a talented artist.

    • @dibbidydoo4318
      @dibbidydoo4318 ปีที่แล้ว

      "the AI weirdiness is so obvious to the eye"
      You mean those weird artifacts in the AI caused by Perlin's Noise?