Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back out "Replace LR access with wrapper" #3857

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -2897,15 +2897,6 @@ def set_learning_rate(self, lr: float) -> None:
)
self._set_learning_rate(lr)

def get_learning_rate(self) -> float:
"""
Sets the learning rate.

Args:
lr (float): The learning rate value to set to
"""
return self.optimizer_args.learning_rate

@torch.jit.ignore
def update_hyper_parameters(self, params_dict: Dict[str, float]) -> None:
"""
9 changes: 0 additions & 9 deletions fbgemm_gpu/fbgemm_gpu/tbe/ssd/training.py
Original file line number Diff line number Diff line change
@@ -1820,15 +1820,6 @@ def set_learning_rate(self, lr: float) -> None:
"""
self._set_learning_rate(lr)

def get_learning_rate(self) -> float:
"""
Sets the learning rate.

Args:
lr (float): The learning rate value to set to
"""
return self.optimizer_args.learning_rate

@torch.jit.ignore
def _set_learning_rate(self, lr: float) -> float:
"""
Original file line number Diff line number Diff line change
@@ -190,7 +190,7 @@ def apply_gwd(
apply_gwd_per_table(
prev_iter_values,
weights_values,
emb.get_learning_rate(),
emb.optimizer_args.learning_rate,
emb.optimizer_args.weight_decay,
step,
emb.current_device,
4 changes: 3 additions & 1 deletion fbgemm_gpu/test/tbe/utils/split_embeddings_test.py
Original file line number Diff line number Diff line change
@@ -593,7 +593,9 @@ def test_update_hyper_parameters(self) -> None:
key: value + 1.0 for key, value in hyperparameters.items()
} | {"lr": 1.0, "lower_bound": 2.0}
cc.update_hyper_parameters(updated_parameters)
self.assertAlmostEqual(cc.get_learning_rate(), updated_parameters["lr"])
self.assertAlmostEqual(
cc.optimizer_args.learning_rate, updated_parameters["lr"]
)
self.assertAlmostEqual(cc.optimizer_args.eps, updated_parameters["eps"])
self.assertAlmostEqual(cc.optimizer_args.beta1, updated_parameters["beta1"])
self.assertAlmostEqual(cc.optimizer_args.beta2, updated_parameters["beta2"])