Spaces:
Running
Running
Print in standard format
Browse files- translate.py +2 -6
translate.py
CHANGED
@@ -138,7 +138,6 @@ def main(
|
|
138 |
total=total_lines, desc="Dataset translation", leave=True, ascii=True
|
139 |
) as pbar, open(output_path, "w", encoding="utf-8") as output_file:
|
140 |
with torch.no_grad():
|
141 |
-
first_batch = True
|
142 |
for batch in data_loader:
|
143 |
batch["input_ids"] = batch["input_ids"]
|
144 |
batch["attention_mask"] = batch["attention_mask"]
|
@@ -158,11 +157,8 @@ def main(
|
|
158 |
tgt_text = tokenizer.batch_decode(
|
159 |
generated_tokens, skip_special_tokens=True
|
160 |
)
|
161 |
-
|
162 |
-
|
163 |
-
else:
|
164 |
-
first_batch = False
|
165 |
-
print("\n".join(tgt_text), file=output_file, end="")
|
166 |
|
167 |
pbar.update(len(tgt_text))
|
168 |
|
|
|
138 |
total=total_lines, desc="Dataset translation", leave=True, ascii=True
|
139 |
) as pbar, open(output_path, "w", encoding="utf-8") as output_file:
|
140 |
with torch.no_grad():
|
|
|
141 |
for batch in data_loader:
|
142 |
batch["input_ids"] = batch["input_ids"]
|
143 |
batch["attention_mask"] = batch["attention_mask"]
|
|
|
157 |
tgt_text = tokenizer.batch_decode(
|
158 |
generated_tokens, skip_special_tokens=True
|
159 |
)
|
160 |
+
|
161 |
+
print("\n".join(tgt_text), file=output_file)
|
|
|
|
|
|
|
162 |
|
163 |
pbar.update(len(tgt_text))
|
164 |
|