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
40f9dc14
Commit
40f9dc14
authored
Feb 20, 2025
by
Baber
Browse files
get essays from HF
parent
5f2dae76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
lm_eval/tasks/ruler/prepare_niah.py
lm_eval/tasks/ruler/prepare_niah.py
+3
-2
No files found.
lm_eval/tasks/ruler/prepare_niah.py
View file @
40f9dc14
...
...
@@ -19,6 +19,7 @@ import re
import
uuid
from
functools
import
lru_cache
,
cache
from
typing
import
List
,
Union
,
Literal
import
datasets
import
numpy
as
np
import
wonderwords
...
...
@@ -326,8 +327,8 @@ def get_haystack(
)
->
Union
[
list
[
str
],
str
]:
NEEDLE
=
"One of the special magic {type_needle_v} for {key} is: {value}."
if
type_haystack
==
"essay"
:
essay
=
get_all_essays
(
)[
"text"
]
#
essay =
json.load(open(essay))["text"]
essay
=
datasets
.
load_dataset
(
"baber/paul_graham_essays"
,
split
=
"train"
)[
"text"
]
essay
=
" "
.
join
(
essay
)
haystack
=
re
.
sub
(
r
"\s+"
,
" "
,
essay
).
split
(
" "
)
elif
type_haystack
==
"repeat"
:
haystack
=
"The grass is green. The sky is blue. The sun is yellow. Here we go. There and back again."
...
...
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