cneuromax¶
cneuromax
package.
Execution¶
python -m cneuromax project=PROJECT_NAME task=TASK_NAME
.
Terminology¶
1. Quck definitions¶
subtask
: Sub-work unit of a task
(ex: a model training run
with a specific set of hyper-parameters).
task
: Some work unit specified by a Hydra
.yaml
or a hydra-zen Python config that
specifies its execution (ex: the training of the same type of model
with various hyper-parameters).
project
: A collection of tasks
+ cross-task
functionality (ex: a custom
lightning.pytorch.core.LightningDataModule
)
service
: Contains cross-project
functionality (ex: base
Lightning sub-classes).
interface
: Contains cross-service
functionality (ex:
Hydra base configs).
2. Interface¶
a. Interface overview¶
An interface
refers to a Python package located at
cneuromax/INTERFACE_PATH/
.
Note
Interfaces can be nested, ex: cneuromax.serving
.
b. Example interfaces¶
Root interface: cneuromax
(source folder)
Fitting: cneuromax.fitting
(source folder)
c. Creating a new interface¶
To create INTERFACE_NAME
at path
cneuromax/.../PARENT_INTERFACE_NAME/INTERFACE_NAME
, create a class
to inherit from the BaseTaskRunner
class/sub-class implemented
by PARENT_INTERFACE_NAME
(ex:
cneuromax.fitting.runner.FittingTaskRunner
).
3. Service¶
a. Service overview¶
A service
refers to a Python package located at
cneuromax/INTERFACE_PATH/SERVICE_NAME/
.
b. Example services¶
Deep Learning: cneuromax.fitting.deeplearning
(source folder)
Neuroevolution: cneuromax.fitting.neuroevolution
(source folder)
Model serving (in progress): cneuromax.serving
(source folder)
c. Creating a new service¶
To create SERVICE_NAME
at path
cneuromax/.../INTERFACE_LATEST_NAME/SERVICE_NAME
, create a class
to inherit from the BaseTaskRunner
class/sub-class implemented
by INTERFACE_LATEST_NAME
and implement as little as
BaseTaskRunner.run_subtask()
(ex:
cneuromax.fitting.deeplearning.runner.DeepLearningTaskRunner
).
4. Project¶
a. Project overview¶
A project
refers to a Python package located at
cneuromax/projects/PROJECT_NAME/
.
b. Example projects¶
MNIST classification: cneuromax.projects.classify_mnist
(source
folder)
Control tasks neuroevolution: cneuromax.projects.control_nevo
(source folder)
c. Creating a new project¶
To create PROJECT_NAME
at path
cneuromax/projects/PROJECT_NAME/
, create a class to inherit from
the BaseTaskRunner
class/sub-class implemented by the
service
or other project
of your choice (ex:
cneuromax.fitting.deeplearning.runner.DeepLearningTaskRunner
).
You probabaly will want to override
store_configs()
.
For succinctness (will reduce your command length), we suggest writing
the above class in the __init__.py
file of your project
.
5. Task¶
a. Task overview¶
A task
is a work unit specified by a Hydra
configuration .yaml
file located in
cneuromax/projects/PROJECT_NAME/task/TASK_NAME.yaml
or a
hydra-zen Python config implemented in your
overwritten BaseTaskRunner.store_configs()
.
b. Example tasks¶
MLP MNIST classification: cneuromax/projects/classify_mnist/task/mlp.yaml
(source file)
Acrobot neuroevolution: Check out the contents of
cneuromax.projects.control_nevo.TaskRunner.store_configs()
.
c. Creating a new task¶
Create TASK_NAME.yaml
at path
cneuromax/projects/PROJECT_NAME/task/TASK_NAME.yaml
and include
# @package _global_
at the top of the file (as shown
in the first above example). Otherwise, you can create a
hydra-zen Python config that specifies its
execution (as shown in the second above example).
__main__.py¶
from cneuromax.runner import BaseTaskRunner
from cneuromax.utils.runner import get_task_runner_class
from cneuromax.utils.wandb import login_wandb
if __name__ == "__main__":
TaskRunner: type[BaseTaskRunner] = get_task_runner_class()
login_wandb()
TaskRunner.store_configs_and_run_task()
Submodules
Model fitting. |
|
Project repository. |
|
Model serving. |
|
Model testing/analytics. |
|
|