matcha.torch.encoders.rnn
Recurrent Neural Network (RNN) encoder for chemical language representations.
Classes
Recurrent Neural Network (RNN) encoder for modelling chemical language |
Module Contents
- class matcha.torch.encoders.rnn.RNN(num_layers: int, num_characters: int, embedding_dim: int, rnn_type: str, hidden_dim: int, bidirectional: str, num_heads: int, dropout: float)[source]
Bases:
matcha.torch.encoders.base_encoder.BaseEncoder,lightning.pytorch.core.mixins.HyperparametersMixinRecurrent Neural Network (RNN) encoder for modelling chemical language representations. After processing the input sequence, self attention is used to compute a global representation of the molecule by making the [cls] token attend to each other position in the string. It inherits from
lightning.pytorch.core.mixinsto save its hyperparameters, and fromBaseEncoderto be consistent with other encoders. It is intended to be used inside amatcha.torch.models.classic.base_classic_model.BaseClassicModelinstance. References: - https://arxiv.org/abs/2407.12152 - https://www.sciencedirect.com/science/article/pii/S2667318521000143It is intended to be used inside a
BaseClassicModelinstance. Check the docs ofmatcha.torch.models.classic.RNNModelfor further details.- Parameters:
num_layers (int) – number of RNN layers
num_characters (int) – total number of unique tokens in the dataset’s dictionary
embedding_dim (int) – number of token embedding features
rnn_type (str) – whether to use LSTM or GRU architectures
hidden_dim (int) – number of hidden token dimensionality
bidirectional (str) – whether to concatenate representation obtained while running RNN in reverse on the string
num_heads (int) – number of self attention heads, must divide hidden_dims evenly
dropout (float) – dropout noise level
- embedding
- rnn
- layers
- attention
- norm_in
- norm_out