Building a GAN From Scratch With PyTorch | Theory + Implementation

Learn how to create a GAN (Generative Adversarial Network) from scratch with PyTorch and PyTorch Lightning.
Colab with starter code: colab.research.google.com/dri...
Get your Free Token for AssemblyAI Speech-To-Text API 👇www.assemblyai.com/?...
Resources:
www.assemblyai.com/blog/pytor...
pytorch-lightning.readthedocs...
developers.google.com/machine...
neptune.ai/blog/gan-loss-func...
▬▬▬▬▬▬▬▬▬▬▬▬ CONNECT ▬▬▬▬▬▬▬▬▬▬▬▬
🖥️ Website: www.assemblyai.com
🐦 Twitter: / assemblyai
🦾 Discord: / discord
▶️ Subscribe: kzread.info?...
🔥 We're hiring! Check our open roles: www.assemblyai.com/careers
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Timestamps:
00:00 Intro
00:31 GAN Theory
03:29 PyTorch Lightning Setup
06:42 Generator + Discriminator
10:21 GAN Training
28:50 Testing
#MachineLearning #DeepLearning

Пікірлер: 64

  • @stuartallen2001
    @stuartallen20012 жыл бұрын

    Wow awesome video! I like this style where you give the intuition for a project first and then go about implementing it. I hope there's more like this in the future!

  • @AssemblyAI

    @AssemblyAI

    2 жыл бұрын

    Awesome, thank you for the feedback! -- Patrick

  • @aramsargsian7182

    @aramsargsian7182

    Ай бұрын

    😂

  • @mamase23
    @mamase234 ай бұрын

    For anyone getting errors, related to `unexpected keyword gpus` or related to manual optimization, consider downgrading your version of `pytorch-lightnning` to 1.5.10. When he shows the documentation he's following it's hard to tell but it's in the top right corner. Heaven forbid he adds that to the description or in one of the many previously asked questions...

  • @mohammadarabzadeh1219

    @mohammadarabzadeh1219

    3 ай бұрын

    it's "devices" now, change 'gpus' to "devices"

  • @user-nx4ts9iu5y

    @user-nx4ts9iu5y

    24 күн бұрын

    Thanks very helpful!! I actually poasted a question about the same i was just checking if he replied and then you stumpled upon 🙂🙂

  • @TheCreativeautomaton
    @TheCreativeautomaton Жыл бұрын

    super clear pytorch GAN example

  • @TuanNguyen-su5ty
    @TuanNguyen-su5ty10 ай бұрын

    awesome video, this video make me alignment more to GAN

  • @tianbowen721
    @tianbowen72111 ай бұрын

    It's my second time watching it, I"ll make sure to watch again for better understanding

  • @Mohamm-ed
    @Mohamm-ed Жыл бұрын

    Thanks a lot. Could you please make another tutorial about GAN for time series.

  • @giannissavvas7444
    @giannissavvas74448 ай бұрын

    Awesome video! Which is the version of pytorch lightning you were using at that time?

  • @tiwaritejaswo
    @tiwaritejaswo6 ай бұрын

    no explanation, he's just reading the code lines aloud.

  • @luluw9699

    @luluw9699

    2 ай бұрын

    Do you even code? If you know pytorch and pytorch lightning, you could understand the code he wrote. Besides if you want in depth knowledge you can get from other videos and follow this one.

  • @junjuljunjul4392
    @junjuljunjul439210 ай бұрын

    Excellent video, but has the full notebook been posted somewhere?

  • @saqibrajaputtv3609
    @saqibrajaputtv36095 ай бұрын

    sir please do create video on diffusion which will describe model through practical using pytorch or tensorflow like this

  • @unknownhero6187
    @unknownhero61872 жыл бұрын

    Thank you! As I know that dude also have a great python channel

  • @AssemblyAI

    @AssemblyAI

    2 жыл бұрын

    haha, yes he has :)

  • @patloeber

    @patloeber

    2 жыл бұрын

    🤗

  • @julio11789
    @julio11789 Жыл бұрын

    Callback.on_epoch_end has been removed in v1.8. I replaced that line with on_train_epoch_end

  • @liuwendong9223
    @liuwendong92236 ай бұрын

    thanks very much

  • @DeepakSingh-ji3zo
    @DeepakSingh-ji3zo Жыл бұрын

    Excellent!! Can you please update the colab link. the one in the description does not contain full code.

  • @germanogomes1097
    @germanogomes1097 Жыл бұрын

    This tutorial is amazing. Easy steps, nice code review. Even a beginner could follow along all the steps. Still I reproduce every code twice I'm getting this error 'GAN' object has no attribute '_backward_hooks'. Could help me to solve this?

  • @gowthamiv8196
    @gowthamiv8196 Жыл бұрын

    Very Good explanation on creating GAN.Thank you, Could you please explain me how image compression can be performed using GAN?

  • @ericbader7998
    @ericbader79986 ай бұрын

    The GColab code only includes the classes for the generator and discriminator, it looks like the rest of the code is missing or was deleted?

  • @Dhru-va
    @Dhru-va Жыл бұрын

    thank u

  • @vijaygill1526
    @vijaygill15268 ай бұрын

    I keep getting an error "training_step() missing 1 required positional argument: 'optimizer_idx'" If I set optimizer_idx=0 or =1 then it works and I've tried upto 65 epochs, doesn't seems to change the output at all still the exact same noise image which I get before any training.

  • @rohitray5947
    @rohitray59477 ай бұрын

    when I tried to train....an error occurred: TypeError: Trainer.__init__() got an unexpected keyword argument 'gpus'.....how to fix it?

  • @vineethanair-ih4dl

    @vineethanair-ih4dl

    4 ай бұрын

    i got the same error. how did you fix it

  • @NehalVerma-zr4mq

    @NehalVerma-zr4mq

    3 ай бұрын

    I too got same error

  • @zainmalik457
    @zainmalik4577 ай бұрын

    how to use GAN model for Multi modal image data like RGB , Depth and infrared images ?

  • @InPoeWeTrust
    @InPoeWeTrust Жыл бұрын

    I LOVE YOU

  • @sergioruppel7269
    @sergioruppel7269 Жыл бұрын

    I have a question, im trying to do a GAN to generate new data but from 32x32 data, ive seen many Docs about changing the parámeters in the generator and discriminator, but My gan fails to train. How can i modify this one to fit those picture sizes? The data i'm using si the htru1 dataset with pulsar data. Or can You point me to something to read? Thanks

  • @shrill8239

    @shrill8239

    7 ай бұрын

    Isolate and test run your train function and add code to trouble shoot errors at various points during training

  • @fizzleee
    @fizzleee8 ай бұрын

    does the optimizer index solution still work with newer lightning versions? I get the following error "Training with multiple optimizers is only supported with manual optimization"

  • @____zero_____

    @____zero_____

    7 ай бұрын

    had this issue too. Just revert back to the version in the video (1.5.10) by using "pip install pytorch-lightning==1.5.10" to specify the version

  • @enveripar8359
    @enveripar8359 Жыл бұрын

    How can I add custom dataset into this script

  • @thienphanuc9939
    @thienphanuc99395 ай бұрын

    Thanks for a great video. However, when I run the last code I get an error. MisconfigurationException: No `configure_optimizers()` method defined. Lightning `Trainer` expects as minimum a `training_step()`, `train_dataloader()` and `configure_optimizers()` to be defined.

  • @Dee-my8bg

    @Dee-my8bg

    5 ай бұрын

    Did you fix the error, and if you did, how?

  • @animationtv1908

    @animationtv1908

    2 ай бұрын

    I have the same error as well

  • @priyankvenkatesh877
    @priyankvenkatesh8772 жыл бұрын

    Hello, I'm trying to run the training but I end up getting this error: RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn Is there something I'm missing?

  • @victoriariosvazquez2924

    @victoriariosvazquez2924

    Жыл бұрын

    Same here. Could you solve this issue?

  • @utkarshtamrakar3873
    @utkarshtamrakar3873 Жыл бұрын

    i can sucessfully run the code till trainer (model, dm) ...... but in last no display of maps after each epoch

  • @michil.1192

    @michil.1192

    8 ай бұрын

    same here

  • @bloodang6793

    @bloodang6793

    5 ай бұрын

    in GAN class change the name of the method: "def on_epoch_end(self):" to "def on_train_epoch_end(self): self.plot_imgs()"

  • @ifthikhanmohamed1681
    @ifthikhanmohamed168110 ай бұрын

    RuntimeError: Training with multiple optimizers is only supported with manual optimization. Set `self.automatic_optimization = False`, then access your optimizers in `training_step` with `opt1, opt2, ... = self.optimizers()`. how to fix this

  • @cihan1403

    @cihan1403

    10 ай бұрын

    modify your GAN class like that "class GAN(pl.LightningModule): def __init__(self, latent_dim=100, lr=0.0002): super().__init__() self.automatic_optimization = False"

  • @ifthikhanmohamed1681

    @ifthikhanmohamed1681

    10 ай бұрын

    @@cihan1403 TypeError: GAN.training_step() missing 1 required positional argument: 'optimizer_idx'

  • @OmarKadry-jy5gs

    @OmarKadry-jy5gs

    8 ай бұрын

    still the same error@@cihan1403

  • @Democracy_Manifest
    @Democracy_Manifest Жыл бұрын

    This is an excellent video but you really should update it. It's only 1 year old but the code is generating this error: TypeError: Trainer.__init__() got an unexpected keyword argument 'gpus'

  • @pedroserrano5479

    @pedroserrano5479

    Жыл бұрын

    that's probably because the more recent versions of PytorchLighnting no longer have that parameter. To stick to the tutorial you can revert the version back to around the time this was made. So you can run: ! pip install --quiet "ipython[notebook]>=8.0.0, =1.8.1, =0.7, =1.4, =2.0.0rc0" that way you can run the code from the tutorial. You might also have to replace/remove the on_epoch_end() method

  • @cihan1403

    @cihan1403

    10 ай бұрын

    modify trainer like that "trainer = pl.Trainer(max_epochs=20, accelerator="auto")"

  • @zakenmaru8612

    @zakenmaru8612

    7 ай бұрын

    I did devices in lieu of gpus and it worked.

  • @CristinaJderiu-kn7gz
    @CristinaJderiu-kn7gz8 ай бұрын

    And shame tv nee inteork kik nonoem come to eve tochb hatem y bldy scarat zgarie kil ti said shti it Interpol kil it and will all kisng atfi no kid toy oh epididymis tl y ring atfi eve toch. Interpol said curvok

  • @mr10011994
    @mr10011994 Жыл бұрын

    Hope you can see this, but I have the error right at the end: __init__() got an unexpected keyword argument 'gpus' I did everything exactly you show here and check it twice... Wondering how I can reach out to solve this

  • @user-vz2xh4nz9p

    @user-vz2xh4nz9p

    Жыл бұрын

    parameters were changed, so you need to use this instead trainer = pl.Trainer(max_epochs=20, devices=AVAIL_GPUS, accelerator='gpu')

  • @ajaykumar-rv5jl

    @ajaykumar-rv5jl

    Жыл бұрын

    is your code now working ?

  • @user-vz2xh4nz9p

    @user-vz2xh4nz9p

    Жыл бұрын

    @@ajaykumar-rv5jl I could not set up environment for it, so it does not :(

  • @VASUDHARANIPATHEDAMIS

    @VASUDHARANIPATHEDAMIS

    Жыл бұрын

    @@user-vz2xh4nz9p hey now I have another error Training with multiple optimizers is only supported with manual optimization. Set `self.automatic_optimization = False`, then access your optimizers in `training_step` with `opt1, opt2, ... = self.optimizers()`. what should I do??

  • @shellman-ee9bh

    @shellman-ee9bh

    Жыл бұрын

    ​@@VASUDHARANIPATHEDAMIStry downgrading my pytorch lighting version to 1.6.4 pip uninstall pytorch-lightning pip install pytorch-lightning==1.6.4

  • @VASUDHARANIPATHEDAMIS
    @VASUDHARANIPATHEDAMIS Жыл бұрын

    Hello I have an error at the end could you help Trainer.__init__() got an unexpected keyword argument 'gpus'

  • @vineethanair-ih4dl

    @vineethanair-ih4dl

    4 ай бұрын

    yeah same here. did you get the solution?

Келесі