opensubtitles-da-sv / src /push_to_hub.py
kardosdrur's picture
Added source code
3314ed6
raw
history blame contribute delete
573 Bytes
import json
from functools import partial
from typing import Iterable
from datasets import Dataset
def generate_from_jsonl(path: str) -> Iterable[dict]:
with open(path) as in_file:
for line in in_file:
entry = json.loads(line.strip())
yield entry
def main():
dataset = Dataset.from_generator(
partial(generate_from_jsonl, "aligned_filtered.jsonl")
)
dataset = dataset.train_test_split(test_size=0.2, shuffle=True)
dataset.push_to_hub("kardosdrur/opensubtitles-da-sv")
if __name__ == "__main__":
main()