Petridish#

Evaluater#

archai.supergraph.algos.petridish.evaluater_petridish.filepath_ext(filepath: str) str[source]#

Returns ‘.f’ for ‘/a/b/c/d.e.f’

archai.supergraph.algos.petridish.evaluater_petridish.filepath_name_only(filepath: str) str[source]#

Returns ‘d.e’ for ‘/a/b/c/d.e.f’

archai.supergraph.algos.petridish.evaluater_petridish.append_to_filename(filepath: str, name_suffix: str, new_ext: str | None = None) str[source]#

Returns ‘/a/b/c/h.f’ for filepath=’/a/b/c/d.e.f’, new_name=’h’

class archai.supergraph.algos.petridish.evaluater_petridish.EvaluaterPetridish[source]#
evaluate(conf_eval: Config, model_desc_builder: ModelDescBuilder) EvalResult[source]#

Takes a folder of model descriptions output by search process and trains them in a distributed manner using ray with 1 gpu

Experiment Runner#

archai.supergraph.algos.petridish.petridish_exp_runner.copy_dir(src_dir: str, dest_dir: str, use_shutil: bool = True) None[source]#
class archai.supergraph.algos.petridish.petridish_exp_runner.PetridishExperimentRunner(config_filename: str, base_name: str, clean_expdir=False)[source]#
model_desc_builder() PetridishModelBuilder[source]#
trainer_class() Type[ArchTrainer] | None[source]#
searcher() SearcherPetridish[source]#
evaluater() EvaluaterPetridish[source]#
copy_search_to_eval() None[source]#

Model Description Builder#

class archai.supergraph.algos.petridish.petridish_model_desc_builder.PetridishModelBuilder[source]#
pre_build(conf_model_desc: Config) None[source]#

hook for accomplishing any setup before build starts

Operators#

class archai.supergraph.algos.petridish.petridish_op.StopForward[source]#
forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool#
class archai.supergraph.algos.petridish.petridish_op.StopGradient[source]#
forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool#
class archai.supergraph.algos.petridish.petridish_op.StopForwardReductionOp(op_desc: OpDesc, affine: bool)[source]#
forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool#
class archai.supergraph.algos.petridish.petridish_op.StopGradientReduction(op_desc: OpDesc, affine: bool)[source]#
forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool#
class archai.supergraph.algos.petridish.petridish_op.TempIdentityOp(op_desc)[source]#
forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool#
class archai.supergraph.algos.petridish.petridish_op.PetridishOp(op_desc: OpDesc, arch_params: ArchParams | None, reduction: bool, affine: bool)[source]#
PRIMITIVES = ['max_pool_3x3', 'avg_pool_3x3', 'skip_connect', 'sep_conv_3x3', 'sep_conv_5x5', 'dil_conv_3x3', 'dil_conv_5x5', 'none']#
forward(x: List[Tensor])[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

finalize() Tuple[OpDesc, float | None][source]#

for trainable op, return final op and its rank

ops() Iterator[Tuple[Op, float]][source]#

Return contituent ops, if this op is primitive just return self

training: bool#

Utilities#

class archai.supergraph.algos.petridish.petridish_utils.JobStage(value)[source]#

An enumeration.

SEED = 1#
SEED_TRAINED = 2#
SEARCH = 3#
SEARCH_TRAINED = 4#
EVAL = 5#
EVAL_TRAINED = 6#
class archai.supergraph.algos.petridish.petridish_utils.ExperimentStage(value)[source]#

An enumeration.

SEARCH = 1#
EVAL = 2#
class archai.supergraph.algos.petridish.petridish_utils.ConvexHullPoint(job_stage: JobStage, parent_id: int, sampling_count: int, model_desc: ModelDesc, cells_reductions_nodes: Tuple[int, int, int], metrics: Metrics | None = None, model_stats: ModelStats | None = None)[source]#
is_trained_stage() bool[source]#
next_stage() JobStage[source]#
archai.supergraph.algos.petridish.petridish_utils.model_descs_on_front(hull_points: List[ConvexHullPoint], convex_hull_eps: float, stage: ExperimentStage, lower_hull: bool = True) Tuple[List[ConvexHullPoint], List[ConvexHullPoint], List[float], List[float]][source]#
archai.supergraph.algos.petridish.petridish_utils.hull_points2tsv(points: List[ConvexHullPoint]) str[source]#
archai.supergraph.algos.petridish.petridish_utils.sample_from_hull(hull_points: List[ConvexHullPoint], convex_hull_eps: float, stage: ExperimentStage = ExperimentStage.SEARCH) ConvexHullPoint[source]#
archai.supergraph.algos.petridish.petridish_utils.get_top1_for_stage(hull_points: List[ConvexHullPoint], stage: ExperimentStage) List[float][source]#

Return top1 accuracy according to the experiment stage (SEARCH or EVAL)

archai.supergraph.algos.petridish.petridish_utils.plot_frontier(hull_points: List[ConvexHullPoint], convex_hull_eps: float, expdir: str, stage: ExperimentStage = ExperimentStage.SEARCH) None[source]#
archai.supergraph.algos.petridish.petridish_utils.plot_pool(hull_points: List[ConvexHullPoint], expdir: str, stage: ExperimentStage = ExperimentStage.SEARCH) None[source]#
archai.supergraph.algos.petridish.petridish_utils.plot_seed_model_stats(seed_model_stats: List[ModelStats], expdir: str) None[source]#
archai.supergraph.algos.petridish.petridish_utils.save_hull_frontier(hull_points: List[ConvexHullPoint], convex_hull_eps: float, final_desc_foldername: str, expdir: str, stage: ExperimentStage = ExperimentStage.SEARCH) ConvexHullPoint[source]#
archai.supergraph.algos.petridish.petridish_utils.save_hull(hull_points: List[ConvexHullPoint], expdir: str) None[source]#

Searcher#

class archai.supergraph.algos.petridish.searcher_petridish.SearcherPetridish[source]#
search(conf_search: Config, model_desc_builder: ModelDescBuilder, trainer_class: Type[ArchTrainer] | None, finalizers: Finalizers) SearchResult[source]#
search_model_desc_dist = <ray.remote_function.RemoteFunction object>#
train_model_desc_dist = <ray.remote_function.RemoteFunction object>#
build_model_desc(model_desc_builder: ModelDescBuilder, conf_model_desc: Config, reductions: int, cells: int, nodes: int) ModelDesc[source]#