mamkit.models package#
Submodules#
mamkit.models.audio module#
- class mamkit.models.audio.AudioOnlyModel(*args, **kwargs)#
Bases:
Module
- forward(audio)#
Define 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 mamkit.models.audio.BiLSTM(embedding_dim, lstm_weights, head, dropout_rate)#
Bases:
AudioOnlyModel
- forward(audio)#
Define 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 mamkit.models.audio.PairBiLSTM(embedding_dim, lstm_weights, head, dropout_rate)#
Bases:
BiLSTM
- encode_audio(audio)#
- forward(audio)#
Define 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 mamkit.models.audio.PairTransformerEncoder(embedding_dim, encoder, head, dropout_rate=0.0)#
Bases:
TransformerEncoder
- encode_audio(audio)#
- forward(audio)#
Define 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 mamkit.models.audio.TransformerEncoder(embedding_dim, encoder, head, dropout_rate=0.0)#
Bases:
AudioOnlyModel
- forward(audio)#
Define 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#
mamkit.models.text module#
- class mamkit.models.text.BiLSTM(vocab_size, embedding_dim, lstm_weights, head, dropout_rate=0.0, embedding_matrix=None)#
Bases:
TextOnlyModel
- forward(text)#
Define 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 mamkit.models.text.PairBiLSTM(vocab_size, embedding_dim, lstm_weights, head, dropout_rate=0.0, embedding_matrix=None)#
Bases:
BiLSTM
- forward(text)#
Define 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 mamkit.models.text.PairTransformer(model_card, head, dropout_rate=0.0, is_transformer_trainable=False)#
Bases:
Transformer
- encode_text(text)#
- forward(text)#
Define 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 mamkit.models.text.TextOnlyModel(*args, **kwargs)#
Bases:
Module
- forward(text)#
Define 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 mamkit.models.text.Transformer(model_card, head, dropout_rate=0.0, is_transformer_trainable=False)#
Bases:
TextOnlyModel
- forward(text)#
Define 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#
mamkit.models.text_audio module#
- class mamkit.models.text_audio.BiLSTM(vocab_size, text_embedding_dim, audio_embedding_dim, text_lstm_weights, audio_lstm_weights, head, text_dropout_rate=0.0, audio_dropout_rate=0.0, embedding_matrix=None)#
Bases:
TextAudioModel
- forward(inputs)#
Define 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 mamkit.models.text_audio.CSA(transformer, head, positional_encoder, text_dropout_rate=0.1, audio_dropout_rate=0.1)#
Bases:
TextAudioModel
- forward(inputs)#
Define 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 mamkit.models.text_audio.Ensemble(text_head, audio_head, audio_encoder, positional_encoder, audio_embedding_dim, text_dropout_rate=0.1, audio_dropout_rate=0.1, lower_bound=0.3, upper_bound=0.7)#
Bases:
TextAudioModel
- forward(inputs)#
Define 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 mamkit.models.text_audio.MMTransformer(model_card, head, audio_embedding_dim, lstm_weights, text_dropout_rate=0.0, audio_dropout_rate=0.0, is_transformer_trainable=False)#
Bases:
TextAudioModel
- forward(inputs)#
Define 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 mamkit.models.text_audio.MulTA(embedding_dim, d_ffn, n_blocks, head, positional_encoder, audio_dropout_rate=0.1, text_dropout_rate=0.1)#
Bases:
TextAudioModel
Class for the unaligned multimodal model
- forward(inputs)#
Define 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 mamkit.models.text_audio.PairBiLSTM(vocab_size, text_embedding_dim, audio_embedding_dim, text_lstm_weights, audio_lstm_weights, head, text_dropout_rate=0.0, audio_dropout_rate=0.0, embedding_matrix=None)#
Bases:
BiLSTM
- encode_input(inputs)#
- forward(inputs)#
Define 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 mamkit.models.text_audio.PairCSA(transformer, head, positional_encoder, text_dropout_rate=0.1, audio_dropout_rate=0.1)#
Bases:
CSA
- encode_inputs(inputs)#
- forward(inputs)#
Define 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 mamkit.models.text_audio.PairEnsemble(text_head, audio_head, audio_encoder, positional_encoder, audio_embedding_dim, text_dropout_rate=0.1, audio_dropout_rate=0.1, lower_bound=0.3, upper_bound=0.7)#
Bases:
Ensemble
- encode_audio(audio)#
- encode_text(text)#
- forward(inputs)#
Define 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 mamkit.models.text_audio.PairMMTransformer(model_card, head, audio_embedding_dim, lstm_weights, text_dropout_rate=0.0, audio_dropout_rate=0.0, is_transformer_trainable=False)#
Bases:
MMTransformer
- encode_inputs(inputs)#
- forward(inputs)#
Define 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 mamkit.models.text_audio.PairMulTA(embedding_dim, d_ffn, n_blocks, head, positional_encoder, audio_dropout_rate=0.1, text_dropout_rate=0.1)#
Bases:
MulTA
- encode_inputs(inputs)#
- forward(inputs)#
Define 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 mamkit.models.text_audio.TextAudioModel(*args, **kwargs)#
Bases:
Module
- forward(inputs)#
Define 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#