-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify typing, remove uses of the Algorithm class (#32)
* Rename `jax_algo.py` to `jax_example.py` Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Simplify Example algo, remove Algorithm as base Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Remove Algorithm base from Jax example algo Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Remove use of the `Algorithm` class in all algos Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Make `Algorithm` a protocol class Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Fix import bug with `Algorithm` class Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * fixup! Remove use of the `Algorithm` class in all algos * Fix bug in main_test.py Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Fix issue with config name for jax example Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Rename `example_algo.py` to `example.py` Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Move test classes to a new `testsuites` folder Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Remove `Algorithm` class use from `callback.py` Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Remove other references to `Algorithm` class Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Move `Algorithm` to the testsuites folder Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Rename Jax example, remove PhaseStr Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Remove the "manual optimization" example Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Clean up the configs for algorithms Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Create dyn. configs for optimizers and schedulers Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Fix a bug in hydra-zen for inner classes - Adds a patch for mit-ll-responsible-ai/hydra-zen#705 Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Fix the no_op algo constructor Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Fix the configs for algorithms Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Fix uses of the algorithm config name in tests Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Add tests for the optimizer & lr_scheduler configs Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Fix issues with dynamic configs Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Fix issue with `instantiate` in hydra_utils Signed-off-by: Fabrice Normandin <normandf@mila.quebec> * Fix issue with required args in configs Signed-off-by: Fabrice Normandin <normandf@mila.quebec> --------- Signed-off-by: Fabrice Normandin <normandf@mila.quebec>
- Loading branch information
Showing
35 changed files
with
848 additions
and
627 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,10 @@ | ||
from hydra_zen import builds, store | ||
|
||
from project.algorithms.jax_algo import JaxAlgorithm | ||
from project.algorithms.jax_example import JaxExample | ||
from project.algorithms.no_op import NoOp | ||
|
||
from .algorithm import Algorithm | ||
from .example_algo import ExampleAlgorithm | ||
from .manual_optimization_example import ManualGradientsExample | ||
|
||
# NOTE: This works the same way as creating config files for each algorithm under | ||
# `configs/algorithm`. From the command-line, you can select both configs that are yaml files as | ||
# well as structured config (dataclasses). | ||
|
||
# If you add a configuration file under `configs/algorithm`, it will also be available as an option | ||
# from the command-line, and be validated against the schema. | ||
# todo: It might be nicer if we did this this `configs/algorithms` instead of here, no? | ||
algorithm_store = store(group="algorithm") | ||
algorithm_store(ExampleAlgorithm.HParams(), name="example_algo") | ||
algorithm_store(ManualGradientsExample.HParams(), name="manual_optimization") | ||
algorithm_store(builds(NoOp, populate_full_signature=False), name="no_op") | ||
algorithm_store(JaxAlgorithm.HParams(), name="jax_algo") | ||
|
||
algorithm_store.add_to_hydra_store() | ||
from .example import ExampleAlgorithm | ||
|
||
__all__ = [ | ||
"Algorithm", | ||
"ExampleAlgorithm", | ||
"ManualGradientsExample", | ||
"JaxAlgorithm", | ||
"JaxExample", | ||
"NoOp", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.