Skip to content

Commit 9787ff8

Browse files
committed
Apply yapf formatting
1 parent 9eb9a63 commit 9787ff8

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

joeynmt/prediction.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,14 @@ def predict(
5050
num_workers: int = 0,
5151
cfg: Dict = None,
5252
fp16: bool = False,
53-
) -> Tuple[Dict[str, float], List[str], List[str], List[List[str]], List[np.ndarray],
54-
List[np.ndarray], ]:
53+
) -> Tuple[
54+
Dict[str, float],
55+
List[str],
56+
List[str],
57+
List[List[str]],
58+
List[np.ndarray],
59+
List[np.ndarray],
60+
]:
5561
"""
5662
Generates translations for the given data.
5763
If `compute_loss` is True and references are given, also computes the loss.

joeynmt/tokenizers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,14 @@ def set_vocab(self, itos: List[str]) -> None:
309309
def copy_cfg_file(self, model_dir: Path) -> None:
310310
"""this does nothing at the moment, uncommenting the original leads to training error"""
311311
useless = "do nothing"
312+
312313
#def copy_cfg_file(self, model_dir: Path) -> None:
313314
# """Copy config file to model_dir"""
314315
# print(f"DEBUG: \n self.codes: \t{self.codes}\n \
315316
# self.codes.name:\t{self.codes.name}\nmodel_dir:\t{model_dir}\n \
316317
# the other thing:\t{(model_dir / self.codes.name).as_posix()}")
317318
# shutil.copy2(self.codes, (model_dir / self.codes.name).as_posix())
318319

319-
320320
def __repr__(self):
321321
return (f"{self.__class__.__name__}(level={self.level}, "
322322
f"lowercase={self.lowercase}, normalize={self.normalize}, "

joeynmt/training.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,9 @@ def _train_step(self, batch: Batch) -> Tensor:
578578
#with torch.autocast(device_type=self.device.type,
579579
# dtype=self.dtype,
580580
# enabled=self.fp16):
581-
# get loss (run as during training with teacher forcing)
582-
#batch_loss, _, _, correct_tokens = self.model(return_type="loss",
583-
# **vars(batch))
581+
# get loss (run as during training with teacher forcing)
582+
#batch_loss, _, _, correct_tokens = self.model(return_type="loss",
583+
# **vars(batch))
584584
batch_loss, _, _, correct_tokens = self.model(return_type="loss",
585585
**vars(batch))
586586

0 commit comments

Comments
 (0)