jsonformer icon indicating copy to clipboard operation
jsonformer copied to clipboard

Error in logits_processors.py - OutputNumbersTokens().__call__() for some models

Open bs7280 opened this issue 1 year ago • 2 comments

Hello: When running the tiiuae/falcon-7b model, I get no issue using the package as intented. But some models, such as tiiuae/falcon-rw-1b will get an error in OutputNumbersTokens().call() like below:

The expanded size of the tensor (50304) must match the existing size (50257) at non-singleton dimension 1. Target sizes: [1, 50304]. Tensor sizes: [50257]

I've been trying to debug this on my own but have not figured out why sometimes self.allowed_mask and scores sometimes have mismatching shapes (depending on model) that will cause the above error when trying to run:

self.allowed_mask.expand_as(scores)

bs7280 avatar Oct 05 '23 21:10 bs7280

I thought this was a bug in transformers or in the specific model, but I tried modifying the example notebook in lm-format-enforcer ( https://github.com/noamgat/lm-format-enforcer/blob/main/samples/colab_llama2_enforcer.ipynb ) which achieves a similar goal, to use tiiuae/falcon-rw-1b and it worked.

So I'm not sure

noamgat avatar Oct 24 '23 08:10 noamgat

Hi, I encountered the same problem where there was a size mismatch when running other models. Do you know how to solve it?

Vincentyua avatar Jan 09 '24 09:01 Vincentyua