From b8f35dcf348e07bdfd77c6f623e185d52b07b586 Mon Sep 17 00:00:00 2001 From: "Lv, Kaokao" Date: Fri, 10 May 2024 17:06:58 +0800 Subject: [PATCH] add optimum-habana installation. --- .../lm_evaluation_harness/lm_eval/models/huggingface.py | 3 +++ README.md | 3 +++ 2 files changed, 6 insertions(+) diff --git a/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/huggingface.py b/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/huggingface.py index 7b8babb2..a0d4af51 100644 --- a/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/huggingface.py +++ b/GenAIEval/evaluation/lm_evaluation_harness/lm_eval/models/huggingface.py @@ -1276,6 +1276,9 @@ class GaudiHFModelAdapter(HFLM): def __init__(self, *args, **kwargs): if kwargs["device"] == "hpu": import habana_frameworks.torch.core as htcore + # Tweak generation so that it runs faster on Gaudi + from optimum.habana.transformers.modeling_utils import adapt_transformers_to_gaudi + adapt_transformers_to_gaudi() super().__init__(*args, **kwargs) diff --git a/README.md b/README.md index 1e28cfd4..7f100963 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ For evaluating the models on text-generation tasks, we follow the [lm-evaluation ##### Gaudi2 ```shell + +# pip install --upgrade-strategy eager optimum[habana] + python main.py \ --model gaudi-hf \ --model_args pretrained=EleutherAI/gpt-j-6B \