Skip to content

Commit e799e23

Browse files
committed
Merge branch 'main' into schoi/gpt_oss
2 parents bd4a77d + 92b1579 commit e799e23

File tree

151 files changed

+6485
-5634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+6485
-5634
lines changed

Makefile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ slow_tests_8x: test_installs
101101
exit $$((status1 + status2))
102102

103103
# Run DeepSpeed non-regression tests
104-
slow_tests_deepspeed: test_installs
105-
python -m pip install git+https://github.com/HabanaAI/DeepSpeed.git@1.21.0
104+
slow_tests_deepspeed: test_installs install_deepspeed
106105
python -m pytest tests/test_examples.py -v -s -k "deepspeed"
107106

108107
slow_tests_diffusers: test_installs
@@ -113,10 +112,9 @@ slow_tests_sentence_transformers: test_installs
113112
python -m pytest tests/test_sentence_transformers.py -v -s
114113

115114
# Run all text-generation non-regression tests
116-
slow_tests_text_generation_example: test_installs
115+
slow_tests_text_generation_example: test_installs install_deepspeed
117116
python -m pip install -r examples/text-generation/requirements_awq.txt
118117
BUILD_CUDA_EXT=0 python -m pip install -vvv --no-build-isolation git+https://github.com/HabanaAI/AutoGPTQ.git
119-
python -m pip install git+https://github.com/HabanaAI/DeepSpeed.git@1.21.0
120118
python -m pip install tiktoken blobfile
121119
python -m pytest tests/test_text_generation_example.py tests/test_encoder_decoder.py -v -s --token $(TOKEN)
122120

@@ -127,18 +125,15 @@ slow_tests_text_generation_example_1x: test_installs
127125
python -m pytest tests/test_text_generation_example.py tests/test_encoder_decoder.py -m "(not x2) and (not x4) and (not x8)" -v -s --token $(TOKEN)
128126

129127
# Run subset of text-generation non-regression tests that require 2 Gaudi cards
130-
slow_tests_text_generation_example_2x: test_installs
131-
python -m pip install git+https://github.com/HabanaAI/DeepSpeed.git@1.21.0
128+
slow_tests_text_generation_example_2x: test_installs install_deepspeed
132129
python -m pytest tests/test_text_generation_example.py -m x2 -v -s --token $(TOKEN)
133130

134131
# Run subset of text-generation non-regression tests that require 4 Gaudi cards
135-
slow_tests_text_generation_example_4x: test_installs
136-
python -m pip install git+https://github.com/HabanaAI/DeepSpeed.git@1.21.0
132+
slow_tests_text_generation_example_4x: test_installs install_deepspeed
137133
python -m pytest tests/test_text_generation_example.py -m x4 -v -s --token $(TOKEN)
138134

139135
# Run subset of text-generation non-regression tests that require 8 Gaudi cards
140-
slow_tests_text_generation_example_8x: test_installs
141-
python -m pip install git+https://github.com/HabanaAI/DeepSpeed.git@1.21.0
136+
slow_tests_text_generation_example_8x: test_installs install_deepspeed
142137
python -m pytest tests/test_text_generation_example.py -m x8 -v -s --token $(TOKEN)
143138

144139
# Run image-to-text non-regression tests
@@ -225,3 +220,10 @@ clean:
225220

226221
test_installs:
227222
python -m pip install .[tests]
223+
224+
DEEPSPEED_SPEC ?= git+https://github.com/HabanaAI/DeepSpeed.git@1.21.0
225+
226+
install_deepspeed:
227+
@set -eu
228+
@echo "Installing DeepSpeed (customizable via DEEPSPEED_SPEC env var)"
229+
python -m pip install --upgrade --prefer-binary "$(DEEPSPEED_SPEC)"

conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import operator
44
import os
55
import sys
6+
import time
67
from pathlib import Path
78

89
import pytest
@@ -113,6 +114,14 @@ def token(request):
113114

114115

115116
def pytest_configure(config):
117+
junitxml_path = config.getoption("junitxml", None)
118+
junitxml_global_dir = os.getenv("JUNITXML_DIR", None)
119+
120+
if not junitxml_path and junitxml_global_dir:
121+
timestamp = time.strftime("%Y%m%d%H%M%S")
122+
os.makedirs(junitxml_global_dir, exist_ok=True)
123+
config.option.xmlpath = os.path.join(junitxml_global_dir, f"result_{timestamp}.xml")
124+
116125
# Bitsandbytes installation for {test_bnb_qlora.py test_bnb_inference.py} tests
117126
# This change will be reverted shortly
118127
bnb_tests = any("bnb" in name for name in config.known_args_namespace.file_or_dir)

examples/audio-classification/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ PT_HPU_LAZY_MODE=1 python run_audio_classification.py \
150150
$ apt install git-lfs
151151
```
152152

153-
2. Log in with your HuggingFace account credentials using `huggingface-cli`
153+
2. Log in with your HuggingFace account credentials using `hf`
154154

155155
```bash
156-
$ huggingface-cli login
156+
$ hf auth login
157157
# ...follow the prompts
158158
```
159159

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
datasets>=1.14.0
1+
datasets[audio]>=1.14.0
22
evaluate
33
numba==0.60.0
44
librosa

examples/audio-classification/run_audio_classification.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# coding=utf-8
32
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,8 +45,8 @@ def check_optimum_habana_min_version(*a, **b):
4645
logger = logging.getLogger(__name__)
4746

4847
# Will error if the minimal version of Transformers and Optimum Habana are not installed. Remove at your own risks.
49-
check_min_version("4.51.0")
50-
check_optimum_habana_min_version("1.18.0.dev0")
48+
check_min_version("4.55.0")
49+
check_optimum_habana_min_version("1.19.0.dev0")
5150

5251
require_version("datasets>=1.14.0", "To fix: pip install -r examples/pytorch/audio-classification/requirements.txt")
5352

@@ -159,7 +158,7 @@ class ModelArguments:
159158
metadata={
160159
"help": (
161160
"The token to use as HTTP bearer authorization for remote files. If not specified, will use the token "
162-
"generated when running `huggingface-cli login` (stored in `~/.huggingface`)."
161+
"generated when running `hf auth login` (stored in `~/.huggingface`)."
163162
)
164163
},
165164
)
@@ -391,7 +390,6 @@ def compute_metrics(eval_pred):
391390
revision=model_args.model_revision,
392391
token=model_args.token,
393392
trust_remote_code=model_args.trust_remote_code,
394-
attn_implementation=training_args.attn_implementation,
395393
)
396394
model = AutoModelForAudioClassification.from_pretrained(
397395
model_args.model_name_or_path,
@@ -402,6 +400,7 @@ def compute_metrics(eval_pred):
402400
token=model_args.token,
403401
trust_remote_code=model_args.trust_remote_code,
404402
ignore_mismatched_sizes=model_args.ignore_mismatched_sizes,
403+
attn_implementation=training_args.attn_implementation,
405404
)
406405

407406
# freeze the convolutional waveform encoder if supported by model

examples/contrastive-image-text/run_bridgetower.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# coding=utf-8
32
# Copyright 2023 The HuggingFace Team All rights reserved.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -58,8 +57,8 @@ def check_optimum_habana_min_version(*a, **b):
5857
logger = logging.getLogger(__name__)
5958

6059
# Will error if the minimal version of Transformers and Optimum Habana are not installed. Remove at your own risks.
61-
check_min_version("4.51.0")
62-
check_optimum_habana_min_version("1.18.0.dev0")
60+
check_min_version("4.55.0")
61+
check_optimum_habana_min_version("1.19.0.dev0")
6362

6463
require_version("datasets>=1.8.0", "To fix: pip install -r examples/pytorch/contrastive-image-text/requirements.txt")
6564

@@ -96,7 +95,7 @@ class ModelArguments:
9695
metadata={
9796
"help": (
9897
"The token to use as HTTP bearer authorization for remote files. If not specified, will use the token "
99-
"generated when running `huggingface-cli login` (stored in `~/.huggingface`)."
98+
"generated when running `hf auth login` (stored in `~/.huggingface`)."
10099
)
101100
},
102101
)

examples/contrastive-image-text/run_clip.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# coding=utf-8
32
# Copyright 2022 The HuggingFace Team All rights reserved.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -61,8 +60,8 @@ def check_optimum_habana_min_version(*a, **b):
6160
logger = logging.getLogger(__name__)
6261

6362
# Will error if the minimal version of Transformers and Optimum Habana are not installed. Remove at your own risks.
64-
check_min_version("4.51.0")
65-
check_optimum_habana_min_version("1.18.0.dev0")
63+
check_min_version("4.55.0")
64+
check_optimum_habana_min_version("1.19.0.dev0")
6665

6766
require_version("datasets>=1.8.0", "To fix: pip install -r examples/pytorch/contrastive-image-text/requirements.txt")
6867

@@ -99,7 +98,7 @@ class ModelArguments:
9998
metadata={
10099
"help": (
101100
"The token to use as HTTP bearer authorization for remote files. If not specified, will use the token "
102-
"generated when running `huggingface-cli login` (stored in `~/.huggingface`)."
101+
"generated when running `hf auth login` (stored in `~/.huggingface`)."
103102
)
104103
},
105104
)

examples/image-classification/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ dataset = load_dataset("imagefolder", data_files={"train": ["path/to/file1", "pa
143143
Next, push it to the hub!
144144

145145
```python
146-
# assuming you have ran the huggingface-cli login command in a terminal
146+
# assuming you have ran the hf auth login command in a terminal
147147
dataset.push_to_hub("name_of_your_dataset")
148148

149149
# if you want to push to a private repo, simply pass private=True:
@@ -166,10 +166,10 @@ $ git config --global user.email "you@example.com"
166166
$ git config --global user.name "Your Name"
167167
```
168168

169-
2. Log in with your HuggingFace account credentials using `huggingface-cli`:
169+
2. Log in with your HuggingFace account credentials using `hf`:
170170

171171
```bash
172-
$ huggingface-cli login
172+
$ hf auth login
173173
# ...follow the prompts
174174
```
175175

@@ -241,8 +241,8 @@ python ../gaudi_spawn.py \
241241
--do_eval \
242242
--learning_rate 2e-4 \
243243
--num_train_epochs 5 \
244-
--per_device_train_batch_size 128 \
245-
--per_device_eval_batch_size 64 \
244+
--per_device_train_batch_size 32 \
245+
--per_device_eval_batch_size 32 \
246246
--eval_strategy epoch \
247247
--save_strategy epoch \
248248
--load_best_model_at_end True \

examples/image-classification/run_image_classification.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# coding=utf-8
32
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -64,8 +63,8 @@ def check_optimum_habana_min_version(*a, **b):
6463
logger = logging.getLogger(__name__)
6564

6665
# Will error if the minimal version of Transformers and Optimum Habana are not installed. Remove at your own risks.
67-
check_min_version("4.51.0")
68-
check_optimum_habana_min_version("1.18.0.dev0")
66+
check_min_version("4.55.0")
67+
check_optimum_habana_min_version("1.19.0.dev0")
6968

7069
require_version("datasets>=2.14.0", "To fix: pip install -r examples/pytorch/image-classification/requirements.txt")
7170

@@ -165,7 +164,7 @@ class ModelArguments:
165164
metadata={
166165
"help": (
167166
"The token to use as HTTP bearer authorization for remote files. If not specified, will use the token "
168-
"generated when running `huggingface-cli login` (stored in `~/.huggingface`)."
167+
"generated when running `hf auth login` (stored in `~/.huggingface`)."
169168
)
170169
},
171170
)
@@ -294,7 +293,7 @@ def collate_fn(examples):
294293
return {"pixel_values": pixel_values, "labels": labels}
295294

296295
# If we don't have a validation split, split off a percentage of train as validation.
297-
data_args.train_val_split = None if "validation" in dataset.keys() else data_args.train_val_split
296+
data_args.train_val_split = None if "validation" in dataset else data_args.train_val_split
298297
if isinstance(data_args.train_val_split, float) and data_args.train_val_split > 0.0:
299298
split = dataset["train"].train_test_split(data_args.train_val_split)
300299
dataset["train"] = split["train"]

examples/image-to-text/run_image2text_lora_finetune.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def check_optimum_habana_min_version(*a, **b):
5555
logger = logging.getLogger(__name__)
5656

5757
# Will error if the minimal version of Optimum Habana is not installed. Remove at your own risks.
58-
check_optimum_habana_min_version("1.18.0.dev0")
58+
check_optimum_habana_min_version("1.19.0.dev0")
5959

6060

6161
def normalized_levenshtein(s1, s2):

0 commit comments

Comments
 (0)