Preserve model compatibility in parser, for now

This commit is contained in:
Matthew Honnibal 2017-09-04 16:46:22 +02:00
parent d5fbf27335
commit 9d65d67985

View File

@ -393,7 +393,8 @@ cdef class Parser:
tokvecs = self.model[0].ops.flatten(tokvecses)
if USE_FINE_TUNE:
tokvecs = self.model[0].ops.flatten(self.model[0]((docs, tokvecses)))
# TODO: This is incorrect! Unhack when training next model
tokvecs += self.model[0].ops.flatten(self.model[0]((docs, tokvecses)))
nr_state = len(docs)
nr_class = self.moves.n_moves
@ -531,8 +532,8 @@ cdef class Parser:
docs = [docs]
golds = [golds]
if USE_FINE_TUNE:
tokvecs, bp_my_tokvecs = self.model[0].begin_update(docs_tokvecs, drop=drop)
tokvecs = self.model[0].ops.flatten(tokvecs)
my_tokvecs, bp_my_tokvecs = self.model[0].begin_update(docs_tokvecs, drop=drop)
tokvecs += self.model[0].ops.flatten(my_tokvecs)
cuda_stream = get_cuda_stream()
@ -605,8 +606,8 @@ cdef class Parser:
assert min(lengths) >= 1
tokvecs = self.model[0].ops.flatten(tokvecs)
if USE_FINE_TUNE:
tokvecs, bp_my_tokvecs = self.model[0].begin_update(docs_tokvecs, drop=drop)
tokvecs = self.model[0].ops.flatten(tokvecs)
my_tokvecs, bp_my_tokvecs = self.model[0].begin_update(docs_tokvecs, drop=drop)
tokvecs += self.model[0].ops.flatten(my_tokvecs)
states = self.moves.init_batch(docs)
for gold in golds: