Skip to content

Instantly share code, notes, and snippets.

@Akashdesarda
Created April 22, 2020 09:48
Show Gist options
  • Save Akashdesarda/e3aae7e25a4290075f234aa912c8146f to your computer and use it in GitHub Desktop.
Save Akashdesarda/e3aae7e25a4290075f234aa912c8146f to your computer and use it in GitHub Desktop.
from transformers import DistilBertTokenizer, RobertaTokenizer,
distil_bert = 'distilbert-base-uncased' # Pick any desired pre-trained model
roberta = 'roberta-base-uncase'
# Defining DistilBERT tokonizer
tokenizer = DistilBertTokenizer.from_pretrained(distil_bert, do_lower_case=True, add_special_tokens=True,
max_length=128, pad_to_max_length=True)
# Defining RoBERTa tokinizer
tokenizer = RobertaTokenizer.from_pretrained(roberta, do_lower_case=True, add_special_tokens=True,
max_length=128, pad_to_max_length=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment