class_docstr: GROVER model
  
  The GROVER model employs a self-supervised message passing transformer architecutre
  for learning molecular representation. The pretraining task can learn rich structural
  and semantic information of molecules from unlabelled molecular data, which can
  be leveraged by finetuning for downstream applications. To this end, GROVER integrates message
  passing networks into a transformer style architecture.
  
  Parameters
  ----------
  node_fdim: int
      the dimension of additional feature for node/atom.
  edge_fdim: int
      the dimension of additional feature for edge/bond.
  atom_vocab: GroverAtomVocabularyBuilder
      Grover atom vocabulary builder required during pretraining.
  bond_vocab: GroverBondVocabularyBuilder
      Grover bond vocabulary builder required during pretraining.
  hidden_size: int
      Size of hidden layers
  features_only: bool
      Uses only additional features in the feed-forward network, no graph network
  self_attention: bool, default False
      When set to True, a self-attention layer is used during graph readout operation.
  functional_group_size: int (default: 85)
      Size of functional group used in grover.
  features_dim: int
      Size of additional molecular features, like fingerprints.
  ffn_num_layers: int (default: 1)
      Number of linear layers to use for feature extraction from embeddings
  ffn_hidden_size: int (default: 64)
      Hidden size of feed forward network
  attn_out_size: int (default: 16)
      Size of attention heads
  num_attn_heads: int (default: 4)
      Number of attention heads
  task: str (pretraining or finetuning)
      Pretraining or finetuning tasks.
  mode: str (classification or regression)
      Training mode (used only for finetuning)
  n_tasks: int, optional (default: 1)
      Number of tasks
  n_classes: int, optiona (default: 2)
      Number of target classes in classification mode
  model_dir: str
      Directory to save model checkpoints
  dropout: float, optional (default: 0.2)
      dropout value
  activation: str, optional (default: 'relu')
      supported activation function
  depth: int (default: 1)
      Dynamic message passing depth for use in MPNEncoder
  
  Example
  -------
  >>> import deepchem as dc
  >>> from deepchem.models.torch_models.grover import GroverModel
  >>> from deepchem.feat.vocabulary_builders import (GroverAtomVocabularyBuilder, GroverBondVocabularyBuilder)
  >>> import pandas as pd
  >>> import os
  >>> import tempfile
  >>> tmpdir = tempfile.mkdtemp()
  >>> df = pd.DataFrame({'smiles': ['CC', 'CCC'], 'preds': [0, 0]})
  >>> filepath = os.path.join(tmpdir, 'example.csv')
  >>> df.to_csv(filepath, index=False)
  >>> dataset_path = os.path.join(filepath)
  >>> loader = dc.data.CSVLoader(tasks=['preds'], featurizer=dc.feat.DummyFeaturizer(), feature_field=['smiles'])
  >>> dataset = loader.create_dataset(filepath)
  >>> av = GroverAtomVocabularyBuilder()
  >>> av.build(dataset)
  >>> bv = GroverBondVocabularyBuilder()
  >>> bv.build(dataset)
  >>> fg = dc.feat.CircularFingerprint()
  >>> loader2 = dc.data.CSVLoader(tasks=['preds'], featurizer=dc.feat.GroverFeaturizer(features_generator=fg), feature_field='smiles')
  >>> graph_data = loader2.create_dataset(filepath)
  >>> model = GroverModel(node_fdim=151, edge_fdim=165, atom_vocab=av, bond_vocab=bv, features_dim=2048, hidden_size=128, functional_group_size=85, mode='regression', task='finetuning', model_dir='gm')
  >>> loss = model.fit(graph_data, nb_epoch=1)
  
  Reference
  ---------
  .. Rong, Yu, et al. "Self-supervised graph transformer on large-scale molecular data." Advances in Neural Information Processing Systems 33 (2020): 12559-12571.
docstr: Return pretraining components.
  
  The component names are described in GroverModel.build_components method.
code: def _get_pretraining_components(self):
      """Return pretraining components.
  
      The component names are described in GroverModel.build_components method.
      """
      components = {}
      components["embedding"] = GroverEmbedding(
          node_fdim=self.node_fdim,
          edge_fdim=self.edge_fdim,
          hidden_size=self.hidden_size,
          num_heads=self.num_attn_heads,
          depth=self.depth,
      )
      components["atom_vocab_task_atom"] = GroverAtomVocabPredictor(
          self.atom_vocab_size, self.hidden_size
      )
      components["atom_vocab_task_bond"] = GroverAtomVocabPredictor(
          self.atom_vocab_size, self.hidden_size
      )
      components["bond_vocab_task_atom"] = GroverBondVocabPredictor(
          self.bond_vocab_size, self.hidden_size
      )
      components["bond_vocab_task_bond"] = GroverBondVocabPredictor(
          self.bond_vocab_size, self.hidden_size
      )
      components[
          "functional_group_predictor"
      ] = GroverFunctionalGroupPredictor(
          self.functional_group_size, self.hidden_size
      )
      return components
  
imports: import math
  import torch
  import torch.nn
  import torch.nn.functional
  import numpy
  from typing import List, Sequence, Optional, Any, Tuple
  from rdkit import Chem
  from deepchem.models.torch_models.modular import ModularTorchModel
  from deepchem.models.torch_models.grover_layers import GroverEmbedding, GroverBondVocabPredictor, GroverAtomVocabPredictor, GroverFunctionalGroupPredictor
  from deepchem.models.torch_models.readout import GroverReadout
  from deepchem.feat.vocabulary_builders import GroverAtomVocabularyBuilder, GroverBondVocabularyBuilder
  from deepchem.utils.grover import BatchGroverGraph
  import logging
label_desc: Use image node_id 6 for calling the GroverModel obj's underlying member method code with example usage: obj._get_pretraining_components() and returns: components