ufal / neuralmonkey

An open-source tool for sequence learning in NLP built on TensorFlow.
BSD 3-Clause "New" or "Revised" License
410 stars 106 forks source link

GreedyRunner should not fetch training-related tensors by default during inference #804

Open varisd opened 5 years ago

varisd commented 5 years ago

Currently, the train_xent, runtime_xent is default fetch in the GreedyRunner. Computation of these requires references, which might not be available during inference time (e.g. we only want to produce output and not compute xents).

This can be sort-of avoided by listing input data also as the reference. However, this may not be completely intuitive to the user.

jlibovicky commented 5 years ago

Do you have a particular example of an error you get?

jlibovicky commented 5 years ago

If everything works correctly, the loss ops are prepared as potential fetches in the runner, but at the time the runner creates an executable, it knows whether the reference is available or not and sets flag compute_losses accordingly. If there is no reference, the executable replaces the ops with tf.zeros([]).

varisd commented 5 years ago

I'll try to find a reproducible example.

jindrahelcl commented 5 years ago

If there's no reference, losses don't get computed. The logic is implemented in executable's next_to_execute method.

On Mon, Mar 18, 2019, 8:43 AM Dušan Variš notifications@github.com wrote:

I'll try to find a reproducible example.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ufal/neuralmonkey/issues/804#issuecomment-473967405, or mute the thread https://github.com/notifications/unsubscribe-auth/ABwcs_VHnbgTyutVUovnjoLNhDbMQfzaks5vX7Q9gaJpZM4b231a .