class_docstr: The method class for the JTVAE algorithm proposed in the paper `Junction Tree Variational Autoencoder for Molecular Graph Generation <https://arxiv.org/abs/1802.04364>`_. This class provides interfaces for running random generation with the JTVAE algorithm. Please refer to the `example codes <https://github.com/divelab/DIG/tree/dig-stable/examples/ggraph/JTVAE>`_ for usage examples.
  
  Args:
      list_smiles (list): List of smiles in training data.
      training (boolean): If we are training (as opposed to testing).
      build_vocab (boolean): If we need to build the vocabulary (first time training with this dataset).
      device (torch.device, optional): The device where the model is deployed.
docstr: Building the vocabulary for training.
  
  Args:
      list_smiles (list): the list of smiles strings in the dataset.
  
  :rtype:
      cset (list): A list of smiles that contains the vocabulary for the training data. 
docstr_tok: ["Building","the","vocabulary","for","training",".","Args",":","list_smiles","(","list",")",":","the","list","of","smiles","strings","in","the","dataset",".",":","rtype",":","cset","(","list",")",":","A","list","of","smiles","that","contains","the","vocabulary","for","the","training","data","."]
code: def build_vocabulary(self, list_smiles):
      r"""
      Building the vocabulary for training.
  
      Args:
          list_smiles (list): the list of smiles strings in the dataset.
  
      :rtype:
          cset (list): A list of smiles that contains the vocabulary for the training data.
  
      """
      cset = set()
      for smiles in list_smiles:
          mol = fast_jtnn.MolTree(smiles)
          for c in mol.nodes:
              cset.add(c.smiles)
      # cset_newline = list(map(lambda x: x + "\n", cset))
      return list(cset)
  
imports: import math
  import sys
  from optparse import OptionParser
  import numpy
  import rdkit
  from rdkit import RDLogger, Chem
  from rdkit.Chem import Descriptors
  from tqdm import tqdm
  import torch
  import torch.nn
  import torch.optim
  import torch.optim.lr_scheduler
  from dig.ggraph.method import Generator
  from .None import fast_jtnn
label_desc: Use image node_id 3 for calling the JTVAE obj's underlying member method code with example usage: obj.build_vocabulary(list_smiles) and returns: list