-
Notifications
You must be signed in to change notification settings - Fork 51
fix bugs in _prepare_text and IntruderScorer prompt formatting #153
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
Changes from all commits
a4b6013
7000df5
1e753cc
a9860ef
2c99b16
1d72a34
9ce2ce3
f7e1ff0
513e2e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,3 +183,4 @@ results/ | |
| statistics/ | ||
| .embedding_cache/ | ||
| wandb/ | ||
| uv.lock | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,7 @@ def _prepare_text( | |
| str_toks = example.str_tokens | ||
| assert str_toks is not None, "str_toks were not set" | ||
| clean = "".join(str_toks) | ||
|
|
||
| # Just return text if there's no highlighting | ||
| if not highlighted: | ||
| return clean, str_toks | ||
|
|
@@ -125,9 +126,17 @@ def threshold_check(i): | |
| token_pos = len(str_toks) - len(str_toks) // 4 | ||
| if token_pos in below_threshold: | ||
| random_indices = [token_pos] | ||
| if n_incorrect > 1: | ||
|
|
||
| num_remaining_tokens_to_highlight = n_incorrect - 1 | ||
| if num_remaining_tokens_to_highlight > 0: | ||
| remaining_tokens_below_threshold = below_threshold.tolist() | ||
| remaining_tokens_below_threshold.remove(token_pos) | ||
|
|
||
| random_indices.extend( | ||
| random.sample(below_threshold.tolist(), n_incorrect - 1) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in the old code, this could result in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch |
||
| random.sample( | ||
| remaining_tokens_below_threshold, | ||
| num_remaining_tokens_to_highlight, | ||
| ) | ||
| ) | ||
| else: | ||
| random_indices = random.sample(below_threshold.tolist(), n_incorrect) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.