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
7c853109
Commit
7c853109
authored
Jul 23, 2025
by
Baber
Browse files
remove deps
parent
87445e95
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
lm_eval/decontamination/archiver.py
lm_eval/decontamination/archiver.py
+15
-4
pyproject.toml
pyproject.toml
+0
-6
No files found.
lm_eval/decontamination/archiver.py
View file @
7c853109
# /// script
# requires-python = ">=3.8"
# dependencies = [
# "jsonlines",
# "mmap",
# "tqdm",
# "zstandard",
# ]
# ///
# ruff: noqa
import
datetime
import
datetime
import
io
import
io
import
json
import
json
...
@@ -111,7 +122,7 @@ class TextReader:
...
@@ -111,7 +122,7 @@ class TextReader:
current_file_position
=
0
current_file_position
=
0
line_counter
=
0
line_counter
=
0
with
(
with
(
open
(
self
.
file_path
,
"r"
,
encoding
=
"utf-8"
)
as
fh
,
open
(
self
.
file_path
,
encoding
=
"utf-8"
)
as
fh
,
tqdm
.
tqdm
(
tqdm
.
tqdm
(
total
=
os
.
path
.
getsize
(
self
.
file_path
),
total
=
os
.
path
.
getsize
(
self
.
file_path
),
dynamic_ncols
=
True
,
dynamic_ncols
=
True
,
...
@@ -133,7 +144,7 @@ class TextReader:
...
@@ -133,7 +144,7 @@ class TextReader:
def
read_and_tell
(
self
):
def
read_and_tell
(
self
):
current_file_position
=
0
current_file_position
=
0
with
open
(
self
.
file_path
,
"r"
,
encoding
=
"utf8"
)
as
fh
:
with
open
(
self
.
file_path
,
encoding
=
"utf8"
)
as
fh
:
with
mmap
.
mmap
(
fh
.
fileno
(),
length
=
0
,
access
=
mmap
.
ACCESS_READ
)
as
mmap_obj
:
with
mmap
.
mmap
(
fh
.
fileno
(),
length
=
0
,
access
=
mmap
.
ACCESS_READ
)
as
mmap_obj
:
for
line
in
iter
(
mmap_obj
.
readline
,
b
""
):
for
line
in
iter
(
mmap_obj
.
readline
,
b
""
):
line
=
line
.
decode
(
"utf-8"
)
line
=
line
.
decode
(
"utf-8"
)
...
@@ -143,14 +154,14 @@ class TextReader:
...
@@ -143,14 +154,14 @@ class TextReader:
yield
line
[:
-
1
],
raw_bytes_read
yield
line
[:
-
1
],
raw_bytes_read
def
read
(
self
):
def
read
(
self
):
with
open
(
self
.
file_path
,
"r"
,
encoding
=
"utf8"
)
as
fh
:
with
open
(
self
.
file_path
,
encoding
=
"utf8"
)
as
fh
:
with
mmap
.
mmap
(
fh
.
fileno
(),
length
=
0
,
access
=
mmap
.
ACCESS_READ
)
as
mmap_obj
:
with
mmap
.
mmap
(
fh
.
fileno
(),
length
=
0
,
access
=
mmap
.
ACCESS_READ
)
as
mmap_obj
:
for
line
in
iter
(
mmap_obj
.
readline
,
b
""
):
for
line
in
iter
(
mmap_obj
.
readline
,
b
""
):
line
=
line
.
decode
(
"utf-8"
)
line
=
line
.
decode
(
"utf-8"
)
yield
line
[:
-
1
]
yield
line
[:
-
1
]
def
read_slow
(
self
):
def
read_slow
(
self
):
with
open
(
self
.
file_path
,
"r"
,
encoding
=
"utf8"
)
as
fh
:
with
open
(
self
.
file_path
,
encoding
=
"utf8"
)
as
fh
:
while
True
:
while
True
:
line
=
fh
.
readline
()
line
=
fh
.
readline
()
if
line
==
-
1
or
line
==
""
:
if
line
==
-
1
or
line
==
""
:
...
...
pyproject.toml
View file @
7c853109
...
@@ -20,22 +20,16 @@ requires-python = ">=3.9"
...
@@ -20,22 +20,16 @@ requires-python = ">=3.9"
license
=
{
"text"
=
"MIT"
}
license
=
{
"text"
=
"MIT"
}
dependencies
=
[
dependencies
=
[
"accelerate>=0.26.0"
,
"accelerate>=0.26.0"
,
"evaluate"
,
"datasets>=2.16.0"
,
"datasets>=2.16.0"
,
"evaluate>=0.4.0"
,
"evaluate>=0.4.0"
,
"jsonlines"
,
"numexpr"
,
"peft>=0.2.0"
,
"peft>=0.2.0"
,
"pybind11>=2.6.2"
,
"pytablewriter"
,
"pytablewriter"
,
"rouge-score>=0.0.4"
,
"rouge-score>=0.0.4"
,
"sacrebleu>=1.5.0"
,
"sacrebleu>=1.5.0"
,
"scikit-learn>=0.24.1"
,
"scikit-learn>=0.24.1"
,
"sqlitedict"
,
"sqlitedict"
,
"torch>=1.8"
,
"torch>=1.8"
,
"tqdm-multiprocess"
,
"transformers>=4.1"
,
"transformers>=4.1"
,
"zstandard"
,
"dill"
,
"dill"
,
"word2number"
,
"word2number"
,
"more_itertools"
,
"more_itertools"
,
...
...
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