I am trying to train a seq2seq
model with constraints on the form of the output sequence.
My input sequence is unconstrained (any sentence), and my output sequence is formal language that resembles assembly.
The output sequence is a series of triplets of (operator, operand_1, operand_2)
An example triplet is (move, living_room, kitchen)
, note that given that the operator
is "move"
the type of the 2 operands is determined and it must be a room.
I know all operators, operands and constraints in advanced.
I’ve been looking into overriding the greedy_search
method, but adjust_logits_during_generation
also looks like an interesting direction.
How would you tackle this problem ?