Graphormer
Graphormer pretrained models¶
GraphormerTransformer
¶
Bases: PretrainedMolTransformer
Graphormer transformer from microsoft, pretrained on PCQM4Mv2 quantum chemistry dataset for the prediction of homo-lumo gap.
Attributes:
Name | Type | Description |
---|---|---|
featurizer |
Graphormer embedding object |
|
dtype |
Data type. Use call instead |
|
pooling |
Pooling method for Graphormer's embedding layer |
Source code in molfeat/trans/pretrained/graphormer.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
__getstate__()
¶
Getting state to allow pickling
Source code in molfeat/trans/pretrained/graphormer.py
121 122 123 124 125 126 |
|
__init__(kind='pcqm4mv2_graphormer_base', dtype=np.float32, pooling='mean', max_length=None, concat_layers=-1, ignore_padding=True, version=None, **params)
¶
Pretrained graphormer featurizer.
Note
The default behaviour of this feature extractor is to return the last hidden state of the encoder, averaged across all nodes (including the virtual node connected to all other nodes).
For a different behaviour, please change the pooling method:
* graph
or virtual
: use the virtual node embedding in the last layer to get the graph representation
* mean
, max
, sum
, etc or any other supported pooling of molfeat.utils.pooler.Pooling
will take the operation defined by the pooling layer across all nodes of each graph
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kind |
str
|
name of the featurizer as available in the model store |
'pcqm4mv2_graphormer_base'
|
dtype |
Callable
|
Data type to output |
float32
|
pooling |
str
|
type of pooling to use. One of ['graph', 'virtual', 'mean', 'max', 'sum']. The value "graph" corresponds to the virtual node representation |
'mean'
|
max_length |
Optional[int]
|
Maximum length of the input sequence to consider. Please update this for large sequences |
None
|
concat_layers |
Union[List[int], int]
|
Layer to concat to get the representation. By default the last hidden layer is returned. |
-1
|
ignore_padding |
bool
|
Whether to ignore padding in the representation (default: True) to avoid effect of batching |
True
|
params |
any other parameter to pass to PretrainedMolTransformer |
{}
|
Source code in molfeat/trans/pretrained/graphormer.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
__setstate__(d)
¶
Setting state during reloading pickling
Source code in molfeat/trans/pretrained/graphormer.py
128 129 130 131 |
|
compute_max_length(inputs)
¶
Compute maximum node number for the input list of molecules
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
list
|
input list of molecules |
required |
Source code in molfeat/trans/pretrained/graphormer.py
133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
list_available_models()
staticmethod
¶
List available graphormer model to use
Source code in molfeat/trans/pretrained/graphormer.py
97 98 99 100 101 102 103 104 105 |
|
set_max_length(max_length)
¶
Set the maximum length for this featurizer
Source code in molfeat/trans/pretrained/graphormer.py
147 148 149 150 151 |
|