unnir / cvae Goto Github PK
View Code? Open in Web Editor NEWConditional Variational AutoEncoder (CVAE) PyTorch implementation
Conditional Variational AutoEncoder (CVAE) PyTorch implementation
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?
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:
Determine the training device automatically.
Pass arguments to the script instead of declaring them in the code (e.g., batch_size, latent_size, epochs).
Compute the loss in the model's forward method for faster computations.
Remove the unnecessary one-hot encoding of labels since it's automatically done inside BCE.
Add a progress bar for both training and evaluation.
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:
Use Automatic Mixed Precision (AMP) for faster training on GPUs.
Implement a learning rate scheduler.
Add a loss graph visualizer like Wandb.
Add a method to save/load the model weights.
Add a requirements.txt file
These changes, along with other smaller improvements, will contribute to the overall enhancement of the project.
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()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.