Skip to content

Commit

Permalink
fix: neuronpedia quicklist
Browse files Browse the repository at this point in the history
  • Loading branch information
jbloom-md committed Apr 13, 2024
1 parent 44d2c6b commit 6769466
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions sae_lens/analysis/neuronpedia_integration.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import json
import urllib.parse
import webbrowser


def open_neuronpedia(
feature_id: int, layer: int = 0, model: str = "gpt2-small", dataset: str = "res-jb"
def get_neuronpedia_quick_list(
features: list[int],
layer: int,
model: str = "gpt2-small",
dataset: str = "res-jb",
name: str = "temporary_list",
):

path_to_html = f"https://www.neuronpedia.org/{model}/{layer}-{dataset}/{feature_id}"

print(f"Feature {feature_id}")
webbrowser.open_new_tab(path_to_html)
url = "https://neuronpedia.org/quick-list/"
name = urllib.parse.quote(name)
url = url + "?name=" + name
list_feature = [
{"modelId": model, "layer": f"{layer}-{dataset}", "index": str(feature)}
for feature in features
]
url = url + "&features=" + urllib.parse.quote(json.dumps(list_feature))
webbrowser.open(url)

0 comments on commit 6769466

Please sign in to comment.