-
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 <[email protected]> * Simplify Example algo, remove Algorithm as base Signed-off-by: Fabrice Normandin <[email protected]> * Remove Algorithm base from Jax example algo Signed-off-by: Fabrice Normandin <[email protected]> * Remove use of the `Algorithm` class in all algos Signed-off-by: Fabrice Normandin <[email protected]> * Make `Algorithm` a protocol class Signed-off-by: Fabrice Normandin <[email protected]> * Fix import bug with `Algorithm` class Signed-off-by: Fabrice Normandin <[email protected]> * fixup! Remove use of the `Algorithm` class in all algos * Fix bug in main_test.py Signed-off-by: Fabrice Normandin <[email protected]> * Fix issue with config name for jax example Signed-off-by: Fabrice Normandin <[email protected]> * Rename `example_algo.py` to `example.py` Signed-off-by: Fabrice Normandin <[email protected]> * Move test classes to a new `testsuites` folder Signed-off-by: Fabrice Normandin <[email protected]> * Remove `Algorithm` class use from `callback.py` Signed-off-by: Fabrice Normandin <[email protected]> * Remove other references to `Algorithm` class Signed-off-by: Fabrice Normandin <[email protected]> * Move `Algorithm` to the testsuites folder Signed-off-by: Fabrice Normandin <[email protected]> * Rename Jax example, remove PhaseStr Signed-off-by: Fabrice Normandin <[email protected]> * Remove the "manual optimization" example Signed-off-by: Fabrice Normandin <[email protected]> * Clean up the configs for algorithms Signed-off-by: Fabrice Normandin <[email protected]> * Create dyn. configs for optimizers and schedulers Signed-off-by: Fabrice Normandin <[email protected]> * 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 <[email protected]> * Fix the no_op algo constructor Signed-off-by: Fabrice Normandin <[email protected]> * Fix the configs for algorithms Signed-off-by: Fabrice Normandin <[email protected]> * Fix uses of the algorithm config name in tests Signed-off-by: Fabrice Normandin <[email protected]> * Add tests for the optimizer & lr_scheduler configs Signed-off-by: Fabrice Normandin <[email protected]> * Fix issues with dynamic configs Signed-off-by: Fabrice Normandin <[email protected]> * Fix issue with `instantiate` in hydra_utils Signed-off-by: Fabrice Normandin <[email protected]> * Fix issue with required args in configs Signed-off-by: Fabrice Normandin <[email protected]> --------- Signed-off-by: Fabrice Normandin <[email protected]>
- 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.