Skip to content

Commit

Permalink
Merge pull request #161 from nnnyt/dev
Browse files Browse the repository at this point in the history
[REFACTOR] remove useless code & minor changes
  • Loading branch information
KenelmQLH authored Mar 20, 2024
2 parents ddc432a + aefcc3b commit 8a9b344
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 633 deletions.
2 changes: 1 addition & 1 deletion EduNLP/ModelZoo/jiuzhang/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .jiuzhang import *
from .modeling import CPTModel as JiuzhangModel
from .modeling import CPTModel as Jiuzhang
10 changes: 5 additions & 5 deletions EduNLP/ModelZoo/jiuzhang/jiuzhang.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import List
from ..rnn.harnn import HAM
from transformers import BartConfig as JiuzhangConfig
from .modeling import CPTModel as JiuzhangModel
from .modeling import CPTModel as Jiuzhang


__all__ = ["JiuzhangForPropertyPrediction", "JiuzhangForKnowledgePrediction"]
Expand All @@ -20,10 +20,10 @@ def __init__(self, pretrained_model_dir=None, head_dropout=0.5, init=True):
jiuzhang_config = JiuzhangConfig.from_pretrained(pretrained_model_dir)
if init:
print(f'Load Jiuzhang from checkpoint: {pretrained_model_dir}')
self.jiuzhang = JiuzhangModel.from_pretrained(pretrained_model_dir, ignore_mismatched_sizes=True)
self.jiuzhang = Jiuzhang.from_pretrained(pretrained_model_dir, ignore_mismatched_sizes=True)
else:
print(f'Load Jiuzhang from config: {pretrained_model_dir}')
self.jiuzhang = JiuzhangModel(jiuzhang_config)
self.jiuzhang = Jiuzhang(jiuzhang_config)
self.hidden_size = self.jiuzhang.config.hidden_size
self.head_dropout = head_dropout
self.dropout = nn.Dropout(head_dropout)
Expand Down Expand Up @@ -90,10 +90,10 @@ def __init__(self,
jiuzhang_config = JiuzhangConfig.from_pretrained(pretrained_model_dir)
if init:
print(f'Load Jiuzhang from checkpoint: {pretrained_model_dir}')
self.jiuzhang = JiuzhangModel.from_pretrained(pretrained_model_dir, ignore_mismatched_sizes=True)
self.jiuzhang = Jiuzhang.from_pretrained(pretrained_model_dir, ignore_mismatched_sizes=True)
else:
print(f'Load Jiuzhang from config: {pretrained_model_dir}')
self.jiuzhang = JiuzhangModel(jiuzhang_config)
self.jiuzhang = Jiuzhang(jiuzhang_config)
self.hidden_size = self.jiuzhang.config.hidden_size
self.head_dropout = head_dropout
self.dropout = nn.Dropout(head_dropout)
Expand Down
Loading

0 comments on commit 8a9b344

Please sign in to comment.