You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
update loading in bert demo to use transformer bridge (#1015)
* updated loading in attribution patching demo to use transformer bridge
* updated loading in bert demo to use transformer bridge
* Update to allow NSP via bridge
* Format and type fixes
* Add import
* Attribution Patching moved to own branch
* Hiding Attribution patching until its own PR
---------
Co-authored-by: Bryce Meyer <bryce13950@gmail.com>
Co-authored-by: jlarson4 <jonahalarson@comcast.net>
"source": "# NBVAL_IGNORE_OUTPUT\nimport os\n\n# Janky code to do different setup when run in a Colab notebook vs VSCode\nDEVELOPMENT_MODE = False\nIN_GITHUB = os.getenv(\"GITHUB_ACTIONS\") == \"true\"\ntry:\n import google.colab\n\n IN_COLAB = True\n print(\"Running as a Colab notebook\")\n\n # PySvelte is an unmaintained visualization library, use it as a backup if circuitsvis isn't working\n # # Install another version of node that makes PySvelte work way faster\n # !curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -; sudo apt-get install -y nodejs\n # %pip install git+https://github.com/neelnanda-io/PySvelte.git\nexcept:\n IN_COLAB = False\n\nif not IN_GITHUB and not IN_COLAB:\n print(\"Running as a Jupyter notebook - intended for development only!\")\n from IPython import get_ipython\n\n ipython = get_ipython()\n # Code to automatically update the HookedTransformer code as its edited without restarting the kernel\n ipython.run_line_magic(\"load_ext\", \"autoreload\")\n ipython.run_line_magic(\"autoreload\", \"2\")\n\nif IN_COLAB:\n %pip install transformer_lens\n %pip install circuitsvis"
33
+
"outputs": [
34
+
{
35
+
"name": "stdout",
36
+
"output_type": "stream",
37
+
"text": [
38
+
"Running as a Jupyter notebook - intended for development only!\n",
39
+
"The autoreload extension is already loaded. To reload it, use:\n",
40
+
" %reload_ext autoreload\n"
41
+
]
42
+
}
43
+
],
44
+
"source": [
45
+
"# NBVAL_IGNORE_OUTPUT\n",
46
+
"import os\n",
47
+
"\n",
48
+
"# Janky code to do different setup when run in a Colab notebook vs VSCode\n",
"WARNING:root:Support for BERT in TransformerLens is currently experimental, until such a time when it has feature parity with HookedTransformer and has been tested on real research tasks. Until then, backward compatibility is not guaranteed. Please see the docs for information on the limitations of the current implementation.\n",
130
-
"If using BERT for interpretability research, keep in mind that BERT has some significant architectural differences to GPT. For example, LayerNorms are applied *after* the attention and MLP components, meaning that the last LayerNorm in a block cannot be folded.\n"
131
-
]
132
-
},
133
-
{
134
-
"name": "stdout",
135
-
"output_type": "stream",
136
-
"text": [
137
-
"Moving model to device: mps\n",
138
-
"Loaded pretrained model bert-base-cased into HookedTransformer\n"
0 commit comments