Captum · Model Interpretability for PyTorch screenshot

Code & IT · AI Code Assistant

Captum · Model Interpretability for PyTorch

Interpret models in PyTorch

Open source
Website
captum.ai
Category
Code & IT › AI Code Assistant
Pricing
Open source
Platforms
website

About Code & IT tools

Code & IT tools help you accomplish a range of AI-powered tasks. Captum · Model Interpretability for PyTorch is one option in this category.

About Captum · Model Interpretability for PyTorch

Supports interpretability of models across modalities including vision, text, and more. Supports most types of PyTorch models and can be used with minimal modification to the original neural network. Open source, generic library for interpretability research. Easily implement and benchmark new algorithms. Install Captum: via conda (recommended): conda install captum -c pytorch via pip: pip install captum Create and prepare model: import numpy as np import torch import torch.nn as nn from captum.attr import IntegratedGradients class ToyModel (nn.Module) : def __init__ (self) : super().__init__() self.lin1 = nn.Linear( 3 , 3 ) self.relu = nn.ReLU() self.lin2 = nn.Linear( 3 , 2 ) # initialize weights and biases self.lin1.weight = nn.Parameter(torch.arange( -4.0 , 5.0 ).view( 3 , 3 )) self.lin1.bias = nn.Parameter(torch.zeros( 1 , 3 )) self.lin2.weight = nn.Parameter(torch.arange( -3.0 , 3.0 ).view( 2 , 3 )) self.lin2.bias = nn.Parameter(torch.ones( 1 , 2 )) def forward (self, input) : return self.lin2(self.relu(self.lin1(input))) model = ToyModel() model.eval()

Features

  • Install Captum: via conda (recommended): conda install captum -c pytorch via pip: pip install captum

  • To make computations deterministic, let's fix random seeds: torch.manual_seed( 123 ) np.random.seed( 123 )

  • Define input and baseline tensors: input = torch.rand( 2 , 3 ) baseline = torch.zeros( 2 , 3 )

  • View Output: IG Attributions: tensor([[ -0.5922 , -1.5497 , -1.0067 ], [ 0.0000 , -0.2219 , -5.1991 ]]) Convergence Delta: tensor([ 2.3842e-07 , -4.7684e-07 ])

Use cases

  • Use case 1: Install Captum: via conda (recommended): conda install captum -c pytorch via pip: pip install captum

    Use this capability in a real workflow, not only as a demo.

  • Use case 2: To make computations deterministic, let's fix random seeds: torch.manual_seed( 123 ) np.random.seed( 123 )

    Use this capability in a real workflow, not only as a demo.

  • Use case 3: Define input and baseline tensors: input = torch.rand( 2 , 3 ) baseline = torch.zeros( 2 , 3 )

    Use this capability in a real workflow, not only as a demo.

Getting started

  • Visit Captum · Model Interpretability for PyTorch's website to create an account or start using it
  • Available on: website
  • Check the pricing page for the plan that fits

Screenshots

Product image
Product image

Related tools

Browse library
ModelsLab screenshot

ModelsLab

The best AI suite for all your generative needs.

Open sourcemodelslab.com
Music.AI screenshot

Music.AI

Build and scale audio-based AI products with advanced AI models.

Paidmusic.ai
TileMaker screenshot

TileMaker

TileMaker is a web app for creating AI applications.

tilemaker.app
Chaplin App screenshot

Chaplin App

Chaplin App simplifies trading for non-programmers by using AI technology and allowing users to build bots.

chaplin.app
Safurai | Developer Assistant - AI Coding Tool screenshot

Safurai | Developer Assistant - AI Coding Tool

Safurai is a free AI coding assistant for Visual Studio Code that boosts developer productivity.

safurai.com
Enhance ChatGPT screenshot

Enhance ChatGPT

Easily auto-click, track bookmarks, and download code blocks.

chrome.google.com

Compare Captum · Model Interpretability for PyTorch with other Code & IT tools such as ModelsLab, Music.AI before you pick one.