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

Llama support #32

Merged
merged 13 commits into from
May 3, 2024
Merged

Llama support #32

merged 13 commits into from
May 3, 2024

Conversation

tengomucho
Copy link
Collaborator

@tengomucho tengomucho commented Apr 30, 2024

What does this PR do?

This add support for sharded Llama models on TPU, tested on TPU v5e litepod-8.
A test that show inference with Llama3-8b on TGI has been added.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@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.

@tengomucho tengomucho marked this pull request as ready for review May 1, 2024 20:04
@nuprin
Copy link
Collaborator

nuprin commented May 1, 2024

Does "sharded llama models" imply that this could cover 70b as well?

@tengomucho
Copy link
Collaborator Author

For now I have only tested with an 8B model on a single-host TPU v5e 4x2. I reckon we would need something bigger to test the 70b model.

@nuprin
Copy link
Collaborator

nuprin commented May 1, 2024

Do you need help with capacity?

Copy link
Member

@mfuntowicz mfuntowicz left a comment

Choose a reason for hiding this comment

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

LGTM! 👏🏻

Comment on lines +52 to +55

@pytest.mark.slow
def test_distributed_model_prefill_llama3_8b():
_test_distributed_model_prefill("meta-llama/Meta-Llama-3-8B")
Copy link
Member

Choose a reason for hiding this comment

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

Should we start parametrize the test rather than dupplicate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I should definitely do a bit of refactoring on the tests to avoid duplicaiton... will do later if you agree.

Comment on lines 432 to 437
pad_token_id = self.tokenizer.pad_token_id
if pad_token_id is None:
if isinstance(self.tokenizer.eos_token_id, list):
pad_token_id = self.tokenizer.eos_token_id[0]
else:
pad_token_id = self.tokenizer.eos_token_id
Copy link
Member

Choose a reason for hiding this comment

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

This block doesn't seem to depend on i should we move it outside the for loop?

@tengomucho tengomucho merged commit 973655d into main May 3, 2024
4 checks passed
@tengomucho tengomucho deleted the llama-support branch May 3, 2024 10:05
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.

None yet

4 participants