Anvil Workflows
Workflow implementations for Anvil models.
- class openadmet.models.anvil.workflow.AnvilDeepLearningWorkflow(*, metadata: ~openadmet.models.anvil.specification.Metadata, data_spec: ~openadmet.models.anvil.specification.DataSpec, transform: ~openadmet.models.transforms.transform_base.TransformBase | None = None, split: ~openadmet.models.split.split_base.SplitterBase, feat: ~openadmet.models.features.feature_base.FeaturizerBase, model: ~openadmet.models.architecture.model_base.ModelBase, ensemble: ~openadmet.models.active_learning.ensemble_base.EnsembleBase | None = None, trainer: ~openadmet.models.trainer.trainer_base.TrainerBase, evals: list[openadmet.models.eval.eval_base.EvalBase], model_kwargs: dict = <factory>, ensemble_kwargs: dict = <factory>, debug: bool = False, resolved_output_dir: ~pathlib._local.Path | None = None)[source]
Bases:
AnvilWorkflowBaseWorkflow for running deep learning Anvil configuration.
- check_finetuning_paths()[source]
Check that finetuning path pairs are consistent and exist on disk.
Both
param_pathandserial_pathmust be provided together (or neither). When both are provided, both paths must exist before training begins. The same requirement applies toparam_paths/serial_pathsfor ensemble workflows, which must additionally be equal-length lists.- Raises:
ValueError – If exactly one of the path pair is provided, if provided paths do not exist on disk, or if ensemble path lists have unequal length.
- check_if_val_needed()[source]
Check if validation set is needed or not.
- Raises:
ValueError – If ensemble is specified but no validation set is requested.
- check_no_transform()[source]
Check that no transform step is specified.
- Raises:
ValueError – If a transform step is specified in the recipe.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Args:
self: The BaseModel instance. context: The context.
- run(output_dir: PathLike = 'anvil_training', debug: bool = False, tag: str = None) Any[source]
Run the workflow.
- Parameters:
output_dir (PathLike, optional) – Directory to save outputs, by default “anvil_training”
debug (bool, optional) – Whether to run in debug mode, by default False
tag (str, optional) – Tag to override the one in the recipe, by default None
- Returns:
Result of the workflow run
- Return type:
Any
- class openadmet.models.anvil.workflow.AnvilWorkflow(*, metadata: ~openadmet.models.anvil.specification.Metadata, data_spec: ~openadmet.models.anvil.specification.DataSpec, transform: ~openadmet.models.transforms.transform_base.TransformBase | None = None, split: ~openadmet.models.split.split_base.SplitterBase, feat: ~openadmet.models.features.feature_base.FeaturizerBase, model: ~openadmet.models.architecture.model_base.ModelBase, ensemble: ~openadmet.models.active_learning.ensemble_base.EnsembleBase | None = None, trainer: ~openadmet.models.trainer.trainer_base.TrainerBase, evals: list[openadmet.models.eval.eval_base.EvalBase], model_kwargs: dict = <factory>, ensemble_kwargs: dict = <factory>, debug: bool = False, resolved_output_dir: ~pathlib._local.Path | None = None)[source]
Bases:
AnvilWorkflowBaseWorkflow for running basic Anvil configuration.
- check_if_val_needed()[source]
Check if validation set is needed or not.
- Raises:
ValueError – If ensemble is specified but no validation set is requested.
ValueError – If validation set is requested but no ensemble is specified.
- check_no_finetuning()[source]
Check that no fine-tuning paths are specified.
- Raises:
ValueError – If fine-tuning paths are specified for either ensemble or single model.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Args:
self: The BaseModel instance. context: The context.
- run(output_dir: PathLike = 'anvil_training', debug: bool = False, tag: str = None) Any[source]
Run the workflow.
- Parameters:
output_dir (PathLike, optional) – Directory to save outputs, by default “anvil_training”
debug (bool, optional) – Whether to run in debug mode, by default False
tag (str, optional) – Tag to override the one in the recipe, by default None
- Returns:
Result of the workflow run
- Return type:
Any