mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 10:26:35 +03:00
Fix missing prints
This commit is contained in:
parent
385946d743
commit
9d7a4f47ad
|
@ -214,10 +214,6 @@ def forward(model, docs_moves: Tuple[List[Doc], TransitionSystem], is_train: boo
|
||||||
|
|
||||||
def _forward_reference(model, docs_moves: Tuple[List[Doc], TransitionSystem], is_train: bool):
|
def _forward_reference(model, docs_moves: Tuple[List[Doc], TransitionSystem], is_train: bool):
|
||||||
"""Slow reference implementation, without the precomputation"""
|
"""Slow reference implementation, without the precomputation"""
|
||||||
def debug_predict(*msg):
|
|
||||||
if not is_train:
|
|
||||||
pass
|
|
||||||
#print(*msg)
|
|
||||||
nF = model.get_dim("nF")
|
nF = model.get_dim("nF")
|
||||||
tok2vec = model.get_ref("tok2vec")
|
tok2vec = model.get_ref("tok2vec")
|
||||||
lower_pad = model.get_param("lower_pad")
|
lower_pad = model.get_param("lower_pad")
|
||||||
|
@ -234,9 +230,6 @@ def _forward_reference(model, docs_moves: Tuple[List[Doc], TransitionSystem], is
|
||||||
docs, moves = docs_moves
|
docs, moves = docs_moves
|
||||||
states = moves.init_batch(docs)
|
states = moves.init_batch(docs)
|
||||||
tokvecs, backprop_tok2vec = tok2vec(docs, is_train)
|
tokvecs, backprop_tok2vec = tok2vec(docs, is_train)
|
||||||
debug_predict("Tokvecs shape", tokvecs.shape)
|
|
||||||
debug_predict("Tokvecs mean", tokvecs.mean(axis=1))
|
|
||||||
debug_predict("Tokvecs var", tokvecs.var(axis=1))
|
|
||||||
all_ids = []
|
all_ids = []
|
||||||
all_which = []
|
all_which = []
|
||||||
all_statevecs = []
|
all_statevecs = []
|
||||||
|
@ -249,7 +242,6 @@ def _forward_reference(model, docs_moves: Tuple[List[Doc], TransitionSystem], is
|
||||||
ids = ids[: len(next_states)]
|
ids = ids[: len(next_states)]
|
||||||
for i, state in enumerate(next_states):
|
for i, state in enumerate(next_states):
|
||||||
state.set_context_tokens(ids, i, nF)
|
state.set_context_tokens(ids, i, nF)
|
||||||
debug_predict(ids)
|
|
||||||
# Sum the state features, add the bias and apply the activation (maxout)
|
# Sum the state features, add the bias and apply the activation (maxout)
|
||||||
# to create the state vectors.
|
# to create the state vectors.
|
||||||
tokfeats3f = model.ops.alloc3f(ids.shape[0], nF, nI)
|
tokfeats3f = model.ops.alloc3f(ids.shape[0], nF, nI)
|
||||||
|
@ -257,10 +249,8 @@ def _forward_reference(model, docs_moves: Tuple[List[Doc], TransitionSystem], is
|
||||||
for j in range(nF):
|
for j in range(nF):
|
||||||
if ids[i, j] == -1:
|
if ids[i, j] == -1:
|
||||||
tokfeats3f[i, j] = lower_pad
|
tokfeats3f[i, j] = lower_pad
|
||||||
debug_predict("Setting tokfeat", i, j, "to pad")
|
|
||||||
else:
|
else:
|
||||||
tokfeats3f[i, j] = tokvecs[ids[i, j]]
|
tokfeats3f[i, j] = tokvecs[ids[i, j]]
|
||||||
debug_predict("Setting tokfeat", i, j, "to", ids[i, j])
|
|
||||||
tokfeats = model.ops.reshape2f(tokfeats3f, tokfeats3f.shape[0], -1)
|
tokfeats = model.ops.reshape2f(tokfeats3f, tokfeats3f.shape[0], -1)
|
||||||
preacts2f = model.ops.gemm(tokfeats, lower_W, trans2=True)
|
preacts2f = model.ops.gemm(tokfeats, lower_W, trans2=True)
|
||||||
preacts2f += lower_b
|
preacts2f += lower_b
|
||||||
|
|
Loading…
Reference in New Issue
Block a user