add GPT2 torchhub compatibility

This commit is contained in:
VictorSanh
2019-06-01 15:27:43 -04:00
parent 2a329c6186
commit a92b6dc3c1
3 changed files with 175 additions and 5 deletions

View File

@@ -91,7 +91,7 @@ class GPT2Tokenizer(object):
@classmethod
def from_pretrained(cls, pretrained_model_name_or_path, cache_dir=None, *inputs, **kwargs):
"""
Instantiate a PreTrainedBertModel from a pre-trained model file.
Instantiate a GPT2Tokenizer from a pre-trained model file.
Download and cache the pre-trained model file if needed.
"""
if pretrained_model_name_or_path in PRETRAINED_VOCAB_ARCHIVE_MAP: