Skip to content

[causal_mask] Add a warning when registering the buffer#29742

Closed
ArthurZucker wants to merge 1 commit intomainfrom
warn-pre-allocation
Closed

[causal_mask] Add a warning when registering the buffer#29742
ArthurZucker wants to merge 1 commit intomainfrom
warn-pre-allocation

Conversation

@ArthurZucker
Copy link
Copy Markdown
Collaborator

What does this PR do?

After #27931, the importance of max_position_embedding has been greatly improved. Before it would cache sin_cache and cos_cache, which are relatively small tensors.
With the update and the need of a static shaped mask, we are no longer caching sin and cos, but are caching the causal_mask.

  1. Either we keep this and warn users
  2. Or we allocate a new mask at each forward, making sure this is compatible with compile.

Decided to go for 1.

One possible problem is if we re-introduce the sin_cache and cos_cache for performance issues (if it proves to be a lot slower).

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

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

Successfully merging this pull request may close these issues.

2 participants