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

Generate: fix end to end compilation #32465

Merged
merged 2 commits into from
Aug 6, 2024

Conversation

gante
Copy link
Member

@gante gante commented Aug 6, 2024

What does this PR do?

As @zucchini-nlp noticed, RUN_SLOW=1 py.test tests/models/llama/test_modeling_llama.py::LlamaModelTest::test_generate_compile_fullgraph was failing on main

This PR fixes it.

Ran locally:

  • slow llama tests
  • slow cache tests [NOTE: the torch.export test is failing, and was failing since it was introduced.]

@gante gante requested a review from ArthurZucker August 6, 2024 11:33
Comment on lines +1035 to +1036
self.register_buffer(f"key_cache_{idx}", torch.zeros(cache_shape, dtype=dtype, device=device))
self.register_buffer(f"value_cache_{idx}", torch.zeros(cache_shape, dtype=dtype, device=device))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.register_buffer can't be compiled, but is needed for torch.export

@@ -1477,7 +1479,7 @@ def _get_cache(self, cache_implementation: str, max_batch_size: int, max_cache_l
"config": self.config,
"max_batch_size": max_batch_size,
"max_cache_len": max_cache_len,
"device": self.device,
"device": device,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dropped this line in the end-to-end PR, in a rebase 😢 . self.device can't be called at compilation time

@HuggingFaceDocBuilderDev

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.

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ge tthis merged asap! I don't see tests updates so I suppose everything was caught by our CI but slow CI not push ci right?

@gante
Copy link
Member Author

gante commented Aug 6, 2024

Correct, was caught by the slow ci :)

@gante gante merged commit 3d8bd11 into huggingface:main Aug 6, 2024
21 checks passed
@gante gante deleted the fix_end_to_end_compilation branch August 6, 2024 14:07
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.

3 participants