deeppavlov.core.common¶
Registration and classes initialization functionality, class method decorators.
-
class
deeppavlov.core.common.chainer.
Chainer
(in_x: Union[str, list] = None, out_params: Union[str, list] = None, in_y: Union[str, list] = None, *args, **kwargs)[source]¶ Builds a component pipeline from heterogeneous components (Rule-based/ML/DL). It allows to train and infer models in a pipeline as a whole.
-
pipe
¶ list of components and their input and output variable names for inference
-
train_pipe
¶ list of components and their input and output variable names for training and evaluation
-
in_x
¶ names of inputs for pipeline inference mode
-
out_params
¶ names of pipeline inference outputs
-
in_y
¶ names of additional inputs for pipeline training and evaluation modes
-
forward_map
¶ list of all variables in chainer’s memory after running every component in
self.pipe
-
train_map
¶ list of all variables in chainer’s memory after running every component in
train_pipe.pipe
-
main
¶ reference to the main component
- Parameters
in_x – names of inputs for pipeline inference mode
out_params – names of pipeline inference outputs
in_y – names of additional inputs for pipeline training and evaluation modes
-
batched_call
(*args: Reversible, batch_size: int = 16) → Union[list, Tuple[list, …]][source]¶ Partitions data into mini-batches and applies
__call__()
to each batch.- Parameters
args – input data, each element of the data corresponds to a single model inputs sequence.
batch_size – the size of a batch.
- Returns
the model output as if the data was passed to the
__call__()
method.
-
-
deeppavlov.core.common.metrics_registry.
fn_from_str
(name: str) → Callable[…, Any][source]¶ Returns a function object with the name given in string.
-
deeppavlov.core.common.metrics_registry.
get_metric_by_name
(name: str) → Callable[…, Any][source]¶ Returns a metric callable with a corresponding name.
-
deeppavlov.core.common.metrics_registry.
register_metric
(metric_name: str) → Callable[…, Any][source]¶ Decorator for metric registration.
-
deeppavlov.core.common.params.
from_params
(params: Dict, mode: str = 'infer', serialized: Any = None, **kwargs) → Union[deeppavlov.core.models.component.Component, function][source]¶ Builds and returns the Component from corresponding dictionary of parameters.
-
deeppavlov.core.common.registry.
cls_from_str
(name: str) → type[source]¶ Returns a class object with the name given as a string.
-
deeppavlov.core.common.registry.
get_model
(name: str) → type[source]¶ Returns a registered class object with the name given in the string.
-
deeppavlov.core.common.registry.
list_models
() → list[source]¶ Returns a list of names of registered classes.