heavyball 0.18.5__tar.gz → 0.18.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {heavyball-0.18.5 → heavyball-0.18.6}/PKG-INFO +2 -2
  2. {heavyball-0.18.5 → heavyball-0.18.6}/README.md +1 -1
  3. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/utils.py +12 -9
  4. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball.egg-info/PKG-INFO +2 -2
  5. {heavyball-0.18.5 → heavyball-0.18.6}/setup.py +1 -1
  6. {heavyball-0.18.5 → heavyball-0.18.6}/LICENSE +0 -0
  7. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/__init__.py +0 -0
  8. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/cached_delayed_psgd_kron.py +0 -0
  9. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/cached_psgd_kron.py +0 -0
  10. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/delayed_psgd.py +0 -0
  11. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/foreach_adamw.py +0 -0
  12. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/foreach_adopt.py +0 -0
  13. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/foreach_laprop.py +0 -0
  14. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/foreach_sfadamw.py +0 -0
  15. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/foreach_soap.py +0 -0
  16. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/p_adam.py +0 -0
  17. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/palm_foreach_sfadamw.py +0 -0
  18. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/palm_foreach_soap.py +0 -0
  19. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/precond_schedule_foreach_soap.py +0 -0
  20. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/precond_schedule_palm_foreach_soap.py +0 -0
  21. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/precond_schedule_sfpsoap.py +0 -0
  22. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/psgd_kron.py +0 -0
  23. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/pure_psgd.py +0 -0
  24. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball/schedule_free_palm_foreach_soap.py +0 -0
  25. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball.egg-info/SOURCES.txt +0 -0
  26. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball.egg-info/dependency_links.txt +0 -0
  27. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball.egg-info/requires.txt +0 -0
  28. {heavyball-0.18.5 → heavyball-0.18.6}/heavyball.egg-info/top_level.txt +0 -0
  29. {heavyball-0.18.5 → heavyball-0.18.6}/setup.cfg +0 -0
  30. {heavyball-0.18.5 → heavyball-0.18.6}/test/test_bf16_params.py +0 -0
  31. {heavyball-0.18.5 → heavyball-0.18.6}/test/test_bf16_q.py +0 -0
  32. {heavyball-0.18.5 → heavyball-0.18.6}/test/test_closure.py +0 -0
  33. {heavyball-0.18.5 → heavyball-0.18.6}/test/test_foreach.py +0 -0
  34. {heavyball-0.18.5 → heavyball-0.18.6}/test/test_memory.py +0 -0
  35. {heavyball-0.18.5 → heavyball-0.18.6}/test/test_merge.py +0 -0
  36. {heavyball-0.18.5 → heavyball-0.18.6}/test/test_no_grad.py +0 -0
  37. {heavyball-0.18.5 → heavyball-0.18.6}/test/test_psgd.py +0 -0
  38. {heavyball-0.18.5 → heavyball-0.18.6}/test/test_soap.py +0 -0
  39. {heavyball-0.18.5 → heavyball-0.18.6}/test/test_stochastic_updates.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: heavyball
3
- Version: 0.18.5
3
+ Version: 0.18.6
4
4
  Summary: Efficient optimizers
5
5
  Home-page: https://github.com/clashluke/heavyball
6
6
  Author: Lucas Nestler
@@ -32,7 +32,7 @@ A simple package of efficient optimizers
32
32
  The goal is not to thrive for completeness, full maintenance or abstraction, but instead to provide a simple
33
33
  largely static alternative to `torch.optim` with more and better optimizers.
34
34
 
35
- Currently (2024-11-20, 0.17.0), the recommended stable optimizer is `PrecondSchedulePaLMSOAP` (see below). The
35
+ Currently (2024-11-21, 0.18.6), the recommended stable optimizer is `PrecondSchedulePaLMSOAP` (see below). The
36
36
  recommended experimental optimizer is `DelayedPSGDKron` ([tuning guide](docs/psgd_efficiency.md)).
37
37
 
38
38
  ## Features
@@ -8,7 +8,7 @@ A simple package of efficient optimizers
8
8
  The goal is not to thrive for completeness, full maintenance or abstraction, but instead to provide a simple
9
9
  largely static alternative to `torch.optim` with more and better optimizers.
10
10
 
11
- Currently (2024-11-20, 0.17.0), the recommended stable optimizer is `PrecondSchedulePaLMSOAP` (see below). The
11
+ Currently (2024-11-21, 0.18.6), the recommended stable optimizer is `PrecondSchedulePaLMSOAP` (see below). The
12
12
  recommended experimental optimizer is `DelayedPSGDKron` ([tuning guide](docs/psgd_efficiency.md)).
13
13
 
14
14
  ## Features
@@ -44,10 +44,10 @@ def _compilable_schedule_free_(p, z, ckp1, grad, lr, beta1):
44
44
  z32 = z.float()
45
45
  p32.lerp_(end=z32, weight=1 - ckp1)
46
46
  p32.add_(grad, alpha=lr * (beta1 * (1 - ckp1) - 1))
47
- _compilable_copy_stochastic_(p, p32)
47
+ _guarded_copy_stochastic(p, p32)
48
48
 
49
49
  z32.add_(grad, alpha=-lr)
50
- _compilable_copy_stochastic_(z, z32)
50
+ _guarded_copy_stochastic(z, z32)
51
51
 
52
52
 
53
53
  def schedule_free_(lr: float, weight_lr_power: float, weight_sum: float, beta1: float, parameters: List[torch.Tensor],
@@ -157,11 +157,11 @@ def adaptive_gradient_clipping_(parameters: List[torch.Tensor], gradients: List[
157
157
 
158
158
 
159
159
  def set_(dst: torch.Tensor, src: torch.Tensor):
160
- if src.data_ptr() == dst.data_ptr():
160
+ if not torch.compiler.is_compiling() and src.data_ptr() == dst.data_ptr():
161
161
  return
162
162
  if src.shape != dst.shape:
163
163
  src = src.reshape_as(dst)
164
- if src.is_contiguous() and dst.is_contiguous() and src.dtype == dst.dtype:
164
+ if not torch.compiler.is_compiling() and src.is_contiguous() and dst.is_contiguous() and src.dtype == dst.dtype:
165
165
  dst.set_(src)
166
166
  else:
167
167
  dst.copy_(src)
@@ -486,6 +486,12 @@ def copy_stochastic_list_(target: List[torch.Tensor], source: List[torch.Tensor]
486
486
  copy_stochastic_(t, s)
487
487
 
488
488
 
489
+ def _guarded_copy_stochastic(target: torch.Tensor, source: torch.Tensor):
490
+ if target.dtype != torch.bfloat16 or source.dtype not in (torch.float16, torch.float32, torch.float64):
491
+ set_(target, source)
492
+ _compilable_copy_stochastic_(target, source)
493
+
494
+
489
495
  @torch.compile(mode='max-autotune-no-cudagraphs', fullgraph=True, dynamic=True)
490
496
  def _compilable_copy_stochastic_(target: torch.Tensor, source: torch.Tensor):
491
497
  """Taken as-is from https://github.com/pytorch/pytorch/issues/120376#issuecomment-1974828905"""
@@ -505,10 +511,7 @@ def _compilable_copy_stochastic_(target: torch.Tensor, source: torch.Tensor):
505
511
  def copy_stochastic_(target: torch.Tensor, source: torch.Tensor):
506
512
  if target.data_ptr() == source.data_ptr():
507
513
  return
508
- if target.dtype != torch.bfloat16 or source.dtype not in (torch.float16, torch.float32, torch.float64):
509
- set_(target, source)
510
- return
511
- _compilable_copy_stochastic_(target, source)
514
+ _guarded_copy_stochastic(target, source)
512
515
 
513
516
 
514
517
  @torch.compile(mode='max-autotune-no-cudagraphs', fullgraph=True, dynamic=True)
@@ -521,7 +524,7 @@ def _compilable_update_one_(p, u, decay, add_fn, lr):
521
524
  p32.add_(u32, alpha=lr)
522
525
  else:
523
526
  add_fn(p32, u32, lr)
524
- _compilable_copy_stochastic_(p, p32)
527
+ _guarded_copy_stochastic(p, p32)
525
528
 
526
529
 
527
530
  def update_param_(param: List[torch.Tensor], update: List[torch.Tensor], lr: float, decay: float,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: heavyball
3
- Version: 0.18.5
3
+ Version: 0.18.6
4
4
  Summary: Efficient optimizers
5
5
  Home-page: https://github.com/clashluke/heavyball
6
6
  Author: Lucas Nestler
@@ -32,7 +32,7 @@ A simple package of efficient optimizers
32
32
  The goal is not to thrive for completeness, full maintenance or abstraction, but instead to provide a simple
33
33
  largely static alternative to `torch.optim` with more and better optimizers.
34
34
 
35
- Currently (2024-11-20, 0.17.0), the recommended stable optimizer is `PrecondSchedulePaLMSOAP` (see below). The
35
+ Currently (2024-11-21, 0.18.6), the recommended stable optimizer is `PrecondSchedulePaLMSOAP` (see below). The
36
36
  recommended experimental optimizer is `DelayedPSGDKron` ([tuning guide](docs/psgd_efficiency.md)).
37
37
 
38
38
  ## Features
@@ -10,7 +10,7 @@ setuptools.setup(
10
10
  name='heavyball',
11
11
  license='BSD',
12
12
  description='Efficient optimizers',
13
- version='0.18.5',
13
+ version='0.18.6',
14
14
  long_description=README,
15
15
  url='https://github.com/clashluke/heavyball',
16
16
  packages=setuptools.find_packages(),
File without changes
File without changes
File without changes
File without changes