modlee.model_metafeatures module

class modlee.model_metafeatures.ImageClassificationModelMetafeatures(torch_model: Module, sample_input=None, *args, **kwargs)[source]

Bases: ImageModelMetafeatures

class modlee.model_metafeatures.ImageModelMetafeatures(torch_model: Module, sample_input=None, *args, **kwargs)[source]

Bases: ModelMetafeatures

get_output_shape()[source]
class modlee.model_metafeatures.ImageSegmentationModelMetafeatures(torch_model: Module, sample_input=None, *args, **kwargs)[source]

Bases: ImageModelMetafeatures

get_output_shape()[source]
class modlee.model_metafeatures.ModelMetafeatures(torch_model: Module, sample_input=None, *args, **kwargs)[source]

Bases: object

check_input_type(sample_input)[source]

Prints the type and shape of the sample_input and breaks for debugging.

static dataframe_lists_to_columns(df: DataFrame)[source]

Split dataframe columns that are lists to separate, indexed columns

Parameters:

df – _description_

static get_graph_dataframe(onnx_graph, *args, **kwargs)[source]

Parse the layers of the model, maybe as a dataframe? With columns of layer type, parameters, indices (position in graph) Can then calculate parameters e.g. counts, parameter ranges, etc This almost seems like a converter function

static get_layer_counts(df: DataFrame)[source]

Get the counts of each layer type in a dataframe

Parameters:

df – _description_

abstract get_output_shape()[source]
static get_parameter_statistics(df: DataFrame | Series)[source]

Get the statistics of a single-column dataframe or series

Parameters:

df – _description_

get_properties(*args, **kwargs)[source]
These are:
  • Layer counts

  • Layer parameter stats, e.g. min/max/mean conv sizes

  • Size

  • Input / output shapes

Reference the ModelMFE (metafeature extractor): https://github.com/modlee-ai/recommender/blob/a86eb715c0f8771bbcb20a624eb20bc6f07d6c2b/data_prep/model_mfe.py#L117 In that prior implementation, used the ONNX text representation, and regexes

class modlee.model_metafeatures.TabularClassificationModelMetafeatures(torch_model: Module, sample_input=None, *args, **kwargs)[source]

Bases: TabularModelMetafeatures

class modlee.model_metafeatures.TabularModelMetafeatures(torch_model: Module, sample_input=None, *args, **kwargs)[source]

Bases: ModelMetafeatures

class modlee.model_metafeatures.TimeseriesForecastingModelMetafeatures(torch_model: Module, sample_input=None, *args, **kwargs)[source]

Bases: TimeseriesModelMetafeatures

class modlee.model_metafeatures.TimeseriesModelMetafeatures(torch_model: Module, sample_input=None, *args, **kwargs)[source]

Bases: ModelMetafeatures