Skip to content

[Gemma v2] Enable gemma v2 on gaudi#1280

Closed
billishyahao wants to merge 6 commits into
huggingface:mainfrom
billishyahao:enablege2
Closed

[Gemma v2] Enable gemma v2 on gaudi#1280
billishyahao wants to merge 6 commits into
huggingface:mainfrom
billishyahao:enablege2

Conversation

@billishyahao
Copy link
Copy Markdown
Contributor

@billishyahao billishyahao commented Aug 21, 2024

What does this PR do?

This patch aims to enable gemma2 both training and inferencing on gaudi device. Also static shape support is enabled as well. The performance results are shown as below:

python run_generation.py --model_name_or_path ../../../gemma-2-9b/ --bf16 --use_kv_cache --reuse_cache --use_hpu_graphs --max_input_tokens 128 --max_new_tokens 128 --bf16 --batch_size 4

Input/outputs:
input 1: ('DeepSpeed is a machine learning framework',)
output 1: ('DeepSpeed is a machine learning framework that enables training of large-scale deep learning models on a single GPU or across multiple GPUs. It is designed to be easy to use and highly scalable, making it a powerful tool for researchers and practitioners working with large-scale deep learning models.\n\nDeepSpeed is built on top of PyTorch, a popular deep learning framework, and provides a set of tools and libraries that make it easy to train large-scale models. It includes features such as zero-shot inference, which allows models to be used for inference without the need for retraining, and distributed training, which enables models to be trained across multiple GPUs.\n\nDeepSpeed is also',)


Stats:
--------------------------------------------------------------------------------------------------------------
Throughput (including tokenization) = 347.9053767194258 tokens/second
Number of HPU graphs                = 20
Memory allocated                    = 20.74 GB
Max memory allocated                = 20.82 GB
Total memory available              = 94.62 GB
Graph compilation duration          = 5.919518291004351 seconds
--------------------------------------------------------------------------------------------------------------

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?

@billishyahao billishyahao changed the title [Gemma2] Enable gemma2 on gaudi [Gemma 2] Enable gemma 2 on gaudi Aug 22, 2024
@billishyahao billishyahao changed the title [Gemma 2] Enable gemma 2 on gaudi [Gemma v2] Enable gemma v2 on gaudi Aug 22, 2024
@billishyahao billishyahao marked this pull request as ready for review August 22, 2024 08:05
Comment thread optimum/habana/transformers/models/gemma2/modeling_gemma2.py Outdated
Comment thread optimum/habana/transformers/models/gemma2/modeling_gemma2.py
@billishyahao
Copy link
Copy Markdown
Contributor Author

Fixed all comments @ssarkar2 feel free to review again.

@billishyahao
Copy link
Copy Markdown
Contributor Author

Rebase the patch to address the conflict wth main.

@billishyahao
Copy link
Copy Markdown
Contributor Author

@regisss Could you approve this ?

@billishyahao
Copy link
Copy Markdown
Contributor Author

Rebase the patch to address the conflict wth main at 11/13

@Luca-Calabria
Copy link
Copy Markdown
Contributor

Luca-Calabria commented Nov 13, 2024

Hi @billishyahao @libinta I would like to help merging this PR. It seems it needs just a rebase and if needed fixes after rebasing.

@emascarenhas
Copy link
Copy Markdown
Contributor

@ssarkar2 , You approved this PR earlier, so assuming this can go ahead now that it is rebased with latest habana-main branch?

@emascarenhas
Copy link
Copy Markdown
Contributor

@libinta , We could start run-test on this while we are waiting for Sayantan to confirm.

@libinta libinta added run-test Run CI for PRs from external contributors and removed review wip labels Nov 14, 2024
@nedo99
Copy link
Copy Markdown

nedo99 commented Nov 18, 2024

@regisss could we start the tests so we can merge this PR?

@github-actions
Copy link
Copy Markdown

The code quality check failed, please run make style.

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

@Luca-Calabria
Copy link
Copy Markdown
Contributor

As you can see I created a new PR #1504 as fork of this one to add the fixes on style. This because we don't have write access to this repo.

@emascarenhas
Copy link
Copy Markdown
Contributor

@Luca-Calabria , Please close this as it is no longer needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-test Run CI for PRs from external contributors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants