Code Monkey home page Code Monkey logo

bfp_quant's Introduction

Neural Network Training with MX-Compatible Formats

This repository includes Jupyter notebooks showcasing the integration of the MX PyTorch Emulation Library for quantization of ML Models.

Overview of Notebooks

Each notebook in this repository demonstrates different aspects of training and evaluating neural networks with MX-compatible formats. Below is a brief overview:

detection.ipynb (Main Code)

  • Implements a SimpleCNN for CIFAR-10 classification using standard FP32 and dynamic precision switching between FP32, FP4, and FP8 based on runtime performance.
  • Includes advanced model management features for precision switching during runtime anomalies.

baseline.ipynb

  • Provides a baseline model using PyTorch's sequential API for MNIST classification.
  • Simple architecture and training loops for performance comparison.

FP32.ipynb

  • Trains a SimpleCNN model strictly using FP32 precision to serve as a performance benchmark.

MXFP_CUDA.ipynb

  • Integrates the MX PyTorch Emulation Library to train SimpleCNN using MX formats.
  • Demonstrates custom CUDA extensions for performance optimization.

Tensor_quant.py

  • Utility notebook for tensor quantization using the MX library.
  • Demonstrates the process of converting tensors to MX-compatible and bfloat formats.

ResNet18 BFP.ipynb

This notebook explores the application of Block Floating Point (BFP) quantization To ResNet18.

  • Implementation of BFPLinear, a custom linear layer that applies BFP quantization to its weights and biases.
  • A BFPModelWrapper class that enables dynamic switching between full precision and quantized states of a model, making it suitable for scenarios where precision trade-offs can be managed dynamically based on runtime performance metrics.

Getting Started

To set up the repository for running these notebooks:

  1. Follow instructions on installing the Microxcaling library.
  2. Install Python dependencies listed in requirements.txt.

bfp_quant's People

Contributors

lbux avatar bryanjvela 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.