Open xy1137030414 opened 8 months ago
Did you solve this problem? I have the same question.
I have not solved the problem yet, i use another nlptools for my study. If you fix it,could you tell me?thank you!
From: Jiahaohong @.> Sent: Thursday, March 28, 2024 11:06 AM To: nlp-uoregon/trankit @.> Cc: Xu Yue @.>; Author @.> Subject: Re: [nlp-uoregon/trankit] OSError: Can't load weights for 'xlm-roberta-base'. (Issue #83)
Did you solve this problem? I have the same question.
— Reply to this email directly, view it on GitHubhttps://github.com/nlp-uoregon/trankit/issues/83#issuecomment-2024315477, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARRIME2XZZDCCRTBCLHYHWDY2OCMZAVCNFSM6AAAAABFDMZDW6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRUGMYTKNBXG4. You are receiving this because you authored the thread.Message ID: @.***>
I solve the problm by repalcing the model path to my local model path.
# ./trankit-master/trankit/models/base_models.py
class Base_Model(nn.Module): # currently assuming the pretrained transformer is XLM-Roberta
def __init__(self, config, task_name):
super().__init__()
self.config = config
self.task_name = task_name
# xlmr encoder
self.xlmr_dim = 768 if config.embedding_name == 'xlm-roberta-base' else 1024
# self.xlmr = XLMRobertaModel.from_pretrained(config.embedding_name,
# cache_dir=os.path.join(config._cache_dir, config.embedding_name),
# output_hidden_states=True)
self.xlmr = XLMRobertaModel.from_pretrained('./cache/xlm-roberta-base',
cache_dir=os.path.join(config._cache_dir, config.embedding_name),
output_hidden_states=True)
thank you!谢谢你!
From: Jiahaohong @.> Sent: Thursday, March 28, 2024 3:08 PM To: nlp-uoregon/trankit @.> Cc: Xu Yue @.>; Author @.> Subject: Re: [nlp-uoregon/trankit] OSError: Can't load weights for 'xlm-roberta-base'. (Issue #83)
I solve the problm by repalcing the model path to my local model path.
class Base_Model(nn.Module): # currently assuming the pretrained transformer is XLM-Roberta def init(self, config, task_name): super().init() self.config = config self.task_name = task_name
self.xlmr_dim = 768 if config.embedding_name == 'xlm-roberta-base' else 1024
# self.xlmr = XLMRobertaModel.from_pretrained(config.embedding_name,
# cache_dir=os.path.join(config._cache_dir, config.embedding_name),
# output_hidden_states=True)
self.xlmr = XLMRobertaModel.from_pretrained('./cache/xlm-roberta-base',
cache_dir=os.path.join(config._cache_dir, config.embedding_name),
output_hidden_states=True)
― Reply to this email directly, view it on GitHubhttps://github.com/nlp-uoregon/trankit/issues/83#issuecomment-2024545689, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARRIMEYPF4EOMGF5MOGB2ITY2O6WZAVCNFSM6AAAAABFDMZDW6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRUGU2DKNRYHE. You are receiving this because you authored the thread.Message ID: @.***>
OSError: Can't load weights for 'xlm-roberta-base'. Make sure that:
'xlm-roberta-base' is a correct model identifier listed on 'https://huggingface.co/models'
or 'xlm-roberta-base' is the correct path to a directory containing a file named one of pytorch_model.bin, tf_model.h5, model.ckpt.
i create a new folder under the"C:\Users\Name.cache",name it"xlm-roberta-base",and I download the pytorch_model.bin to the folder,but still have error