Skip to content

Commit

Permalink
Fix loading issue of fine-tuned NER models
Browse files Browse the repository at this point in the history
  • Loading branch information
hankcs committed Dec 2, 2024
1 parent b8a165c commit 1197741
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def build_model(self, training=True, extra_embeddings: Embedding = None, finetun
self.config.get('secondary_encoder', None),
extra_embeddings=extra_embeddings.module(self.vocabs) if extra_embeddings else None,
)
if finetune:
if finetune and self.model:
model_state = model.state_dict()
load_state = self.model.state_dict()
safe_state = filter_state_dict_safely(model_state, load_state)
Expand Down
2 changes: 1 addition & 1 deletion hanlp/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Author: hankcs
# Date: 2019-12-28 19:26

__version__ = '2.1.0-beta.62'
__version__ = '2.1.0-beta.63'
"""HanLP version"""


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
'transformers>=4.1.1',
'sentencepiece>=0.1.91', # Essential for tokenization_bert_japanese
'torch>=1.6.0',
'hanlp-common>=0.0.20',
'hanlp-common>=0.0.21',
'hanlp-trie>=0.0.4',
'hanlp-downloader',
*TOKENIZERS,
Expand Down

0 comments on commit 1197741

Please sign in to comment.