outlines icon indicating copy to clipboard operation
outlines copied to clipboard

Update logits array in-place

Open brandonwillard opened this issue 1 year ago • 5 comments

What behavior of the library made you think about the improvement?

The current structured generation code is creating a -inf copy of the logits array and setting the allowed token ID indices to the corresponding values in the original logits array. See here.

How would you like it to behave?

When possible, the original logits array should be updated in-place and completely avoid creating a new array. This change would likely require the set of disallowed token IDs instead of the allowed ones.

brandonwillard avatar May 02 '24 16:05 brandonwillard

@rlouf @lapp0

brandonwillard avatar Sep 26 '24 17:09 brandonwillard

This is dead code which should be cleaned up after

https://github.com/dottxt-ai/outlines/pull/1010

lapp0 avatar Sep 26 '24 18:09 lapp0

This is dead code which should be cleaned up after

#1010

The relevant code now seems to be here; is that what will be updated in #1010?

brandonwillard avatar Sep 26 '24 18:09 brandonwillard

No, that is a problem, thanks for pointing it out. I'll look at it once my current task is complete.

lapp0 avatar Sep 26 '24 19:09 lapp0

#1192 does not appear to update the logits arrays in place, at least not without creating another array the size of the logits.

brandonwillard avatar Oct 07 '24 14:10 brandonwillard

Looks like this might need to be moved after https://github.com/dottxt-ai/outlines/issues/1206.

brandonwillard avatar Oct 16 '24 18:10 brandonwillard