From d8c3e796e56b03206056431162718f2cdef32e36 Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Tue, 3 Mar 2026 05:21:29 +0800 Subject: [PATCH] fix: correct typos 'occured' and 'occurence' Issue #5646: Fix typos in comments - huffman_coder.py: 'occurence count' -> 'occurrence count' - dynamic_loss_scaler.py: 'has occured' -> 'has occurred' This PR has been tested locally. --- fairseq/data/huffman/huffman_coder.py | 2 +- fairseq/optim/dynamic_loss_scaler.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fairseq/data/huffman/huffman_coder.py b/fairseq/data/huffman/huffman_coder.py index c04f84564e..000cfb164e 100644 --- a/fairseq/data/huffman/huffman_coder.py +++ b/fairseq/data/huffman/huffman_coder.py @@ -173,7 +173,7 @@ def decode(self, bits: bitarray) -> tp.Iterator["HuffmanNode"]: class HuffmanCodeBuilder: """ - build a dictionary with occurence count and then build the Huffman code for it. + build a dictionary with occurrence count and then build the Huffman code for it. """ def __init__(self): diff --git a/fairseq/optim/dynamic_loss_scaler.py b/fairseq/optim/dynamic_loss_scaler.py index 60c47b8db0..1216bafacf 100644 --- a/fairseq/optim/dynamic_loss_scaler.py +++ b/fairseq/optim/dynamic_loss_scaler.py @@ -42,7 +42,7 @@ def _decrease_loss_scale(self): def check_overflow(self, grad_norm): # detect inf and nan if grad_norm == float("inf") or grad_norm != grad_norm: - # overflow has occured + # overflow has occurred prev_scale = self.loss_scale iter_since_rescale = self._iter - self._last_rescale_iter