Commit d2074c8f authored by seyonechithrananda's avatar seyonechithrananda
Browse files

add docstrings

parent ebe11fec
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -6,6 +6,35 @@ from typing import Dict, List


class RobertaFeaturizer(RobertaTokenizerFast, MolecularFeaturizer):
  """Roberta Featurizer.

  The Roberta Featurizer is a wrapper class of the Roberta Tokenizer,
  which is used by Huggingface's transformers library for tokenizing large corpuses for Roberta Models.
  Please confirm the details in [1]_.

  Please see https://github.com/huggingface/transformers
  and https://github.com/seyonechithrananda/bert-loves-chemistry for more details.

  Examples
  --------
  >>> from deepchem.feat.molecule_featurizers import RobertaFeaturizer
  >>> smiles = ["Cn1c(=O)c2c(ncn2C)n(C)c1=O", "CC(=O)N1CN(C(C)=O)C(O)C1O"]
  >>> featurizer = RobertaFeaturizer.from_pretrained("seyonec/SMILES_tokenized_PubChem_shard00_160k")
  >>> featurizer.featurize(smiles, add_special_tokens=True, truncation=True)

  References
  ----------
  .. [1] Chithrananda, Seyone, Gabriel Grand, and Bharath Ramsundar (2020): "Chemberta: Large-scale self-supervised 
    pretraining for molecular property prediction." arXiv. preprint. arXiv:2010.09885.


  Note
  -----
  This class requires transformers to be installed.
  RobertaFeaturizer uses dual inheritance with RobertaTokenizerFast in Huggingface for rapid tokenization,
  as well as DeepChem's MolecularFeaturizer class.
  """


  def __init__(self, **kwargs):
    super().__init__(**kwargs)