Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Unlimiformer with the forward method #38

Open
testzer0 opened this issue Sep 9, 2023 · 3 comments
Open

Running Unlimiformer with the forward method #38

testzer0 opened this issue Sep 9, 2023 · 3 comments

Comments

@testzer0
Copy link

testzer0 commented Sep 9, 2023

Hi,
I am currently trying to run the inference example with a slight modification. Instead of generate()-ing text, I want to pass in input_ids and labels to the forward function and obtain the logits. However, the current implementation leads to device-side asserts. How may I achieve the above goal?

@abertsch72
Copy link
Owner

Hi @testzer0 -- what is the specific error you're seeing here? Thanks!

@m10an
Copy link

m10an commented Jan 5, 2024

I also have issues with running forward method:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-9-5679df71b070>](https://localhost:8080/#) in <cell line: 1>()
----> 1 out = model(**example)
      2 out

2 frames
[/content/unlimiformer/src/unlimiformer.py](https://localhost:8080/#) in pre_forward_hook(self, input_ids, attention_mask, labels, **kwargs)
    545                 if input_ids is not None:
    546                     # self.input_ids_size += input_ids.shape[-1]
--> 547                     self.input_ids_size += 1
    548                 if kwargs.get('decoder_input_ids') is not None:
    549                     self.generated_input_ids = torch.cat([self.generated_input_ids, kwargs['decoder_input_ids']], axis=-1)

AttributeError: 'UnlimiformerBART' object has no attribute 'input_ids_size'

Here is my colab (based on inference-example.py) for more details and being able to reproduce error.

Thank you!

@abertsch72
Copy link
Owner

I've just pushed a fix for this issue-- please let me know if you're still having problems with the newest version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants