Transformer (Source) can be used to encode both drug and protein on SMILES.

constructor create an instance of Transformer.

__init__(self, encoding, **config)
  • encoding (string, “drug” or “protein”) - specify input type of the model, “drug” or “protein”.
  • config (kwargs, keyword arguments) - specify the parameter of transformer. The keys include
    • transformer_dropout_rate (float) - dropout rate of transformer.
    • input_dim_drug (int) - input dimension when encoding drug.
    • transformer_emb_size_drug (int) - dimension of embedding in input layer when encoding drug.
    • transformer_n_layer_drug (int) - number of layers in transformer when encoding drug.
    • todo

Calling functions implement the feedforward procedure of MPNN.

forward(self, v)
  • v (tuple of length 2) - input feature of transformer. v[0] (np.array) is index of atoms. v[1] (np.array) is the corresponding mask.