Building a GAN From Scratch With PyTorch | Theory + Implementation

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024

Комментарии • 74

  • @tiwaritejaswo
    @tiwaritejaswo 10 месяцев назад +20

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

    • @luluw9699
      @luluw9699 5 месяцев назад +1

      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.

  • @stuartallen2001
    @stuartallen2001 2 года назад +21

    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!

  • @agenticmark
    @agenticmark 21 день назад

    reading code isnt teaching my man. i understand whats going on here, but thats after a few years in ML. its probably not that useful for newbs trying to figure this stuff out....
    i use gans for audio generation and upscaling. works great! for those interested, this is how RVC voice cloning works...

    • @user-ug6kk5ux5q
      @user-ug6kk5ux5q 19 дней назад

      newbs should probably start with the basics like all of us did..and not jump directly to generative ai

  • @mamase23
    @mamase23 7 месяцев назад +6

    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 6 месяцев назад

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

    • @Prabudh-q5j
      @Prabudh-q5j 3 месяца назад

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

    • @NehaSharmabcs
      @NehaSharmabcs 2 месяца назад

      can u share the whole working code ?

    • @Chia_seeds
      @Chia_seeds 18 дней назад

      @@mohammadarabzadeh1219 no it cannot work

  • @djsosbxbdirndxnkcbebxhxbe
    @djsosbxbdirndxnkcbebxhxbe 11 дней назад

    What is the point of just reading already written code first and writing new code while reading it then?

  • @julio11789
    @julio11789 Год назад +13

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

  • @user-ug6kk5ux5q
    @user-ug6kk5ux5q 19 дней назад

    why do you generate random data twice? you have a variable self.validation_z = torch.randn(6, self.hparams.latent_dim), that you only use in the plot function wtf. And durring training you generate other z values wtf. And you don t have a validation function. I don't understand what is happening in here

  • @TuanNguyen-su5ty
    @TuanNguyen-su5ty Год назад

    awesome video, this video make me alignment more to GAN

  • @junjuljunjul4392
    @junjuljunjul4392 Год назад +2

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

  • @Democracy_Manifest
    @Democracy_Manifest Год назад +2

    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 Год назад +1

      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

    • @en-iyi-benim
      @en-iyi-benim Год назад

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

    • @zakenmaru8612
      @zakenmaru8612 10 месяцев назад

      I did devices in lieu of gpus and it worked.

  • @NehaSharmabcs
    @NehaSharmabcs 2 месяца назад

    can anyone share the whole working code please?

  • @Mohamm-ed
    @Mohamm-ed 2 года назад +1

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

  • @mr10011994
    @mr10011994 Год назад +4

    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

    • @МарияМакарова-п3й
      @МарияМакарова-п3й Год назад +1

      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 ?

    • @МарияМакарова-п3й
      @МарияМакарова-п3й Год назад

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

    • @VASUDHARANIPATHEDAMIS
      @VASUDHARANIPATHEDAMIS Год назад

      @@МарияМакарова-п3й 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 Год назад +4

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

  • @rohitray5947
    @rohitray5947 10 месяцев назад +3

    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 7 месяцев назад +1

      i got the same error. how did you fix it

    • @NehalVerma-zr4mq
      @NehalVerma-zr4mq 6 месяцев назад

      I too got same error

    • @user-ug6kk5ux5q
      @user-ug6kk5ux5q 19 дней назад

      it is because the gpus param was deprecated.
      Write:
      trainer = pl.Trainer(max_epochs=20, accelerator='gpu', devices='auto')
      instead.

  • @fizzleee
    @fizzleee 11 месяцев назад +1

    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_____ 10 месяцев назад +1

      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

  • @thienphanuc9939
    @thienphanuc9939 8 месяцев назад +1

    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.

  • @tianbowen721
    @tianbowen721 Год назад +1

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

  • @sergioruppel7269
    @sergioruppel7269 Год назад +1

    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 10 месяцев назад

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

  • @CristinaJderiu-kn7gz
    @CristinaJderiu-kn7gz 11 месяцев назад

    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

  • @saqibrajaputtv3609
    @saqibrajaputtv3609 9 месяцев назад

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

  • @vijaygill1526
    @vijaygill1526 11 месяцев назад

    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.

  • @utkarshtamrakar3873
    @utkarshtamrakar3873 Год назад +1

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

    • @michil.1192
      @michil.1192 11 месяцев назад

      same here

    • @bloodang6793
      @bloodang6793 8 месяцев назад

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

  • @zainmalik457
    @zainmalik457 10 месяцев назад

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

  • @DeepakSingh-ji3zo
    @DeepakSingh-ji3zo Год назад +3

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

  • @ericbader7998
    @ericbader7998 9 месяцев назад

    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?

  • @ifthikhanmohamed1681
    @ifthikhanmohamed1681 Год назад +1

    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

    • @en-iyi-benim
      @en-iyi-benim Год назад +1

      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 Год назад

      @@en-iyi-benim TypeError: GAN.training_step() missing 1 required positional argument: 'optimizer_idx'

    • @OmarKadry-jy5gs
      @OmarKadry-jy5gs 11 месяцев назад

      still the same error@@en-iyi-benim

    • @user-ug6kk5ux5q
      @user-ug6kk5ux5q 19 дней назад

      @@en-iyi-benim not enough

  • @TheCreativeautomaton
    @TheCreativeautomaton Год назад +1

    super clear pytorch GAN example

  • @liuwendong9223
    @liuwendong9223 9 месяцев назад

    thanks very much

  • @giannissavvas7444
    @giannissavvas7444 11 месяцев назад

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

  • @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?

  • @enveripar8359
    @enveripar8359 Год назад

    How can I add custom dataset into this script

  • @unknownhero6187
    @unknownhero6187 2 года назад +1

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

  • @InPoeWeTrust
    @InPoeWeTrust Год назад

    I LOVE YOU

  • @priyankvenkatesh877
    @priyankvenkatesh877 2 года назад +2

    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?

  • @Dhru-va
    @Dhru-va Год назад

    thank u

  • @gowthamiv8196
    @gowthamiv8196 Год назад

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

  • @VASUDHARANIPATHEDAMIS
    @VASUDHARANIPATHEDAMIS Год назад +2

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

    • @vineethanair-ih4dl
      @vineethanair-ih4dl 7 месяцев назад

      yeah same here. did you get the solution?

    •  2 месяца назад

      What is used in the new version of Lightning is something like
      pl.Trainer(max_epochs=20, accelerator='auto', devices='auto')