Git Product home page Git Product logo

cvae's People

Contributors

shulgin-s avatar unnir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cvae's Issues

Normalizing loss over entire dataset vs normalizing over number of batches.

I've noticed that when you display the training loss:

    print('====> Epoch: {} Average loss: {:.4f}'.format(
          epoch, train_loss / len(train_loader.dataset)))

you normalize that by the length of the entire dataset. Couldn't you instead divide it by the number of batches you passing for that epoch, in order to have an idea of the average loss based on batches?

A Contribution

I would like to contribute to this project, there are many aspects that can be improved. Here are the changes I propose for the code:

  1. Determine the training device automatically.
    
  2. Pass arguments to the script instead of declaring them in the code (e.g., batch_size, latent_size, epochs).
    
  3. Compute the loss in the model's forward method for faster computations.
    
  4. Remove the unnecessary one-hot encoding of labels since it's automatically done inside BCE.
    
  5. Add a progress bar for both training and evaluation.
    
  6. Modularize the code into multiple files to make it easier to explore and improve.
    

Additionally, there are several enhancements that could improve model training and usage:

  1. Use Automatic Mixed Precision (AMP) for faster training on GPUs.
    
  2. Implement a learning rate scheduler.
    
  3. Add a loss graph visualizer like Wandb.
    
  4. Add a method to save/load the model weights.
    
  5. Add a requirements.txt file
    

These changes, along with other smaller improvements, will contribute to the overall enhancement of the project.

KLD term in loss_function()

In loss_function instead of doing

    KLD = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp())
    return BCE + K

shouldn’t we normalize the KLD term over the batch instead? For example doing torch.mean()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.