From 9429c3ed523d510ad368ac1480d26382b9c0098a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristof=20Schr=C3=B6der?= Date: Thu, 5 Oct 2023 07:48:57 +0200 Subject: [PATCH] Remove capture from notebooks/influence_imagenet and use tag to hide output --- mkdocs.yml | 2 ++ notebooks/influence_imagenet.ipynb | 54 ++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index 7ba274e51..dde7b7e55 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -53,6 +53,8 @@ plugins: - hide remove_input_tags: - hide-input + remove_all_outputs_tags: + - hide-output binder: true binder_service_name: "gh" binder_branch: "develop" diff --git a/notebooks/influence_imagenet.ipynb b/notebooks/influence_imagenet.ipynb index 945fa9177..d5e67de2f 100644 --- a/notebooks/influence_imagenet.ipynb +++ b/notebooks/influence_imagenet.ipynb @@ -2,7 +2,13 @@ "cells": [ { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "# Influence functions for neural networks\n", "\n", @@ -261,10 +267,17 @@ { "cell_type": "code", "execution_count": 7, - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-output" + ] + }, "outputs": [], "source": [ - "%%capture\n", "model_ft = new_resnet_model(output_size=len(label_names))\n", "mgr = TrainingManager(\n", " \"model_ft\",\n", @@ -376,10 +389,17 @@ { "cell_type": "code", "execution_count": 10, - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-output" + ] + }, "outputs": [], "source": [ - "%%capture\n", "influences = compute_influences(\n", " TorchTwiceDifferentiable(mgr.model, mgr.loss),\n", " train_data,\n", @@ -662,10 +682,17 @@ { "cell_type": "code", "execution_count": 17, - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-output" + ] + }, "outputs": [], "source": [ - "%%capture\n", "corrupted_model = new_resnet_model(output_size=len(label_names))\n", "corrupted_dataset, corrupted_indices = corrupt_imagenet(\n", " dataset=train_ds,\n", @@ -756,10 +783,17 @@ { "cell_type": "code", "execution_count": 20, - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-output" + ] + }, "outputs": [], "source": [ - "%%capture\n", "influences = compute_influences(\n", " TorchTwiceDifferentiable(mgr.model, mgr.loss),\n", " corrupted_data,\n", @@ -1060,5 +1094,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 }