Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit88f4555

Browse files
fix bug
1 parent16dca2f commit88f4555

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

‎python/dnlp/core/dnn_crf.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
importos
66
importtime
77
fromdnlp.core.dnn_crf_baseimportDnnCrfBase
8-
fromdnlp.configimportDnnCrfConfig
8+
fromdnlp.config.configimportDnnCrfConfig
99

1010

1111
classDnnCrf(DnnCrfBase):
@@ -84,11 +84,7 @@ def __init__(self, *, config: DnnCrfConfig = None, task='cws', data_path: str =
8484
iftrain=='ll':
8585
self.crf_loss,_=tf.contrib.crf.crf_log_likelihood(self.output,self.real_indices,self.seq_length,
8686
self.transition)
87-
# self.loss = -self.loss
8887
self.loss=-self.crf_loss/self.batch_size+self.regularization
89-
# self.optimizer = tf.train.AdagradOptimizer(self.learning_rate)
90-
# self.optimizer.minimize(self.loss)
91-
# self.train = self.optimizer.minimize(self.loss)
9288
else:
9389
self.true_seq=tf.placeholder(tf.int32, [self.batch_size,self.batch_length])
9490
self.pred_seq=tf.placeholder(tf.int32, [self.batch_size,self.batch_length])
@@ -100,7 +96,6 @@ def __init__(self, *, config: DnnCrfConfig = None, task='cws', data_path: str =
10096
state_difference=tf.reduce_sum(
10197
tf.gather_nd(self.output_placeholder,pred_index)-tf.gather_nd(self.output_placeholder,true_index),
10298
axis=1)
103-
# r = tf.stack([self.true_seq[:, :-1], self.true_seq[:, 1:]], 2)
10499
transition_difference=tf.reduce_sum(
105100
tf.gather_nd(self.transition,tf.stack([self.pred_seq[:, :-1],self.pred_seq[:,1:]],2))-tf.gather_nd(
106101
self.transition,tf.stack([self.true_seq[:, :-1],self.true_seq[:,1:]],2)),axis=1)

‎python/scripts/cws_ner.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
importargparse
44
importcsv
55
importxlsxwriter
6-
fromdnlp.configimportDnnCrfConfig
6+
fromdnlp.config.configimportDnnCrfConfig
77
fromdnlp.core.dnn_crfimportDnnCrf
88
fromdnlp.core.dnn_crf_emrimportDnnCrfEmr
99
fromdnlp.core.word2vecimportWord2Vec

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp