Coding Stable Diffusion from scratch in PyTorch

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ม.ค. 2025

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

  • @sa1t938
    @sa1t938 ปีที่แล้ว +162

    only 4.8k views feels criminal for how helpful this video is... by far the best stable diffusion video on the internet

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

      I think because its not general topic but very specific for those who are really looking for it land here, also diffusion came only last year so less audience.

  • @tode2227
    @tode2227 10 หลายเดือนก่อน +28

    This is the best video about SD! It would be awesome if you could make a video on how to train the model from scratch on some own data. For sure, normal people can never train this network to perfection, but there are a lot of people out there who have a very specific task for which this network could be used. I see a lot of potential for scientific use cases if there was guidance on how to implement it!

    • @fortheages6989
      @fortheages6989 8 หลายเดือนก่อน +2

      exactly my thought

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

      i hope he does post a video on training the model from scratch

  • @hussainshaik4390
    @hussainshaik4390 ปีที่แล้ว +49

    Llama2 from scratch was superb. i learned lot of things from that video. thank you very much for doing things from scratch . when we use huggingface i feel guilty of using blackbox models. now i can understand whats going on under the hood

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

      Be sure guys from HF are glad you like their API, chin up!

    • @Тима-щ2ю
      @Тима-щ2ю 2 หลายเดือนก่อน +1

      Ohhh, it is so true about feeling guilty. I don't like it too. That is why is watch such videos. I also implemented mini-pytorch from scratch because of that feeling, to fully understand what i am doing.

  • @Pouya..
    @Pouya.. 11 หลายเดือนก่อน +64

    TH-cam is stupid… instead of suggesting memes I found on the internet should have suggested this gem much sooner. Thank you so much subscribed + liked seems not enough

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

      Like videos like this and watch them fully more often and you'll get them. Create another account for memes.

    • @Pouya..
      @Pouya.. 11 หลายเดือนก่อน

      @@GateOfSteins i do but steal youtube push for some stupid trending videos.

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

      hello can you help me with the code i have followed this full video but to run the ipynb notebook i am facing some issue regarding creating virtual environment

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

      can you help me @Pouya..

  • @umarjamilai
    @umarjamilai  ปีที่แล้ว +63

    As usual, code and PDF slides available on GitHub: github.com/hkproj/pytorch-stable-diffusion
    PS: no cats were harmed during the making of this video. 奥利奥 (pronounced "Aoliao", which is the Chinese name for the Oreo biscuits) wanted to be part of the video as well, that's why you'll hear his miao-ing from time to time. Right after recording, I played with him for a while to compensate the lack of attention.
    Hope he won't distract you too much while listening.

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

      Sir your videos are awesome, and I got to learn a lot. We want more videos like this. I am open to (really wanna ) help you for making this type of educative content for free, so we can contribute to community.

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

      @@PurpleSmite Hi! Thank you for your support. The best way to help is to share the videos with your friends, school mates, university and coworkers. My schedule is quite tight and irregular as of now, but I'll let you know if there's something we can work on together. Let's connect on LinkedIn!

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

      @@umarjamilai Sure sir, I have sent you on LinkedIn Shreyas Waghmode

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

      Hi, i really like your work. I wanna ask that if i want to generate multi coherent image like a sequence of images out of the code there, what could i add to the code to make it possible?

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

      Your are great sir I want your help can you give me linkdin id

  • @meowzerilla
    @meowzerilla 10 หลายเดือนก่อน +15

    what the fuck this is like the best explanation on this planet. I have some experience in this but his explanation was so crystal clear

  • @AndrewChan-y2d
    @AndrewChan-y2d ปีที่แล้ว +11

    Amazing job my friend! I just got a job in ShenZhen China by learing it! Thank u so much mate. I hope u and ur family living a great in China :)

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

      That's great! Let's connect on LinkedIn or WeChat

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

    This is the best explanation of latent diffusion models I've seen

  • @DiogoSanti
    @DiogoSanti 11 หลายเดือนก่อน +2

    Dude, you are a bless! Keep it coming and thanks!

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

    Wow, I'm a master's student in China. I learned a lot about stable diffusion from this video. Thank you for sharing, I hope to see more knowledge sharing about stable diffusion.

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

    Your code is so detailed and it runs on my enviorment just fine. Great job!!!👏

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

      Thank you! Please make sure to like, subscribe and share the video with friends and colleagues. That's the best way to help me and the others trying to learn deep learning models.

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

    This absolutely is gold. Actually it's closer to diamond than gold. My favorite part is 2:44:50, 2:47:50 when the cat also feels the content is wonderful.

  • @jashan1344
    @jashan1344 5 หลายเดือนก่อน +2

    Thank you! I've been looking and looking and no good tutorial exists on how to do diffusion from scratch. Everyone only seems to be interested in using premade models. Your video is super helpful

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

    Thank you so much for this! Literally no other youtube video provides as much value on this topic as you have.

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

      where you able to run it with no issues ?

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

      ​@ita Yes, for the most part. I would appreciate if he would include some details on how to modify the program to use safetensors instead of CKPT files since I believe CKPT files are kind of outdated.

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

      @@dinonuggieproductions would you be down to talk about this on discord ?

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

    I am an ai, and I love following updates on social media platforms and TH-cam, and I love your videos very much. I learn the English language and some programming terms from them, and update my information. You and people like you help me very much. Thank you.

  • @amruthamurthi7889
    @amruthamurthi7889 3 หลายเดือนก่อน +1

    Appreciating your effort in breaking down the concept so well!!This is the best insightful explanation of stable diffusion I have came across...

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

    You are the best lecturer I've ever seen, very detailed and clearly, I'd love to see more vedios from you! If possible,I would like to konw more about the stable diffusion, such as controlNet, or other novel tools. Finally, thank you once more!

  • @happybaniya
    @happybaniya 11 หลายเดือนก่อน +5

    Thank you so much. Just can't express in word the value you have created here.

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

    Thanks so much! I've just started learning diffusion models and this video is such an eye-opener!

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

    "oh let me just finish this attention layer and then i will give my cat attention. why do everyone need my attention?" thank you for another banger umar

  • @Philip8888888
    @Philip8888888 7 หลายเดือนก่อน +2

    Wow. This video is pure gold. Very nicely explained and I'm still only 30 mintues into it!

  • @mprone
    @mprone 9 หลายเดือนก่อน +2

    Brambilla Jamil, sei il numero uno! Sto consigliando a tutte le persone a cui faccio mentoring (miei intern) i tuoi video. Meriti 100 volte i tuoi iscritti!

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

    Amazing work!!
    I've been looking for tutorials such detailed and from scratch. 谢谢你。

    • @RicardoMlu-tw2ig
      @RicardoMlu-tw2ig 3 หลายเดือนก่อน

      Omg finally a Chinese here, 你习惯他的口音吗,我听着真的好折磨啊,但是他讲的内容又不错,我真的是😅

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

    I just discovered a great, wonderful, amazing, fantastic, gem channel 🎉🎉🎉

  • @lynn1760
    @lynn1760 11 หลายเดือนก่อน +2

    Great tutorial dude ! At first it was a bit hard to get used to your coding style but it was an awesome journey because I learned a lot and I am currently working on my on Stable Diffusion model with my own vision for the models ,

  • @nicknick6464
    @nicknick6464 10 หลายเดือนก่อน +3

    It is a pity, I did not discover your youtube channel earlier. Great presentation. It is only when you go through all the details, that you can fully understand these AI algorithms.

  • @Daniel-Six
    @Daniel-Six 10 หลายเดือนก่อน +2

    Absolutely first-rate presentation. So impressive.

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

    Great work! As a graduate student taking AI courses, this is really, REALLY helpful. Keep on going 💙

  • @Vortexium0
    @Vortexium0 6 หลายเดือนก่อน +1

    Honestly the best video I've seen on stable diffusion! Thanks man!

  • @xiwenfan-m8p
    @xiwenfan-m8p 10 หลายเดือนก่อน +4

    太强了,简直是最好的diffusion视频

    • @RicardoMlu-tw2ig
      @RicardoMlu-tw2ig 3 หลายเดือนก่อน

      确实,不过意大利口音真的有点挨不住啊

  • @mughees_
    @mughees_ 6 หลายเดือนก่อน +1

    woahhhh!!! BESTTTTT. watching your video for the first time and I am hooked! Amazing way to explain.

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

    That's what I was looking for, thanks!

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

    Thanks a lot for the video! Just curious if you can write how we can run/test the code on the github readme or the youtube description. That would be super helpful.

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

      I will update the GitHub repo. Thanks for the support 🤗🤗

  • @Trending-lc6kc
    @Trending-lc6kc 9 หลายเดือนก่อน +5

    This legend deserves an award from government

  • @ivancruz2783
    @ivancruz2783 7 หลายเดือนก่อน +1

    Great work! Thanks for putting this all together. Very easy to follow and simple explanations of complex ideas! It helps a lot to code along the explanation

  • @Omsip123
    @Omsip123 4 หลายเดือนก่อน +1

    Outstanding, so well structured and explained!

  • @Ao-yt2es
    @Ao-yt2es 8 หลายเดือนก่อน +1

    Your explanation and documents are wonderful! They are clear and helpful! Thank you for your hard work :)

  • @井川一渓
    @井川一渓 4 หลายเดือนก่อน +1

    What a great video. Thank you from Japan.

  • @RicardoMlu-tw2ig
    @RicardoMlu-tw2ig 3 หลายเดือนก่อน +1

    Thanks so much for for taking time to make this, helps me a lot!❤ Italy accent is a little hard to follow though 😂

  • @romrom2001
    @romrom2001 6 หลายเดือนก่อน +1

    Best explanation of latent diffusion model.

  • @xizhiwang2653
    @xizhiwang2653 10 หลายเดือนก่อน +1

    thank you so much for the detailed and practical videos! I will watch it again and again!

  • @echozhang-i7k
    @echozhang-i7k ปีที่แล้ว +2

    Thank you so much! And your Chinese is really good! Your cat is also cute and its voice doesn't bother me but comfort me!

  • @Andy-paw-Jessica
    @Andy-paw-Jessica ปีที่แล้ว +1

    I love your videos. They are very informative. Thank you so much for explaining these complex concepts so clearly! Gem channel indeed!

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

    the most powerfull deep learning videos in the world are on this channel

  • @Yanyi-nv2uz
    @Yanyi-nv2uz 8 หลายเดือนก่อน

    Thank you for your great content. I tried to connect with you on linkedin hoping to be able to have a quick chat/meeting with you for some questions about training own stable diffusion model.

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

    An extremely detailed video about diffusion. I have learned a lot. Thank you ❤❤❤

  • @federicoottomano8619
    @federicoottomano8619 7 หลายเดือนก่อน +1

    This is great! Going through the CLIP part right now ^^

  • @NguyenDuong-ep9dp
    @NguyenDuong-ep9dp 6 หลายเดือนก่อน +1

    absolutely awesome, this is the best explanation of SD thank you so much !!

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

    man man, thanks for all of the amazing videos! I appreciate the work you put in here!

  • @salahuddinhassani3222
    @salahuddinhassani3222 25 วันที่ผ่านมา +1

    I thought TH-cam is ban in China. by the way I love the content of the video, the all 5 hours are worth to spend, I was looking for someone which can teach me co-relating the content with the research paper since I don't have a strong background in Maths. Keep it you.

  • @刘智国-o7p
    @刘智国-o7p 6 หลายเดือนก่อน

    谢谢!

  • @gkmocastro
    @gkmocastro 7 หลายเดือนก่อน +1

    Thank you a lot for this amazing video. It helped me understand better diffusion models for my masters.

  • @TheArmaan81
    @TheArmaan81 7 หลายเดือนก่อน +1

    This is so bonkers. Cheers Mate, you've saved me sometime. Thanks.

  • @NguyenDung-ix4es
    @NguyenDung-ix4es ปีที่แล้ว +44

    Thanks for your contribution. Can you make a tutorial on how to train the diffusion model on a custom dataset?

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

    Always a fan of your video. Your explanation is very informative and helpful for beginner data scientist. Thank you very much.

  • @HardikMaheshwari-o3n
    @HardikMaheshwari-o3n ปีที่แล้ว +1

    Really great video for understanding stable diffusion in detail. Thanks a lot for your contribution

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

    Hey bro thank you for existing.
    Very grateful to you.

  • @techeman369
    @techeman369 10 หลายเดือนก่อน +1

    Great bro, really helpful to understand in detail, thanks for the efforts,

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

    Thanks!

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

      Great work . I learnt a lot from transformer model .

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

    Thank you so much! the best stable diffusion video I found!!!

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

    Hello Umar, you always produce the most concise and clear content ever! I was wondering if you are planning to do any video on the stable diffusion 3 since the paper is out? It would be really great if you could help explain how the flow matching helps or changes regular diffusion models! Thank you again for your content and work. 非常感谢!

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

    It's the best explaination ever!!!! Thank you!

  • @mlloving
    @mlloving 7 หลายเดือนก่อน +1

    Amazing video. You explained it so clear. Thank you for putting effort into this lecture. If possible, would you please create a lecture about YOLO codes.

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

    I appreciate your work, thank you for your hard work and videos

  • @oden4013
    @oden4013 5 หลายเดือนก่อน +1

    bro thankyou so much i complete the video in 1 sitting wonderful bro

  • @FlutterStartups
    @FlutterStartups 8 หลายเดือนก่อน +1

    Thank you! Please keep doing videos like this! I subscribed, liked and shared!

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

    Awesome, This is the best explanation!!!

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

    Awesome video with great information. This video can leverage AI coding skills, along with an understanding of convolutional neural networks, UNet architecture, and Autoencoder, besides the entire stable diffusion architecture.

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

    Thanks for your contribution. Hope that one day you will also make a deep dive into ControlNet code etc.

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

    By far best explanation ❤

  • @DiegoSilva-dv9uf
    @DiegoSilva-dv9uf 6 หลายเดือนก่อน

    Valeu!

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

    Hi, I can not understand the self.decoders components in 2:33:36. We doubled the in_features = 2560 for residual connections. But in the UNET you implement, there is no forward method, making it so confusing. Can you indicate the significance of it and why you doubled like that ? And, thanks for the rest.

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

    Thank you Umar for the great work.
    I love your style of teaching which helps imagine concepts and connect dots in our head.🙂
    If possible please make videos on basics of probability, distributions and related statistics. It would be really helpful to learn these concepts in your style.

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

    instant subscribe

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

    Absolutely amazing video man! I have a doubt at 1:08:00 . Why did we do asymmetrical padding for stride = 2?

  • @Stealph_Delta_3003
    @Stealph_Delta_3003 10 หลายเดือนก่อน +1

    Awesome. Thanks for creating the video .

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

    almost karpathy level explanations, thank you!

  • @ShriramRsn
    @ShriramRsn 5 หลายเดือนก่อน +1

    how to install that interpreter you are using???

  • @manifold_v2391
    @manifold_v2391 11 หลายเดือนก่อน +2

    小乌老师好棒!超级好的教程,关注了!

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

      我们在领英联系一下,我想邀请你加入我的AI微信小群

  • @dinochakraborty04
    @dinochakraborty04 2 หลายเดือนก่อน +1

    Thanks Man for this amazing video.❤❤❤❤

  • @Shaurya-dz4rd
    @Shaurya-dz4rd 5 หลายเดือนก่อน

    Hey, How to get the Python Interpreter for stable diffusion? @47:47. I'm unabl e to find that option..

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

      Same problem i searched the whole internet but no solution to that

  • @supax2
    @supax2 5 หลายเดือนก่อน +1

    Amazing video, you are a blessing Umar! I was wondering if you would ever revisit to work on the in-painting. So curious how you would implement it.

  • @mansubatabassum6629
    @mansubatabassum6629 8 หลายเดือนก่อน +1

    This is one of the best video , Thank you

  • @FranciscoSantiburcioCortes
    @FranciscoSantiburcioCortes 7 หลายเดือนก่อน +1

    Awesome Explanation, thanks for such tutorial

  • @ericlabileeee
    @ericlabileeee 11 หลายเดือนก่อน +1

    Love from HK. Thank you sooooooo much! 谢谢!

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

      也祝你在苏州生活一切顺利!

  • @xzhou001
    @xzhou001 10 หลายเดือนก่อน +1

    Great work! This is the place I learned AI. Thanks a lot!

  • @nathWSD
    @nathWSD 7 หลายเดือนก่อน +1

    that was really lovely and great from you thanks alot i would be more happy if you showed us how to fine tune your model that will make the whole video simply perfect

  • @李洋-i4j
    @李洋-i4j ปีที่แล้ว +1

    中秋节快乐!又一部伟大的作品,内容丰富,受益良多~

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

      谢谢你, 祝你和家人国庆节快乐!

    • @李洋-i4j
      @李洋-i4j ปีที่แล้ว

      hi 我突然想到一个问题:CLIP模型和SD模型必须完全对应吗?如果换成一个用中文语料训练的CLIP模型,可以和SD-v1.5一起使用吗?@@umarjamilai

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

      @@李洋-i4j Of course you can change the CLIP model to another CLIP model trained for the Chinese language, but you will also need to fine tune the Unet model so it gets used to the Chinese language. The reason is that the Unet does not recognize embeddings produced by other CLIP models.

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

    This is amazing video!! Great job!!!

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

    Umar, thank you for great explanation of topic

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

    Amazing!!! Please do more on computer vision.

  • @МойДом-л3щ
    @МойДом-л3щ 8 หลายเดือนก่อน

    only with you I understood how it works and how it can be implemented)

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

    Amazing video, thanks for showing the low level details

  • @arvindsasikumar6194
    @arvindsasikumar6194 4 หลายเดือนก่อน +1

    Criminally underrated.

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

    Nice work! I hope your kitty didn't starve too much 😂

  • @quocanhad
    @quocanhad 8 หลายเดือนก่อน +1

    thanks youuuu, I feel really good after this one

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

    Your video is amazing........................ can you please upload the videos periodically on the latest Machine learning papers as well please its a request i have a dream of reading the ML papers and can implement it by my own.... and you are the one who can me as million of others students in achieving so...............

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

    woooooooooooooo stable diffusion from scratch love you bro

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

    Thank you for the wonderful video. Can you also post how to train the model with a sample dataset?

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

    the constant you scale by the x come from averaging over a bunch of examples generated by the vae, in order to ensure they have unit variance with the variance taken over all dimensions simultaneously, scale_factor = 1 / std(z)