update
This commit is contained in:
parent
6962418bb1
commit
20bcf01be7
@ -6,10 +6,6 @@ from datasets import load_dataset
|
|||||||
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Nastavenia
|
|
||||||
# -----------------------------
|
|
||||||
|
|
||||||
DATASET_NAME = "tatsu-lab/alpaca"
|
DATASET_NAME = "tatsu-lab/alpaca"
|
||||||
SPLIT = "train"
|
SPLIT = "train"
|
||||||
|
|
||||||
@ -41,10 +37,7 @@ def is_empty(value):
|
|||||||
|
|
||||||
|
|
||||||
def load_already_done(path):
|
def load_already_done(path):
|
||||||
"""
|
|
||||||
Ak skript spadne alebo ho zastavíš, vie pokračovať.
|
|
||||||
Načíta už preložené riadky.
|
|
||||||
"""
|
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@ -58,10 +51,7 @@ def load_already_done(path):
|
|||||||
|
|
||||||
|
|
||||||
def translate_batch(texts, tokenizer, model, device):
|
def translate_batch(texts, tokenizer, model, device):
|
||||||
"""
|
|
||||||
Preloží batch textov z angličtiny do slovenčiny.
|
|
||||||
Prázdne texty nechá prázdne.
|
|
||||||
"""
|
|
||||||
results = [""] * len(texts)
|
results = [""] * len(texts)
|
||||||
|
|
||||||
non_empty_indices = []
|
non_empty_indices = []
|
||||||
@ -108,7 +98,6 @@ def translate_batch(texts, tokenizer, model, device):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
# Main
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print("Loading dataset...")
|
print("Loading dataset...")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user