Я пытался играть с PYTORCH-TRANSFORMERS предварительно обученной моделью. Со всем по умолчанию в шаблоне коллаборации, используя torch.hub.load()
от huggingface/pytorch-transformers
в качестве 'модели' до bert-base-uncased
пример кода
import torch
model = torch.hub.load('huggingface/pytorch-transformers', 'model', 'bert-base-uncased') # Download model and configuration from S3 and cache.
, и я получаю эту ошибку
Using cache found in /root/.cache/torch/hub/huggingface_pytorch-transformers_master
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-19-ad22a1a34951> in <module>()
1 import torch
----> 2 model = torch.hub.load('huggingface/pytorch-transformers', 'model', 'somethingelse') # Download model and configuration from S3 and cache.
3 model = torch.hub.load('huggingface/pytorch-transformers', 'model', './test/bert_model/') # E.g. model was saved using `save_pretrained('./test/saved_model/')`
4 model = torch.hub.load('huggingface/pytorch-transformers', 'model', 'bert-base-uncased', output_attentions=True) # Update configuration during loading
5 assert model.config.output_attentions == True
13 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/generic_utils.py in decorator(arg)
177 raise ValueError(
178 '%s has already been registered to %s' %
--> 179 (registered_name, _GLOBAL_CUSTOM_OBJECTS[registered_name]))
180
181 if arg in _GLOBAL_CUSTOM_NAMES:
ValueError: Custom>TFBertMainLayer has already been registered to <class 'src.transformers.modeling_tf_bert.TFBertMainLayer'>
Я не совсем понимаю, что происходит.