Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binarized meta-templates; some extraction refactoring #218

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bbee489
Initial support for FEVER
norabelrose Apr 22, 2023
5ba1ddd
Start saving and fitting a reporter to the input embeddings
norabelrose Apr 22, 2023
3b1f74d
Merge branch 'input-embeddings' into template-filtering
norabelrose Apr 22, 2023
51ba54f
Rename layer 0 to 'input' to make it more clear
norabelrose Apr 22, 2023
544b485
Actually rename layer 0 correctly
norabelrose Apr 22, 2023
43da44e
Handle layer_stride correctly
norabelrose Apr 22, 2023
9056e00
Merge branch 'input-embeddings' into template-filtering
norabelrose Apr 22, 2023
756fa53
label_choices
norabelrose Apr 22, 2023
93b7ae0
Clean up train and eval commands; do transfer in sweep
norabelrose Apr 22, 2023
57d0b8b
Support INLP and split eval output into multiple CSVs
norabelrose Apr 22, 2023
228a6a0
Merge branch 'inlp' into template-filtering
norabelrose Apr 22, 2023
b086f0b
Merge branch 'inlp' into template-filtering
norabelrose Apr 25, 2023
934cd54
Log ensembled metrics
norabelrose Apr 26, 2023
dff69bf
Fixing pyright version
norabelrose Apr 26, 2023
b181d3e
Merge remote-tracking branch 'origin/main' into ensembling
norabelrose Apr 26, 2023
15254bf
Merge main
norabelrose Apr 26, 2023
69c2d55
Tons of stuff, preparing for sciq_binary experiment
norabelrose Apr 27, 2023
960ff01
Support --binarize again
norabelrose Apr 27, 2023
c9e62ea
Partial support for truthful_qa
norabelrose Apr 27, 2023
eb71a6c
Merge branch 'main' into template-filtering
norabelrose Apr 29, 2023
88bb15e
Merge remote-tracking branch 'origin/main' into template-filtering
norabelrose Apr 29, 2023
c648ff0
Remove crap
norabelrose Apr 29, 2023
ef12130
EleutherAI/truthful_qa_mc
norabelrose Apr 29, 2023
5d60ebd
Update templates
norabelrose Apr 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove crap
  • Loading branch information
norabelrose committed Apr 29, 2023
commit c648ff0e2e4de8e043e6a3b6e90acf0112683260
25 changes: 1 addition & 24 deletions elk/promptsource/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from collections import Counter
from dataclasses import dataclass
from pathlib import Path
from typing import Any, ClassVar
from typing import ClassVar

import yaml
from jinja2 import BaseLoader, Environment, meta
Expand Down Expand Up @@ -174,29 +174,6 @@ def apply(self, example, truncate=True, highlight_variables=False):
for part in rendered_example.split("|||")
]

def contrast_set(
self, example: dict[str, Any], label_key: str, pseudo_labels: list
) -> tuple[str, list[str]]:
# Record the RNG state so that any non-deterministic filters in the template
# will not affect the contrast set
rng_state = random.getstate()

answers = []
questions = set()

for pseudo_label in pseudo_labels:
pseudo_example = example.copy()
pseudo_example[label_key] = pseudo_label

random.setstate(rng_state)
q, a = self.apply(pseudo_example)
answers.append(a)
questions.add(q)

breakpoint()
assert len(questions) == 1, "Contrast set questions must be identical"
return questions.pop(), answers

@staticmethod
def _strip_spaces(string):
"""Same functionality as str.strip(), but ignores newlines"""
Expand Down
1 change: 0 additions & 1 deletion elk/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def prepare_data(

split = ds[key].with_format("torch", device=device, dtype=torch.int16)
labels = assert_type(Tensor, split["label"])
breakpoint()
val_h = int16_to_float32(assert_type(Tensor, split[f"hidden_{layer}"]))

with split.formatted_as("torch", device=device):
Expand Down