"...text-generation-inference-dcu.git" did not exist on "366dfe8247b1978f9a1cd4aee5fcf91bde836372"
Commit 7c853109 authored by Baber's avatar Baber
Browse files

remove deps

parent 87445e95
# /// 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 == "":
......
...@@ -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",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment