Skip to content

Commit

Permalink
Remove obsolete multiOptims_Langs
Browse files Browse the repository at this point in the history
  • Loading branch information
Waino committed May 27, 2024
1 parent a8a9cc9 commit 339960f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions mammoth/utils/optimizers.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
""" Optimizers class """
import functools
import importlib
import math
import torch
import torch.optim as optim
import types
from collections import Counter
from math import sqrt
from mammoth.utils.misc import fn_args
from torch.nn.utils import clip_grad_norm_
from mammoth.utils.logging import logger

Expand Down Expand Up @@ -170,11 +167,10 @@ def linear_warmup_decay(step, warmup_steps, rate, train_steps):


class MultipleOptimizer(object):
"""Implement multiple optimizers"""
"""Separate optimizers for each distributed component"""

def __init__(self, op, multiOptims_Langs=None):
def __init__(self, op):
self.optimizers = op
self.multiOptims_Langs = multiOptims_Langs
self._steps = Counter()

@property
Expand Down Expand Up @@ -212,7 +208,6 @@ def state_dict(self):
"""Returns the state dictionary"""
return {
'optimizers': {k: v.state_dict() for k, v in self.optimizers.items()},
'multiOptims_Langs': self.multiOptims_Langs,
'steps': self._steps,
}

Expand All @@ -231,7 +226,6 @@ def load_state_dict(self, state_dict):
else:
logger.info("Some components do not match. Do not load optimizer from checkpoint.")

self.multiOptims_Langs = state_dict["multiOptims_Langs"]
self._steps = state_dict["steps"]


Expand Down

0 comments on commit 339960f

Please sign in to comment.