Skip to content

Commit

Permalink
Merge pull request #284 from EleutherAI/fix-actually-removing-embeddi…
Browse files Browse the repository at this point in the history
…ngs-layer

fix: remove first layer (embeddings) from layer_indices
  • Loading branch information
lauritowal authored Aug 11, 2023
2 parents 7e60fa7 + af4c9d1 commit 3bbe26c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions elk/extraction/extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def extract_hiddens(
seed=cfg.seed,
)

layer_indices = cfg.layers or tuple(range(model.config.num_hidden_layers))
layer_indices = cfg.layers or tuple(range(1, model.config.num_hidden_layers))

global_max_examples = cfg.max_examples[0 if split_type == "train" else 1]

Expand Down Expand Up @@ -366,12 +366,13 @@ def hidden_features(cfg: Extract) -> tuple[DatasetInfo, Features]:
if num_dropped:
print(f"Dropping {num_dropped} non-multiple choice templates")

layer_indices = cfg.layers or tuple(range(1, model_cfg.num_hidden_layers))
layer_cols = {
f"hidden_{layer}": Array3D(
dtype="int16",
shape=(num_variants, num_classes, model_cfg.hidden_size),
)
for layer in cfg.layers or range(model_cfg.num_hidden_layers)
for layer in layer_indices
}
other_cols = {
"variant_ids": Sequence(
Expand Down

0 comments on commit 3bbe26c

Please sign in to comment.