Code Monkey home page Code Monkey logo

audio-based-train-debugging's Introduction

Audio based neural network debugging

Debugging and analyzing neural network training based on audio generated corresponding to gradients during training time.

Doing this project because I have a lot of time on my hands and it seemed like a good idea to pass my time. ๐Ÿ˜

Generated Samples:

Most of the generated samples have been on SGD using variable learning rates.
The training has been done on a four layer NN for 200 steps in one pass using a small batch size(20)
Higher norms are indicated with higher pitch of the sound. In most cases the pitch increases to indicate the increase in gradient over time.

LR: 0.01

Audio Sample: lr_0.01
Notice the pitch increasing slowly over time indicating slow increase in gradients.

LR: 0.1

Audio Sample: lr_0.1
Notice how the gradients diverge due to higher learning rate and then converge back in again and again as it jumps great distances on the error curve towards minima.

LR: 1.0

Audio Sample: lr_1.0
Here you'll see how it diverges the neural network and it doen't converge after that as the gradients explode.

LR: 1.0 with batch size 256

Audio Sample: lr_1.0_bs_256
Warning: this gave me a minor headache.
Notice how the batch size increase affects the gradients as they explode instantly and lead to the annoying low pitch thumping sound caused by gradients becoming "NaN"

Code Brief

Requirements

Requirements are listed in requirements.txt file. The project requires PyTorch along with Torchvision and PyAudio.
Requirements can be installed as pip install -r requirements.txt

Files

  1. model.py: Model architecture file. By default takes batch size as 20. can be modified a little to generate 256 batch size result as well.
  2. utils.py: Utility functions for opening audio stream and other things.
  3. main.py: Main file to run the code. By default generates the three LR based audios for batch size 20.
    Run the code as python main.py

Conclusion

There is nothing of value here, just did this because it seemed like fun. I don't see anyone debugging their training process by analyzing weights using sound over visualizing weights using graphs.

audio-based-train-debugging's People

Contributors

vpanjeta avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.