fusionlab.classification.base module#
- class fusionlab.classification.base.CNNClassificationModel(*args, **kwargs)[source]#
Bases:
ModuleBase PyTorch class of the classification model with Encoder, Head for CNN
- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool#
- class fusionlab.classification.base.HFClassificationModel(model, num_cls=None, loss_fct=CrossEntropyLoss())[source]#
Bases:
ModuleBase Hugginface-pytoch model wrapper class of the classification model
- forward(x, labels=None)[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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool#
- class fusionlab.classification.base.RNNClassificationModel(*args, **kwargs)[source]#
Bases:
ModuleBase PyTorch class of the classification model with Encoder, Head for RNN
- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool#