Skip to content

Commit

Permalink
Skip adding special tokens to targets
Browse files Browse the repository at this point in the history
  • Loading branch information
jncraton committed Nov 18, 2024
1 parent 3f5a7fd commit 54c7257
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- Properly apply prompt format when providing `choices`
- Do not add special tokens before `choices`

## 0.22 - 2024-11-02

Expand Down
2 changes: 1 addition & 1 deletion languagemodels/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def rank_instruct(inputs, targets):
fmt = model_info.get("prompt_fmt", "{instruction}")
inputs = [fmt.replace("{instruction}", inst) for inst in inputs]

targ_tok = [tokenizer.encode(t).tokens for t in targets]
targ_tok = [tokenizer.encode(t, add_special_tokens=False).tokens for t in targets]
targ_tok *= len(inputs)

in_tok = []
Expand Down

0 comments on commit 54c7257

Please sign in to comment.