Skip to content
Prev Previous commit
Next Next commit
Clean up comments related to Transformers v5
  • Loading branch information
kashif authored Dec 5, 2025
commit c5ef52796dd1366b62b717b663a8ad4ad5b0c859
8 changes: 0 additions & 8 deletions src/chronos/chronos_bolt.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@

logger = logging.getLogger(__file__)

# Transformers v5 introduced breaking changes:
# - T5Stack.__init__ no longer accepts embed_tokens argument
# - _tied_weights_keys changed from list to dict format
# - _init_weights needs guarded init functions to avoid re-initializing loaded weights
_TRANSFORMERS_V5 = version.parse(transformers_version) >= version.parse("5.0.0.dev0")

# In transformers v5, use guarded init functions that check _is_hf_initialized
Expand Down Expand Up @@ -252,10 +248,6 @@ def __init__(self, config: T5Config):

def _init_weights(self, module):
"""Initialize the weights.

Uses transformers.initialization functions which are guarded against
re-initializing weights that have already been loaded from checkpoint
(they check the _is_hf_initialized flag on each parameter).
"""
factor = self.config.initializer_factor
if isinstance(module, (self.__class__)):
Expand Down