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

Structured Prompting: GPT_neo_modeling.py #69

Open
amurtadha opened this issue Sep 4, 2023 · 2 comments
Open

Structured Prompting: GPT_neo_modeling.py #69

amurtadha opened this issue Sep 4, 2023 · 2 comments
Assignees

Comments

@amurtadha
Copy link

causal_mask = self.bias[:, :, key_length - query_length : key_length, :key_length]

but in Structured Prompting the key_length exceeds the max_positions.

How to address this issue. Thank you.

@amurtadha
Copy link
Author

I tried this code, but it doesn't work

        if prefix_parallel  and prefix_parallel > 1 :
            key_length_ = ((key_length - query_length) // prefix_parallel) + query_length          
            causal_mask = self.bias[:, :, key_length_ - query_length: key_length_, :key_length_]
            context_mask = torch.ones(1, 1, query_length, key_length - causal_mask.shape[-1]).to(torch.bool).to(attn_weights.device)
            causal_mask = torch.cat([context_mask, causal_mask], dim=-1)
        else:
            causal_mask = self.bias[:, :, key_length - query_length: key_length, :key_length]

@YRdddream
Copy link
Contributor

Hi, do you use hf or fairseq? Could you please provide the source file path of "GPT_neo_modeling.py"?

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

2 participants