Commit ·
bf19c4f
1
Parent(s): 127e3fd
removing all prompt stuff from reader
Browse files
debug.py
CHANGED
|
@@ -6,8 +6,8 @@ def main():
|
|
| 6 |
# dataset = load_dataset("tau/fs",name="summ_screen_fd", max_source_length=512, tokenizer=tokenizer, prompt="Summary:")
|
| 7 |
ssfd_debug = load_dataset("/Users/yuvalkirstain/repos/fs", name="summ_screen_fd_debug", max_source_length=512,
|
| 8 |
tokenizer=tokenizer)
|
| 9 |
-
arxiv_debug = load_dataset("/Users/yuvalkirstain/repos/fs", name="arxiv_debug", max_source_length=512,
|
| 10 |
-
|
| 11 |
|
| 12 |
|
| 13 |
if __name__ == '__main__':
|
|
|
|
| 6 |
# dataset = load_dataset("tau/fs",name="summ_screen_fd", max_source_length=512, tokenizer=tokenizer, prompt="Summary:")
|
| 7 |
ssfd_debug = load_dataset("/Users/yuvalkirstain/repos/fs", name="summ_screen_fd_debug", max_source_length=512,
|
| 8 |
tokenizer=tokenizer)
|
| 9 |
+
# arxiv_debug = load_dataset("/Users/yuvalkirstain/repos/fs", name="arxiv_debug", max_source_length=512,
|
| 10 |
+
# tokenizer=tokenizer, prompt="Summarize the above:")
|
| 11 |
|
| 12 |
|
| 13 |
if __name__ == '__main__':
|
fs.py
CHANGED
|
@@ -32,7 +32,7 @@ class FSConfig(datasets.BuilderConfig):
|
|
| 32 |
**kwargs: keyword arguments forwarded to super.
|
| 33 |
"""
|
| 34 |
super(FSConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
|
| 35 |
-
self.features = ["pid", self.source_key, self.
|
| 36 |
self.data_url = data_url
|
| 37 |
self.citation = citation
|
| 38 |
self.url = url
|
|
@@ -89,18 +89,9 @@ class FSConfig(datasets.BuilderConfig):
|
|
| 89 |
def redundant_fields(self):
|
| 90 |
return []
|
| 91 |
|
| 92 |
-
def
|
| 93 |
example[self.source_key] = example[self.original_source_key].strip()
|
| 94 |
-
example[self.target_key] = example[self.original_target_key].strip()
|
| 95 |
-
|
| 96 |
-
def prompt(self, example):
|
| 97 |
-
pass # TODO
|
| 98 |
-
# prompt = get_prompt(self.dataset_name,
|
| 99 |
-
# self.template_name)
|
| 100 |
-
# row = prompt.apply(row)
|
| 101 |
-
|
| 102 |
-
def postprocess(self, example): # TODO truncate source
|
| 103 |
-
pass
|
| 104 |
|
| 105 |
|
| 106 |
class ScrollsConfig(FSConfig):
|
|
@@ -262,9 +253,7 @@ class Fs(datasets.GeneratorBasedBuilder):
|
|
| 262 |
row = json.loads(line)
|
| 263 |
|
| 264 |
row["pid"] = row[self.config.id_key]
|
| 265 |
-
self.config.
|
| 266 |
-
self.config.prompt(row)
|
| 267 |
-
self.config.postprocess(row)
|
| 268 |
self.config.remove_redundant_fields(row)
|
| 269 |
yield row["pid"], row
|
| 270 |
|
|
|
|
| 32 |
**kwargs: keyword arguments forwarded to super.
|
| 33 |
"""
|
| 34 |
super(FSConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
|
| 35 |
+
self.features = ["pid", self.source_key, self.target_key]
|
| 36 |
self.data_url = data_url
|
| 37 |
self.citation = citation
|
| 38 |
self.url = url
|
|
|
|
| 89 |
def redundant_fields(self):
|
| 90 |
return []
|
| 91 |
|
| 92 |
+
def process(self, example): # TODO perhaps we can use this for base
|
| 93 |
example[self.source_key] = example[self.original_source_key].strip()
|
| 94 |
+
example[self.target_key] = example[self.original_target_key].strip() if example[self.original_target_key] else None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
|
| 97 |
class ScrollsConfig(FSConfig):
|
|
|
|
| 253 |
row = json.loads(line)
|
| 254 |
|
| 255 |
row["pid"] = row[self.config.id_key]
|
| 256 |
+
self.config.process(row)
|
|
|
|
|
|
|
| 257 |
self.config.remove_redundant_fields(row)
|
| 258 |
yield row["pid"], row
|
| 259 |
|