Open LouisHernandez17 opened 1 month ago
@LouisHernandez17 Hey!
So the problem here is the intervention graph ( which stores all of your interventions that are sent to the server) has to only contain object types that are registered by nnsight so it knows how to serialize and deserialize them. Logits Processor is not one of them. What does RegexProcessor do? Does it just stop generation if it sees a 4 or 5? I think you can create interventions that will do this for you : )
Hi ! Thank you for your answer. Actually, it is a bit more complicated than that, it builds a Finite State Machine, determining for each step of the regex the next legal moves. In this very simple case, the FSM is very simple, we have just two legal moves that go from the initial state to a finished state : either generate a 4 or a 5. But potentially, it could be way harder, for harder RegExes.
At each sampling step, it manually sets the illegal logits the $-\infty$, so that, after the softmax, the only logits with non-zero probability are legal ones.
A relevant library I use is Outlines, based off this paper : https://arxiv.org/pdf/2307.09702
Although I think it could be interesting to support such post-processing, I suppose for simpler regex I could find a workaround, like using a simple mask by hand.
I am trying to use constrained generation with a remote model, however, it only works on local so far, and I am not sure why. This might be related to #137. Here is a MWE, with the error trace:
Error trace: