Skip to content

Commit e46ab2f

Browse files
committed
added formatting checks, license, etc
Signed-off-by: mikail <mkhona@nvidia.com>
1 parent ce51198 commit e46ab2f

15 files changed

Lines changed: 55 additions & 43 deletions

emerging_optimizers/scalar_optimizers/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
from .adam import calculate_adam_update
16-
from .ademamix import calculate_sim_ademamix_update, calculate_ademamix_update
17-
from .signum import calculate_signum_update
16+
from .ademamix import calculate_ademamix_update, calculate_sim_ademamix_update
1817
from .laprop import calculate_laprop_update
1918
from .lion import calculate_lion_update
19+
from .signum import calculate_signum_update
20+
2021

2122
__all__ = [
2223
"calculate_adam_update",

emerging_optimizers/scalar_optimizers/adam.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
import torch
1615
from typing import Tuple
1716

17+
import torch
18+
19+
1820
__all__ = [
1921
"calculate_adam_update",
2022
]

emerging_optimizers/scalar_optimizers/ademamix.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
import torch
16-
from typing import Tuple, Optional
1715
import math
16+
from typing import Optional, Tuple
17+
18+
import torch
19+
1820

1921
__all__ = [
2022
"calculate_sim_ademamix_update",

emerging_optimizers/scalar_optimizers/laprop.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
import torch
1615
from typing import Tuple
1716

17+
import torch
18+
1819

1920
__all__ = [
2021
"calculate_laprop_update",

emerging_optimizers/scalar_optimizers/lion.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
import torch
1615
from typing import Optional
1716

17+
import torch
18+
19+
1820
__all__ = [
1921
"calculate_lion_update",
2022
]

emerging_optimizers/scalar_optimizers/signum.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# limitations under the License.
1515
import torch
1616

17+
1718
__all__ = [
1819
"calculate_signum_update",
1920
]
@@ -34,7 +35,7 @@ def calculate_signum_update(
3435
3536
This function performs the computation of 1 step of sign-SGD or Signum.
3637
Based on https://arxiv.org/abs/1802.04434.
37-
When using signSGD with shape scaling, general recommendation is to
38+
When using signSGD with shape scaling, general recommendation is to
3839
scale :math:`lr = \\text{adam lr} \\cdot \\text{network width} \\cdot \\frac{2}{\\text{rows} + \\text{cols}}`.
3940
This is for learning rate transfer with width scaling (https://arxiv.org/abs/2506.07254v1).
4041

emerging_optimizers/soap/soap.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,19 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
from itertools import chain
16-
from typing import Iterable, Callable, Tuple, List, Optional, Union, override
16+
from typing import Callable, Iterable, List, Optional, Tuple, Union, override
1717

1818
import torch
1919
import torch.optim as optim
20-
2120
from absl import logging
2221

22+
from emerging_optimizers import utils
23+
from emerging_optimizers.scalar_optimizers import calculate_adam_update
2324
from emerging_optimizers.soap.soap_utils import (
2425
get_eigenbasis_eigh,
2526
get_eigenbasis_qr,
2627
)
2728

28-
from emerging_optimizers import utils
29-
from emerging_optimizers.scalar_optimizers import calculate_adam_update
3029

3130
__all__ = [
3231
"SOAP",
@@ -104,11 +103,10 @@ def __init__(
104103
power_iter_steps: int = 1,
105104
max_update_rms: float = 0.0,
106105
) -> None:
107-
108106
# Check for betas.
109107
if betas is None:
110108
betas = (0.95, 0.95)
111-
logging.debug("betas not provided. Setting betas equal to " f"betas = {betas} by default.")
109+
logging.debug(f"betas not provided. Setting betas equal to betas = {betas} by default.")
112110

113111
# Check for update criteria
114112
if use_adaptive_criteria:

emerging_optimizers/soap/soap_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
from typing import List, Optional, Tuple
16+
1617
import torch
1718

1819
from emerging_optimizers import utils
1920

21+
2022
__all__ = [
2123
"get_eigenbasis_eigh",
2224
"get_eigenbasis_qr",

emerging_optimizers/utils/eig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
from absl import logging
1615
from typing import Optional
1716

1817
import torch
18+
from absl import logging
1919
from torch import Tensor
2020

2121
from emerging_optimizers import utils
2222

23+
2324
__all__ = ["eigh_with_fallback", "eig_orthogonal_iteration", "adaptive_early_exit_criteria"]
2425

2526

emerging_optimizers/utils/precondition_schedules.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from abc import ABC, abstractmethod
1717
from typing import Dict
1818

19+
1920
__all__ = [
2021
"LinearSchedule",
2122
"CosineSchedule",

0 commit comments

Comments
 (0)