Skip to content

Commit 2177516

Browse files
committed
fix make super sure that neuronpedia_id is present
1 parent 4ae6107 commit 2177516

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

sae_lens/analysis/neuronpedia_integration.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,22 @@ def get_neuronpedia_quick_list(
9090
default_test_text: Optional[str] = None,
9191
) -> str:
9292
if isinstance(sae, SaeInfo):
93+
if sae.neuronpedia_id is None:
94+
raise ValueError(
95+
"SAE does not have a Neuronpedia ID. Either dashboards for this SAE do not exist (yet) on Neuronpedia, or the SAE was not loaded via the from_pretrained method"
96+
)
97+
9398
neuronpedia_id = sae.neuronpedia_id
9499
model_name = sae.model_name
95100
elif isinstance(sae, SAE):
101+
if sae.cfg.neuronpedia_id is None:
102+
raise ValueError("Neuronpedia ID was not provided in SaeInfo.")
103+
96104
neuronpedia_id = sae.cfg.neuronpedia_id
97105
model_name = sae.cfg.model_name
98106
else:
99107
raise TypeError("sae must be either SaeInfo or SAE")
100108

101-
if isinstance(sae, SAE) and neuronpedia_id is None:
102-
raise ValueError(
103-
"SAE does not have a Neuronpedia ID. Either dashboards for this SAE do not exist (yet) on Neuronpedia, or the SAE was not loaded via the from_pretrained method"
104-
)
105-
106109
if len(features) == 0:
107110
raise ValueError("No features provided")
108111

0 commit comments

Comments
 (0)