Skip to content

Commit 7987890

Browse files
authored
small fix for NMT build job (#119)
1 parent 88f5bad commit 7987890

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

machine/translation/huggingface/hugging_face_nmt_model_trainer.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ def __init__(
102102
self._add_unk_trg_tokens = add_unk_trg_tokens
103103
self._mpn = MosesPunctNormalizer()
104104
self._mpn.substitutions = [(re.compile(r), sub) for r, sub in self._mpn.substitutions]
105+
self._stats = TrainStats()
105106

106107
@property
107108
def stats(self) -> TrainStats:
108-
return super().stats
109+
return self._stats
109110

110111
def train(
111112
self,
@@ -366,6 +367,7 @@ def preprocess_function(examples):
366367

367368
self._metrics = train_result.metrics
368369
self._metrics["train_samples"] = len(train_dataset)
370+
self._stats.train_corpus_size = self._metrics["train_samples"]
369371

370372
self._trainer.log_metrics("train", self._metrics)
371373
logger.info("Model training finished")

0 commit comments

Comments
 (0)