_init_weights error when loading model
Hi,
When I try to load the model with the following commands:
tokenizer = AutoTokenizer.from_pretrained("zhihan1996/DNABERT-2-117M", trust_remote_code=True)
db2_model = AutoModel.from_pretrained("zhihan1996/DNABERT-2-117M", trust_remote_code=True)
I receive the following error pasted below.
Could you please advise?
Thank you!
...
File ~\Anaconda3\envs\env1\lib\site-packages\transformers\models\auto\auto_factory.py:443 in from_pretrained
return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
File ~\Anaconda3\envs\env1\lib\site-packages\transformers\modeling_utils.py:2059 in from_pretrained
model, missing_keys, unexpected_keys, mismatched_keys, error_msgs = cls._load_pretrained_model(
File ~\Anaconda3\envs\env1\lib\site-packages\transformers\modeling_utils.py:2153 in _load_pretrained_model
model._init_weights(module)
File ~\Anaconda3\envs\env1\lib\site-packages\transformers\modeling_utils.py:1035 in _init_weights
raise NotImplementedError(f"Make sure _init_weights
is implemented for {self.class}")
NotImplementedError: Make sure _init_weights
is implemented for <class 'transformers_modules.zhihan1996.DNABERT-2-117M.1c51eccc93c384e4ded6a71055ac360d0cf68196.bert_layers.BertModel'>
It should work now. Thanks for indicating this.