Skip to content

Commit

Permalink
Fix dependencies and kernel crash in captumyt.py (#2408)
Browse files Browse the repository at this point in the history
* Update captum dependencies (matplotlib and flask-compress)
* Use resnet18 due to RAM limitation
Google Colab crashes due to insufficient RAM (more than 12 GB is required) if resnet101 or resnet50 are used. Thus, resnet18 is used instead (approximately 6 GB is used).
  • Loading branch information
QasimKhan5x authored Jun 2, 2023
1 parent 420037e commit 4648254
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions beginner_source/introyt/captumyt.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,24 @@
Before you get started, you need to have a Python environment with:
- Python version 3.6 or higher
- For the Captum Insights example, Flask 1.1 or higher
- For the Captum Insights example, Flask 1.1 or higher and Flask-Compress
(the latest version is recommended)
- PyTorch version 1.2 or higher (the latest version is recommended)
- TorchVision version 0.6 or higher (the latest version is recommended)
- Captum (the latest version is recommended)
- Matplotlib version 3.3.4, since Captum currently uses a Matplotlib
function whose arguments have been renamed in later versions
To install Captum in an Anaconda or pip virtual environment, use the
appropriate command for your environment below:
With ``conda``::
conda install pytorch torchvision captum -c pytorch
conda install pytorch torchvision captum flask-compress matplotlib=3.3.4 -c pytorch
With ``pip``::
pip install torch torchvision captum
pip install torch torchvision captum matplotlib==3.3.4 Flask-Compress
Restart this notebook in the environment you set up, and you’re ready to
go!
Expand Down Expand Up @@ -155,7 +158,7 @@
# now.
#

model = models.resnet101(weights='IMAGENET1K_V1')
model = models.resnet18(weights='IMAGENET1K_V1')
model = model.eval()


Expand Down

0 comments on commit 4648254

Please sign in to comment.