dair-ai/ML-Notebooks

🔥 Machine Learning Notebooks

Jupyter Notebook

3,440

119 commits

updated Apr 9, 2024

See the code

README

🐙 Machine Learning Notebooks

This repo contains machine learning notebooks for different tasks and applications. The notebooks are meant to be minimal, easily reusable, and extendable. You are free to use them for educational and research purposes.

This repo supports Codespaces!

  • Spin up a new instance by clicking on the green "<> Code" button followed by the "Configure and create codespace" option. Make sure to select the dev container config provided with this repo. This setups an environment with all the dependencies installed and ready to go.
  • Once the codespace is fully running, you can install all the libraries you will need to run the notebooks under the /notebooks folder. Open up a terminal and simply run conda create --name myenv --file spec-file.txt to install all the Python libraries including PyTorch.
  • Activate your environment conda activate myenv. You might need to run conda init zsh or whatever shell you are using... and then close + reopen terminal.
  • Finally you can try out if everything is working by opening a notebook such as /notebooks/bow.ipynb.

Getting Started

NameDescriptionNotebook
Introduction to Computational GraphsA basic tutorial to learn about computational graphs
PyTorch Hello World!Build a simple neural network and train it
A Gentle Introduction to PyTorchA detailed explanation introducing PyTorch concepts
Counterfactual ExplanationsA basic tutorial to learn about counterfactual explanations for explainable AI
Linear Regression from ScratchAn implementation of linear regression from scratch using stochastic gradient descent
Logistic Regression from ScratchAn implementation of logistic regression from scratch
Concise Logistic RegressionConcise implementation of logistic regression model for binary image classification.
First Neural Network - Image ClassifierBuild a minimal image classifier using MNIST
Neural Network from ScratchAn implementation of simple neural network from scratch
Introduction to GNNsIntroduction to Graph Neural Networks. Applies basic GCN to Cora dataset for node classification.

NLP

NameDescriptionNotebook
Bag of Words Text ClassifierBuild a simple bag of words text classifier.
Continuous Bag of Words (CBOW) Text ClassifierBuild a continuous bag of words text classifier.
Deep Continuous Bag of Words (Deep CBOW) Text ClassifierBuild a deep continuous bag of words text classifier.
Text Data AugmentationAn introduction to the most commonly used data augmentation techniques for text and their implementation
Emotion Classification with Fine-tuned BERTEmotion classification using fine-tuned BERT model

Transformers

NameDescriptionNotebook
Text Classification using TransformerAn implementation of Attention Mechanism and Positional Embeddings on a text classification task
Kaggle
Neural Machine Translation using TransformerAn implementation of Transformer to translate human readable dates in any format to YYYY-MM-DD format.
Kaggle
Feature Tokenizer TransformerAn implementation of Feature Tokenizer Transformer on a classification task
Kaggle
Named Entity Recognition using TransformerAn implementation of Transformer to perform token classification and identify species in PubMed abstracts
Kaggle
Extractive Question Answering using TransformerAn implementation of Transformer to perform extractive question answering
Kaggle

Computer Vision

NameDescriptionNotebook
Siamese NetworkAn implementation of Siamese Network for finding Image Similarity
Kaggle
Variational Auto EncoderAn implementation of Variational Auto Encoder to generate Augmentations for MNIST Handwritten Digits
Kaggle
Object Detection using Sliding Window and Image PyramidA basic object detection implementation using sliding window and image pyramid on top of an image classifier
Kaggle
Object Detection using Selective SearchA basic object detection implementation using selective search on top of an image classifier
Kaggle

Generative Adversarial Network

NameDescriptionNotebook
Deep Convolutional GANAn Implementation of Deep Convolutional GAN to generate MNIST digits
Kaggle
Wasserstein GAN with Gradient PenaltyAn Implementation of Wasserstein GAN with Gradient Penalty to generate MNIST digits
Kaggle
Conditional GANAn Implementation of Conditional GAN to generate MNIST digits
Kaggle

Parameter Efficient Fine-tuning

NameDescriptionNotebook
LoRA BERTAn Implementation of BERT Finetuning using LoRA Kaggle
LoRA BERT NERAn Implementation of BERT Finetuning using LoRA for token classification task Kaggle
LoRA T5An Implementation of T5 Finetuning using LoRA Kaggle
LoRA TinyLlama 1.1BAn Implementation of TinyLlama 1.1B Finetuning using LoRA Kaggle
QLoRA TinyLlama 1.1BAn Implementation of TinyLlama 1.1B Finetuning using QLoRA Kaggle
QLoRA Mistral 7BAn Implementation of Mistral 7B Finetuning using QLoRA Kaggle

If you find any bugs or have any questions regarding these notebooks, please open an issue. We will address it as soon as we can.

Reach out on Twitter if you have any questions.

Please cite the following if you use the code examples in your research:

@misc{saravia2022ml,
  title={ML Notebooks},
  author={Saravia, Elvis and Rastogi, Ritvik},
  journal={https://github.com/dair-ai/ML-Notebooks},
  year={2022}
}
ai
deep-learning
machine-learning
python
pytorch

dair-ai/ML-Notebooks

🔥 Machine Learning Notebooks

Jupyter Notebook

3,440

119 commits

updated Apr 9, 2024

See the code

README

🐙 Machine Learning Notebooks

This repo contains machine learning notebooks for different tasks and applications. The notebooks are meant to be minimal, easily reusable, and extendable. You are free to use them for educational and research purposes.

This repo supports Codespaces!

  • Spin up a new instance by clicking on the green "<> Code" button followed by the "Configure and create codespace" option. Make sure to select the dev container config provided with this repo. This setups an environment with all the dependencies installed and ready to go.
  • Once the codespace is fully running, you can install all the libraries you will need to run the notebooks under the /notebooks folder. Open up a terminal and simply run conda create --name myenv --file spec-file.txt to install all the Python libraries including PyTorch.
  • Activate your environment conda activate myenv. You might need to run conda init zsh or whatever shell you are using... and then close + reopen terminal.
  • Finally you can try out if everything is working by opening a notebook such as /notebooks/bow.ipynb.

Getting Started

NameDescriptionNotebook
Introduction to Computational GraphsA basic tutorial to learn about computational graphs
PyTorch Hello World!Build a simple neural network and train it
A Gentle Introduction to PyTorchA detailed explanation introducing PyTorch concepts
Counterfactual ExplanationsA basic tutorial to learn about counterfactual explanations for explainable AI
Linear Regression from ScratchAn implementation of linear regression from scratch using stochastic gradient descent
Logistic Regression from ScratchAn implementation of logistic regression from scratch
Concise Logistic RegressionConcise implementation of logistic regression model for binary image classification.
First Neural Network - Image ClassifierBuild a minimal image classifier using MNIST
Neural Network from ScratchAn implementation of simple neural network from scratch
Introduction to GNNsIntroduction to Graph Neural Networks. Applies basic GCN to Cora dataset for node classification.

NLP

NameDescriptionNotebook
Bag of Words Text ClassifierBuild a simple bag of words text classifier.
Continuous Bag of Words (CBOW) Text ClassifierBuild a continuous bag of words text classifier.
Deep Continuous Bag of Words (Deep CBOW) Text ClassifierBuild a deep continuous bag of words text classifier.
Text Data AugmentationAn introduction to the most commonly used data augmentation techniques for text and their implementation
Emotion Classification with Fine-tuned BERTEmotion classification using fine-tuned BERT model

Transformers

NameDescriptionNotebook
Text Classification using TransformerAn implementation of Attention Mechanism and Positional Embeddings on a text classification task
Kaggle
Neural Machine Translation using TransformerAn implementation of Transformer to translate human readable dates in any format to YYYY-MM-DD format.
Kaggle
Feature Tokenizer TransformerAn implementation of Feature Tokenizer Transformer on a classification task
Kaggle
Named Entity Recognition using TransformerAn implementation of Transformer to perform token classification and identify species in PubMed abstracts
Kaggle
Extractive Question Answering using TransformerAn implementation of Transformer to perform extractive question answering
Kaggle

Computer Vision

NameDescriptionNotebook
Siamese NetworkAn implementation of Siamese Network for finding Image Similarity
Kaggle
Variational Auto EncoderAn implementation of Variational Auto Encoder to generate Augmentations for MNIST Handwritten Digits
Kaggle
Object Detection using Sliding Window and Image PyramidA basic object detection implementation using sliding window and image pyramid on top of an image classifier
Kaggle
Object Detection using Selective SearchA basic object detection implementation using selective search on top of an image classifier
Kaggle

Generative Adversarial Network

NameDescriptionNotebook
Deep Convolutional GANAn Implementation of Deep Convolutional GAN to generate MNIST digits
Kaggle
Wasserstein GAN with Gradient PenaltyAn Implementation of Wasserstein GAN with Gradient Penalty to generate MNIST digits
Kaggle
Conditional GANAn Implementation of Conditional GAN to generate MNIST digits
Kaggle

Parameter Efficient Fine-tuning

NameDescriptionNotebook
LoRA BERTAn Implementation of BERT Finetuning using LoRA Kaggle
LoRA BERT NERAn Implementation of BERT Finetuning using LoRA for token classification task Kaggle
LoRA T5An Implementation of T5 Finetuning using LoRA Kaggle
LoRA TinyLlama 1.1BAn Implementation of TinyLlama 1.1B Finetuning using LoRA Kaggle
QLoRA TinyLlama 1.1BAn Implementation of TinyLlama 1.1B Finetuning using QLoRA Kaggle
QLoRA Mistral 7BAn Implementation of Mistral 7B Finetuning using QLoRA Kaggle

If you find any bugs or have any questions regarding these notebooks, please open an issue. We will address it as soon as we can.

Reach out on Twitter if you have any questions.

Please cite the following if you use the code examples in your research:

@misc{saravia2022ml,
  title={ML Notebooks},
  author={Saravia, Elvis and Rastogi, Ritvik},
  journal={https://github.com/dair-ai/ML-Notebooks},
  year={2022}
}
ai
deep-learning
machine-learning
python
pytorch

Significant stargazers

lewtun

1,612 followers · starred Apr 2022

Maxime Labonne

7,300 followers · starred Apr 2022

Kamran Ahmed

40,758 followers · starred Jan 2023

Michalis Papadimitriou

58 followers · starred May 2026