-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jbloom-md
committed
Apr 13, 2024
1 parent
44d2c6b
commit 6769466
Showing
1 changed file
with
17 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |