Bradley Gathers
Update README.md
7ae1ab7 unverified
|
raw
history blame
4.36 kB
metadata
title: Demo Space
emoji: 🎨
colorFrom: gray
colorTo: blue
sdk: gradio
app_file: main.py
pinned: true

Feature Visualization Generator UI

Python Pytorch

A Feature Visualization (FV) generator UI. Utilizes the Gradio web framework in conjunction with the Lucent (Pytorch Lucid framework. Aimed to help others through experiential learning, allowing them to explore different input parameters and settings and quickly see their effects.

Concepts that are used in the FV generation process such as Channel Decorrelation and Spatial Decorelation are discussed in the Google Brain Feature Visualization article (Olah, et al.)

Tested layers are Conv2D (Convolutional Layer) and Linear layers. Feel free to experiment, I can not guarantee that they will optimize correctly.

Table of Contents
  1. About The Code
  2. Getting Started
  3. Usage

Try it out here! --> --Insert huggingface space here--

image

About The Code

The javascript code that runs this website is broken into specific modules to help with readiblity.

  • canvas.js
    • Drawing the lines connecting each button
    • Updating the canvas
    • Button creation / tree traversal
    • Button navigation
    • Button attractions
  • interactions.js
    • Model input
    • Model input interaction
    • Orchastraction of the creation and visualization of the new model
  • modelparser.js
    • Parses pytorch print model input string into a tree data structure (Via. regex)
    • Cleaning up string input
  • tree.js
    • Tree data structure used to store the model and navigate through

All javascript files are located in the scripts folder.

(back to top)

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

Make sure to have these setup/installed at a minimum

  • A modern browser that supports javascript

(Optional)

  • A printed pytorch model output to test with
    • This can be achieved by loading up a pytorch model and printing the model with
    print(<model variable here>)
    
    • I will not be going into detail on how to do this as it is out of the scope of this repo.

Installation

  1. Clone the repo
    git clone git@github.com:baxtrax/Model-Visualizer.git
    

(back to top)

Usage

HTML launch

Open the index.html file with a browser or deploy the website with a website deployment software.

I personally used the VScode extension Live Server for local development.

(back to top)

version https://git-lfs.github.com/spec/v1 oid sha256:8f318c9b980e22dbbcab1dc2c6344e36e3a8c6e9cfa9d7410ed9a798da7b2da1 size 137