This is a gentle introductin on how to start using an awesome library called Weights and Biases.


🪄 W&B Minimal PyTorch Tutorial

This tutorial is also accompanied with a PyTorch source code, it can be found in src folder. Furthermore, all plots and metrics that I mentioned here can be found here in this link.

You can also run the code with wandb. First you shoule go to a src directory, and run the following command:


0. About W&B.

Machine learning experiment tracking, dataset versioning, and model evaluation.

1. Setting up.

  1. Create an account on
  2. Install wandb.
pip install wandb
  1. Link your machine with your account. When logging in you should enter your private API key from
wandb login

2. Start a new run.

import wandb

wandb.init(·) starts the tracking system metrics and console logs.

3. Start to track metrics.

Different metrics like loss, accuracy can be easily done with wandb.log() comamnd. For example,

wandb.log({'accuracy': train_acc, 'loss': train_loss})

By default, wandb plots all metrics in one section. If you want to divide sections as for a training, validation, etc. You can just simply add a section name to the metric name by slash.

For example, if you had two losses, training and validation losses. You can split sections as follows:

wandb.log({'train/loss': train_loss, 'val/loss': val_loss})

4. Track hyperparameters.

When using argparse, you can use the command below and easily track hyperparameters you have used.

wandb.config.update(args) # adds all of the arguments as config variables

There are also other ways to save configuration values. For example, you can save configurationsa as a dictionary and pass it. Check more details here.

5. Track and visualise your weights and gradients.

Add, log = 'all' ) to track gradients and parameters weights.

Visualisation of weights:

Weights Visualisation

Visualisation of gradients:

Gradients Visualisation

6. Tune hyperparameters.

  1. Create a sweep configuration file, sweep.yaml.

For example it may look like this:

method: bayes
  name: validation_loss
  goal: minimize
    min: 0.0001
    max: 0.1
    values: ["adam", "sgd"]
  1. Initialize a sweep.

Run the following command:

wandb sweep sweep.yaml
  1. Launch agent(s)
wandb agent your-sweep-id

W&B will present some cool visualisations like this: Sweep Example

Nauryzbay K
Nauryzbay K
PyTorch Tutorial for Deep Learning Researchers

This repository provides tutorial code for deep learning researchers to learn PyTorch. In the tutorial, most of the models were implemented with less

Yunjey Choi 25.4k Jan 05, 2023
PyTorch tutorials.

PyTorch Tutorials All the tutorials are now presented as sphinx style documentation at: Contributing We use sphinx-galle

6.6k Jan 02, 2023
Simple examples to introduce PyTorch

This repository introduces the fundamental concepts of PyTorch through self-contained examples. At its core, PyTorch provides two main features: An n-

Justin Johnson 4.4k Jan 07, 2023
Deep Learning (with PyTorch)

Deep Learning (with PyTorch) This notebook repository now has a companion website, where all the course material can be found in video and textual for

Alfredo Canziani 6.2k Jan 02, 2023
A collection of various deep learning architectures, models, and tips

Deep Learning Models A collection of various deep learning architectures, models, and tips for TensorFlow and PyTorch in Jupyter Notebooks. Traditiona

Sebastian Raschka 15.5k Jan 07, 2023
Pytorch implementations of various Deep NLP models in cs-224n(Stanford Univ)

DeepNLP-models-Pytorch Pytorch implementations of various Deep NLP models in cs-224n(Stanford Univ: NLP with Deep Learning) This is not for Pytorch be

Kim SungDong 2.9k Dec 24, 2022
Minimal tutorials for PyTorch

Minimal tutorials for PyTorch adapted from Alec Radford's Theano tutorials. Tensor multiplication Linear Regression Logistic Regression Neural Network

Vinh Khuc 321 Oct 25, 2022
Simple PyTorch Tutorials Zero to ALL!

PyTorchZeroToAll Quick 3~4 day lecture materials for HKUST students. Video Lectures: (RNN TBA) Youtube Bilibili Slides Lecture Slides @GoogleDrive If

Sung Kim 3.7k Dec 30, 2022
C++ Implementation of PyTorch Tutorials for Everyone

C++ Implementation of PyTorch Tutorials for Everyone OS (Compiler)\LibTorch 1.9.0 macOS (clang 10.0, 11.0, 12.0) Linux (gcc 8, 9, 10, 11) Windows (msv

Omkar Prabhu 1.5k Jan 04, 2023
PyTorch tutorials and best practices.

Effective PyTorch Table of Contents Part I: PyTorch Fundamentals PyTorch basics Encapsulate your model with Modules Broadcasting the good and the ugly

Vahid Kazemi 1.5k Jan 04, 2023
Torch Containers simplified in PyTorch

pytorch-containers This repository aims to help former Torchies more seamlessly transition to the "Containerless" world of PyTorch by providing a list

Max deGroot 88 Apr 25, 2022
Some example scripts on pytorch

pytorch-practice Some example scripts on pytorch CONLL 2000 Chunking task Uses BiLSTM CRF loss with char CNN embeddings. To run use: cd data/conll2000

Shubhanshu Mishra 180 Dec 22, 2022
PyTorch Implementation of Fully Convolutional Networks. (Training code to reproduce the original result is available.)

pytorch-fcn PyTorch implementation of Fully Convolutional Networks. Requirements pytorch = 0.2.0 torchvision = 0.1.8 fcn = 6.1.5 Pillow scipy tqdm

Kentaro Wada 1.6k Jan 04, 2023
A set of examples around pytorch in Vision, Text, Reinforcement Learning, etc.

PyTorch Examples WARNING: if you fork this repo, github actions will run daily on it. To disable this, go to /examples/settings/actions and Disable Ac

19.4k Jan 01, 2023
ConvNet training using pytorch

Convolutional networks using PyTorch This is a complete training example for Deep Convolutional Networks on various datasets (ImageNet, Cifar10, Cifar

Elad Hoffer 336 Dec 30, 2022
The Hitchiker's Guide to PyTorch

The Hitchiker's Guide to PyTorch

Kai Arulkumaran 1k Dec 20, 2022
simple generative adversarial network (GAN) using PyTorch

Generative Adversarial Networks (GANs) in PyTorch Running Run the sample code by typing: ./ ...and you'll train two nets to battle it o

vanguard_space 32 Jun 14, 2020
Interactive deep learning book with multi-framework code, math, and discussions. Adopted at 200 universities. Interactive Deep Learning Book with Multi-Framework Code, Math, and Discussions Book website | STAT 157 Course at UC Berkeley | Latest version

Dive into Deep Learning ( 16k Jan 03, 2023
Open source guides/codes for mastering deep learning to deploying deep learning in production in PyTorch, Python, C++ and more.

Deep Learning Materials by Deep Learning Wizard Start Learning Now Please head to to start learning! It is mobile/tablet fr

Ritchie Ng 572 Dec 28, 2022
A scalable template for PyTorch projects, with examples in Image Segmentation, Object classification, GANs and Reinforcement Learning.

PyTorch Project Template is being sponsored by the following tool; please help to support us by taking a look and signing up to a free trial PyTorch P

Mo'men AbdelRazek 740 Dec 23, 2022