Spaces:
Running
Running
Print run info only in main process
Browse files- translate.py +17 -12
translate.py
CHANGED
@@ -100,18 +100,23 @@ def main(
|
|
100 |
}
|
101 |
|
102 |
total_lines: int = count_lines(sentences_path)
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
@find_executable_batch_size(starting_batch_size=starting_batch_size)
|
117 |
def inference(batch_size):
|
|
|
100 |
}
|
101 |
|
102 |
total_lines: int = count_lines(sentences_path)
|
103 |
+
|
104 |
+
if accelerator.is_main_process:
|
105 |
+
print(
|
106 |
+
f"** We will translate {total_lines} lines. **\n"
|
107 |
+
f"Input file: {sentences_path}\n"
|
108 |
+
f"Output file: {output_path}\n"
|
109 |
+
f"Source language: {source_lang}\n"
|
110 |
+
f"Target language: {target_lang}\n"
|
111 |
+
f"Starting batch size: {starting_batch_size}\n"
|
112 |
+
f"Device: {accelerator.device}\n"
|
113 |
+
f"Num. Devices: {accelerator.num_processes}\n"
|
114 |
+
f"Distributed_type: {accelerator.distributed_type}\n"
|
115 |
+
f"Max length: {max_length}\n"
|
116 |
+
f"Num beams: {num_beams}\n"
|
117 |
+
f"Precision: {model.dtype}\n"
|
118 |
+
f"Model: {model_name}\n"
|
119 |
+
)
|
120 |
|
121 |
@find_executable_batch_size(starting_batch_size=starting_batch_size)
|
122 |
def inference(batch_size):
|