Editor Integration
EditorModelSpec
Section titled “EditorModelSpec”Defined in: griffith_logic.editor_models.EditorModelSpec (class)
class EditorModelSpec( id: str, name: str, task: str = 'classification', input_spec: Mapping[str, Any] = dict(), output_spec: Mapping[str, Any] = dict(), datasets: Sequence[str] = tuple(), training_presets: Mapping[str, Mapping[str, Any]] = dict(), capabilities: Mapping[str, bool] = dict(), stages: Sequence[Mapping[str, Any]] = tuple(), hierarchy: Sequence[Mapping[str, Any]] = tuple(), lowering: Mapping[str, Mapping[str, Any]] = dict(), paper_ref: Mapping[str, Any] | None = None, dataset_presets: Mapping[str, Mapping[str, Any]] = dict(), description: str | None = None, build: BuildFn | None = None,)Specification of a Python model exposed to the editor.
build is set automatically from the function/class decorated with @editor_model.
input_spec / output_spec are expected to be dicts containing either width
or shape. When only shape is given, the product of its elements is used as the width.
editor_model
Section titled “editor_model”Defined in: griffith_logic.editor_models.editor_model (function)
def editor_model( id: str, name: str, task: str = 'classification', input_spec: Mapping[str, Any] | None = None, output_spec: Mapping[str, Any] | None = None, datasets: Sequence[str] = (), training_presets: Mapping[str, Mapping[str, Any]] | None = None, capabilities: Mapping[str, bool] | None = None, stages: Sequence[Mapping[str, Any]] = (), hierarchy: Sequence[Mapping[str, Any]] = (), lowering: Mapping[str, Mapping[str, Any]] | None = None, paper_ref: Mapping[str, Any] | None = None, dataset_presets: Mapping[str, Mapping[str, Any]] | None = None, description: str | None = None,)Registers a function or class as a model builder for the editor.
Example: @editor_model(id=‘toy’, name=‘Toy’, input_spec={‘width’: 4}, …) def build_model(): return nn.Sequential(…)