Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
cfc7a48b
Commit
cfc7a48b
authored
Apr 16, 2024
by
lintangsutawika
Browse files
remove files
parent
bbb8386c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
14 deletions
+0
-14
lm_eval/tasks/bigbench/alternative_worlds/aux_metric.py
lm_eval/tasks/bigbench/alternative_worlds/aux_metric.py
+0
-14
No files found.
lm_eval/tasks/bigbench/alternative_worlds/aux_metric.py
deleted
100644 → 0
View file @
bbb8386c
from
textdistance
import
levenshtein
from
transformers
import
AutoTokenizer
# Change this tokenizer to fit with the model you are using.
tokenizer
=
AutoTokenizer
.
from_pretrained
(
"EleutherAI/pythia-2.8b"
,
max_new_tokens
=
128
)
def
token_edit_distance
(
references
,
predictions
,
**
kwargs
):
print
(
references
)
print
(
predictions
)
print
(
"###"
)
ref_tokens
=
tokenizer
.
encode
(
references
[
0
])
pred_tokens
=
tokenizer
.
encode
(
predictions
[
0
])
return
levenshtein
.
distance
(
ref_tokens
,
pred_tokens
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment