r""" # Using torch.hub ! import torch model = torch.hub.load('huggingface/transformers', 'model', 'bert-base-uncased') # Download model and configuration from S3 and cache. model = torch.hub.load('huggingface/transformers', 'model', './test/bert_mo
(*args, **kwargs)
| 55 | |
| 56 | @add_start_docstrings(AutoModel.__doc__) |
| 57 | def model(*args, **kwargs): |
| 58 | r""" |
| 59 | # Using torch.hub ! |
| 60 | import torch |
| 61 | |
| 62 | model = torch.hub.load('huggingface/transformers', 'model', 'bert-base-uncased') # Download model and configuration from S3 and cache. |
| 63 | model = torch.hub.load('huggingface/transformers', 'model', './test/bert_model/') # E.g. model was saved using `save_pretrained('./test/saved_model/')` |
| 64 | model = torch.hub.load('huggingface/transformers', 'model', 'bert-base-uncased', output_attention=True) # Update configuration during loading |
| 65 | assert model.config.output_attention == True |
| 66 | # Loading from a TF checkpoint file instead of a PyTorch model (slower) |
| 67 | config = AutoConfig.from_json_file('./tf_model/bert_tf_model_config.json') |
| 68 | model = torch.hub.load('huggingface/transformers', 'model', './tf_model/bert_tf_checkpoint.ckpt.index', from_tf=True, config=config) |
| 69 | |
| 70 | """ |
| 71 | |
| 72 | return AutoModel.from_pretrained(*args, **kwargs) |
| 73 | |
| 74 | |
| 75 | @add_start_docstrings(AutoModelWithLMHead.__doc__) |