allow Output subclasses in contrastive search
#4
by
jood-canva
- opened
Hi,
I am trying to use contrastive search on a custom multimodal model and I found out that it was overriding the model outputs to have the default type (like CausalLMOutputWithPast for instance). This can be an issue for models that rely on extra attributes in the output class. I think we could simply replace the attributes we want in Outputs rather than recreating the object from the default class. We achieve the same thing but it's a bit cleaner in my opinion. Happy to discuss if I'm missing something!
Also happy to add assertions to check that outputs inherit from the correct class if you want.