Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions dion/dion2.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def __init__(
epsilon: float = 1e-8,
adjust_lr: Optional[str] = "spectral_norm",
flatten: bool = False,
use_gram_newton_schulz: bool = False,
use_triton: bool = False,
use_polar_express: bool = False,
use_polar_express: bool = True,
use_gram_newton_schulz: bool = True,
newton_schulz_func: Optional[Callable] = None,
verbose: bool = False,
):
Expand Down
13 changes: 10 additions & 3 deletions dion/megabatch_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def __init__(
distributed_mesh: Optional[Union[DeviceMesh, ProcessGroup]],
algo_name: str,
defaults: dict,
use_gram_newton_schulz: bool = False,
use_gram_newton_schulz: bool = True,
use_triton: bool = False,
use_polar_express: bool = False,
use_polar_express: bool = True,
newton_schulz_func: Optional[Callable] = None,
):
super().__init__(params, defaults)
Expand Down Expand Up @@ -75,7 +75,14 @@ def __init__(
)
self._newton_schulz_func = newton_schulz_func
elif use_gram_newton_schulz:
from gram_newton_schulz import GramNewtonSchulz
try:
from gram_newton_schulz import GramNewtonSchulz
except ImportError:
raise ImportError(
"use_gram_newton_schulz=True requires the 'gram-newton-schulz' package, "
"which is not installed. "
"Install it with: pip install gram-newton-schulz"
)
use_polar_express = True
_gns = GramNewtonSchulz(
ns_use_kernels=use_triton,
Expand Down
4 changes: 2 additions & 2 deletions dion/muon.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def __init__(
nesterov: bool = False,
adjust_lr: Optional[str] = "spectral_norm",
flatten: bool = False,
use_gram_newton_schulz: bool = False,
use_gram_newton_schulz: bool = True,
use_triton: bool = False,
use_polar_express: bool = False,
use_polar_express: bool = True,
newton_schulz_func: Optional[Callable] = None,
):
if lr < 0.0:
Expand Down
6 changes: 3 additions & 3 deletions dion/normuon.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def __init__(
cautious_wd: bool = False,
epsilon: float = 1e-8,
nesterov: bool = False,
adjust_lr: Optional[str] = "rms_norm",
adjust_lr: Optional[str] = "spectral_norm",
flatten: bool = False,
use_gram_newton_schulz: bool = False,
use_gram_newton_schulz: bool = True,
use_triton: bool = False,
use_polar_express: bool = False,
use_polar_express: bool = True,
newton_schulz_func: Optional[Callable] = None,
):
if lr < 0.0:
Expand Down