Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
c1154b2
Release: v1.10.0
regisss Jan 26, 2024
90aa87f
Fix tests (#669)
ssarkar2 Jan 30, 2024
a91559d
Add Flan T5 to model table (#677)
regisss Feb 1, 2024
3bc80cc
Bring back workaround for Falcon with SynapseAI 1.13 (#685)
regisss Feb 3, 2024
6d6facd
Fix version check when console output is disabled (#688)
vidyasiv Feb 7, 2024
f68950b
Patch for Gaudi Text-Generation Pipeline (#690)
sjagtap1803 Feb 7, 2024
f508f20
Updated requirements for image-classification samples: datasets>=2.14…
alekseyfa Feb 11, 2024
58c4ea1
Add ControlNet Pipeline (#585)
nngokhale Jan 30, 2024
52d6c34
Change capture logic for HPU graphs in Diffusers pipelines (#679)
regisss Feb 2, 2024
6feb65a
Update example diff file for image classification (#703)
regisss Feb 12, 2024
ab61473
Upgrade to Transformers 4.37 (#651)
regisss Feb 12, 2024
3c40b89
Add instruction in README to checkout latest stable release (#705)
regisss Feb 12, 2024
a26d748
Release: v1.10.1
regisss Feb 12, 2024
94b1c6f
Update diff file (#706)
regisss Feb 13, 2024
202f040
To fix LLAMA-V2-70B-FT-HF (8x) for eager mode (#709)
mkumargarg Feb 14, 2024
188b09e
Adding a flag whether to save checkpoint or not in run_clm.py (#711)
yeonsily Feb 14, 2024
d5926f3
Pin Accelerate (#714)
regisss Feb 15, 2024
09de214
Change for R1.10.2 (#719)
libinta Feb 17, 2024
a6a88fa
Release: v1.10.2
regisss Feb 17, 2024
a9f8ac3
Fix Llama initialization (#712)
regisss Feb 17, 2024
ee7a0b3
Release: v1.10.3
regisss Feb 18, 2024
0e56c6b
Expose Llama Fused OPs control from run_lora_clm.py (#23)
Feb 7, 2024
6fea7b8
enable internal kv bucket in llama (#24)
xt574chen Feb 8, 2024
50c3d13
[SW-173358] add first token prints (#18)
shakkedw Feb 8, 2024
92e4f64
Enable Flash Attention in recompute and causal modes (#21)
wszczurekhabana Feb 8, 2024
763f609
Fix inference command clip-roberta (#31)
MohitIntel Feb 8, 2024
5169c64
Changing backend name (#32)
Feb 9, 2024
ef718ba
enable falcon-180b inference (#15)
schoi-habana Feb 12, 2024
e0d1de5
Add support for safetensors and sharded checkpoints (#25)
tjs-intel Feb 13, 2024
9f1db3d
Update ckpt loading (#38)
schoi-habana Feb 14, 2024
b2f27ea
Further fixes for performance with internal bucketing. (#36)
Feb 16, 2024
4e0d220
Update llama-7b command to include eval (#43)
jiminha Feb 16, 2024
581606f
[BridgeTower] Fix for NoneType in clip mediapipe (#45)
MohitIntel Feb 16, 2024
4cf8089
Enable Llama2 70B to run with hqt on single card (#50)
Yantom1 Feb 20, 2024
60f9819
Fixing tests by making static_shapes False (#60)
Feb 22, 2024
0079ad0
Change check to False explicitly for use_fused_rope (#62)
hlahkar Feb 23, 2024
42f3797
change quant conf example to use act_maxabs_pow2_weights_pcs_opt_pow2…
dudilester Feb 25, 2024
106439c
llama fp8 - enable non reuse cache flow for fp8 (#64)
bgoldberg-habana Feb 26, 2024
552ede0
Set _use_sdpa to False to disable torch sdpa (#73)
hlahkar Feb 26, 2024
9e2a440
Fix Llama-70B-FSDP model loading issue (#63)
hlahkar Feb 26, 2024
0e9b631
Enable torch_compile mode for distributed (#659) (#58)
kalyanjk Feb 26, 2024
68d65c2
Fix for NaN loss in bridgetower (#77)
MohitIntel Feb 26, 2024
8c0b87a
Remove usage of clear cache (#74)
Feb 27, 2024
04b0709
Adding a flag whether to save checkpoint or not after the training in…
yeonsily Feb 27, 2024
eb37ddc
Rename whitelist & blacklist (#71)
nirda7 Feb 28, 2024
67794c6
Cherry-pick SDXL fine tuning (#81)
yeonsily Feb 28, 2024
89f837d
Upate stdxl train script with dev_ae_stdxl_ft a70a903 (#83)
yeonsily Feb 29, 2024
725a6a3
Add mark step and inplace residual add in llama model code to reduce …
Feb 29, 2024
9ce93f5
enable hpu_graph support for wav2vec2-asr (#59)
Feb 29, 2024
d9a6752
Clean-up BERT-BASE FSDP test (#82)
Feb 29, 2024
7bbd2ed
Fix BART inference failure due to attn_implementation initialization …
Mar 2, 2024
348e8be
extend bucket_internal to SAMPLE generation mode (#84)
xt574chen Mar 2, 2024
eec5b3f
Split the graphs to run with flash_attention on 1x (#75)
kalyanjk Mar 4, 2024
1cd773d
Disable SDPA Attention for gpt-bigcode model (#78)
jiminha Mar 5, 2024
0cbbb8d
Fix graph breaks in torch compile mode (#61)
scsudhak-intel Mar 5, 2024
3cea518
enable Mixtral-8x7B (#89)
yeonsily Mar 6, 2024
9f1da84
Disable SDPA attention layer for mistral and gpt_bigode (#88)
jiminha Mar 6, 2024
735f2cf
Upmerge dev_ae_stdxl_ft change to habana-main (#93)
yeonsily Mar 6, 2024
05735e5
Run custom ctc_loss only for Gaudi2 (#95)
Mar 7, 2024
ef5c9be
add quantization config example including measure of output tensors (…
dudilester Mar 7, 2024
11d6696
Add warmup step feature support for inference (#98)
ANSHUMAN87 Mar 12, 2024
328ba32
fix quantization config example typo (#100)
dudilester Mar 12, 2024
93eeebd
add ENABLE_CONST_MARKING flag in OH (#101)
Yantom1 Mar 12, 2024
d984ded
Enable Falcon FP8 inference (#94)
schoi-habana Mar 13, 2024
abc26a8
Added additional check to run with distributed enabled and world_siz…
kalyanjk Mar 14, 2024
35361d3
Sarkar/mediapipe sdxl (#99)
ssarkar2 Mar 14, 2024
ae7fc93
move img_mask@get_attn_mask() to hpu (#102)
hsubramony Mar 14, 2024
aff4544
Block torchscript pytest because of seg fault issue (#103)
yeonsily Mar 14, 2024
5e13763
sasarkar/minor_fixes_sdxl (#110)
ssarkar2 Mar 14, 2024
a48afa1
sarkar/mistral optimizations (#112)
ssarkar2 Mar 15, 2024
4936b64
Minor fix (#114)
ssarkar2 Mar 17, 2024
aa64051
Fixed const serialization path call to bridge (#115)
HolyFalafel Mar 17, 2024
ea38ffb
Added additional check to run with distributed enabled and world_siz…
kalyanjk Mar 18, 2024
83baf2f
add falcon180b FP8 test (#104)
schoi-habana Mar 19, 2024
d1fb6ad
Update README.md (#119)
ssarkar2 Mar 19, 2024
b54249f
sarkar/Fix barrier (#124)
ssarkar2 Mar 20, 2024
a01d175
Add mark_step only for inference (#126)
kalyanjk Mar 21, 2024
de9a56b
Fix for view+inplace error from Falcon (#127)
schoi-habana Mar 21, 2024
7a02a80
added text-generation quantization_config example file with a name th…
dudilester Mar 21, 2024
b7e74c1
Encapsulate FSDPA in GaudiLlamaAttention (#129)
dudilester Mar 24, 2024
7043900
enforce recompute flag on fsdpa quantization (#133)
dudilester Mar 28, 2024
8c0231a
Fixed the issue that can't take profile with 1st step. (#135)
hsubramony Mar 29, 2024
3536005
Fix get_dtype and convert_into_dtypes (#769)
IT-Forrest Mar 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ REAL_CLONE_URL = $(if $(CLONE_URL),$(CLONE_URL),$(DEFAULT_CLONE_URL))

# Run code quality checks
style_check: clean
pip install -U pip ruff
ruff check . setup.py
ruff format --check . setup.py

style: clean
pip install -U pip ruff
ruff check . setup.py --fix
ruff format . setup.py

Expand Down Expand Up @@ -53,8 +55,11 @@ slow_tests_deepspeed: test_installs
python -m pytest tests/test_examples.py -v -s -k "deepspeed"

slow_tests_diffusers: test_installs
python -m pip install git+https://github.com/huggingface/diffusers.git
python -m pytest tests/test_diffusers.py -v -s -k "test_no_"
python -m pytest tests/test_diffusers.py -v -s -k "test_textual_inversion"
python -m pip install peft==0.7.0
python -m pytest tests/test_diffusers.py -v -s -k "test_train_text_to_image_"

# Run text-generation non-regression tests
slow_tests_text_generation_example: test_installs
Expand Down Expand Up @@ -109,4 +114,3 @@ clean:

test_installs:
python -m pip install .[tests]
python -m pip install git+https://github.com/huggingface/accelerate.git
48 changes: 31 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,45 @@ Check out [this blog post about BERT pre-training](https://huggingface.co/blog/p
If you are not familiar with HPUs and would like to know more about them, we recommend you take a look at [our conceptual guide](https://huggingface.co/docs/optimum/habana/concept_guides/hpu).


## Install
To install the latest stable release of this package:
## Install the library and get example scripts

```bash
pip install --upgrade-strategy eager optimum[habana]
```
### Option 1: Use the latest stable release

The `--upgrade-strategy eager` option is needed to ensure `optimum-habana` is upgraded to the latest stable release.

> To use DeepSpeed on HPUs, you also need to run the following command:
To install the latest stable release of this package
>```bash
>pip install git+https://github.com/HabanaAI/DeepSpeed.git@1.14.0
>pip install --upgrade-strategy eager optimum[habana]
>```

Optimum Habana is a fast-moving project, and you may want to install it from source:
The `--upgrade-strategy eager` option is needed to ensure `optimum-habana` is upgraded to the latest stable release.

To use the example associated with the latest stable release, run:
> ```
> git clone https://github.com/huggingface/optimum-habana
> cd optimum-habana && git checkout v1.10.2
> ```
> with `v1.10.2` the version number of this release.

### Option 2: Use the latest main branch under development

Optimum Habana is a fast-moving project, and you may want to install it from source and get the latest scripts :

```bash
pip install git+https://github.com/huggingface/optimum-habana.git
git clone https://github.com/huggingface/optimum-habana
```

Last but not least, don't forget to install the requirements for every example:
## Install dependencies

```bash
cd <example-folder>
pip install -r requirements.txt
```
To use DeepSpeed on HPUs, you also need to run the following command:
>```bash
>pip install git+https://github.com/HabanaAI/DeepSpeed.git@1.14.0
>```

To install the requirements for every example:
>```bash
>cd <example-folder>
>pip install -r requirements.txt
>```


## How to use it?
Expand Down Expand Up @@ -164,11 +177,12 @@ The following model architectures, tasks and device distributions have been vali
| OPT | | <div style="text-align:left"><li>DeepSpeed</li></div> | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| Llama 2 / CodeLlama | <div style="text-align:left"><li>DeepSpeed</li><li>LoRA</li></div> | :heavy_check_mark: | <li>[language modeling](https://github.com/huggingface/optimum-habana/tree/main/examples/language-modeling)</li><li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| StableLM | | <div style="text-align:left"><li>Single card</li></div> | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| Falcon | <div style="text-align:left"><li>LoRA</li></div> | :heavy_check_mark: | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| Falcon | <div style="text-align:left"><li>LoRA</li></div> | :heavy_check_mark: | <li>[language modeling](https://github.com/huggingface/optimum-habana/tree/main/examples/language-modeling)</li><li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| CodeGen | | <div style="text-align:left"><li>Single card</li></div> | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| MPT | | <div style="text-align:left"><li>Single card</li></div> | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| Mistral | | <div style="text-align:left"><li>Single card</li></div> | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| T5 | :heavy_check_mark: | :heavy_check_mark: | <li>[summarization](https://github.com/huggingface/optimum-habana/tree/main/examples/summarization)</li><li>[translation](https://github.com/huggingface/optimum-habana/tree/main/examples/translation)</li><li>[question answering](https://github.com/huggingface/optimum-habana/tree/main/examples/question-answering#fine-tuning-t5-on-squad20)</li> |
| Mixtral | | <div style="text-align:left"><li>Single card</li></div> | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| T5 / Flan T5 | :heavy_check_mark: | :heavy_check_mark: | <li>[summarization](https://github.com/huggingface/optimum-habana/tree/main/examples/summarization)</li><li>[translation](https://github.com/huggingface/optimum-habana/tree/main/examples/translation)</li><li>[question answering](https://github.com/huggingface/optimum-habana/tree/main/examples/question-answering#fine-tuning-t5-on-squad20)</li> |
| BART | | <div style="text-align:left"><li>Single card</li></div> | <li>[summarization](https://github.com/huggingface/optimum-habana/tree/main/examples/summarization)</li><li>[translation](https://github.com/huggingface/optimum-habana/tree/main/examples/translation)</li><li>[question answering](https://github.com/huggingface/optimum-habana/tree/main/examples/question-answering#fine-tuning-t5-on-squad20)</li> |
| ViT | :heavy_check_mark: | :heavy_check_mark: | <li>[image classification](https://github.com/huggingface/optimum-habana/tree/main/examples/image-classification)</li> |
| Swin | :heavy_check_mark: | :heavy_check_mark: | <li>[image classification](https://github.com/huggingface/optimum-habana/tree/main/examples/image-classification)</li> |
Expand Down
3 changes: 2 additions & 1 deletion docs/source/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ In the tables below, ✅ means single-card, multi-card and DeepSpeed have all be
| CodeGen | | <div style="text-align:left"><li>Single card</li></div> | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| MPT | | <div style="text-align:left"><li>Single card</li></div> | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| Mistral | | <div style="text-align:left"><li>Single card</li></div> | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| T5 | ✅ | ✅ | <li>[summarization](https://github.com/huggingface/optimum-habana/tree/main/examples/summarization)</li><li>[translation](https://github.com/huggingface/optimum-habana/tree/main/examples/translation)</li><li>[question answering](https://github.com/huggingface/optimum-habana/tree/main/examples/question-answering#fine-tuning-t5-on-squad20)</li> |
| Mixtral | | <div style="text-align:left"><li>Single card</li></div> | <li>[text generation](https://github.com/huggingface/optimum-habana/tree/main/examples/text-generation)</li> |
| T5 / Flan T5 | ✅ | ✅ | <li>[summarization](https://github.com/huggingface/optimum-habana/tree/main/examples/summarization)</li><li>[translation](https://github.com/huggingface/optimum-habana/tree/main/examples/translation)</li><li>[question answering](https://github.com/huggingface/optimum-habana/tree/main/examples/question-answering#fine-tuning-t5-on-squad20)</li> |
| BART | | <div style="text-align:left"><li>Single card</li></div> | <li>[summarization](https://github.com/huggingface/optimum-habana/tree/main/examples/summarization)</li><li>[translation](https://github.com/huggingface/optimum-habana/tree/main/examples/translation)</li><li>[question answering](https://github.com/huggingface/optimum-habana/tree/main/examples/question-answering#fine-tuning-t5-on-squad20)</li> |
| ViT | ✅ | ✅ | <li>[image classification](https://github.com/huggingface/optimum-habana/tree/main/examples/image-classification)</li> |
| Swin | ✅ | ✅ | <li>[image classification](https://github.com/huggingface/optimum-habana/tree/main/examples/image-classification)</li> |
Expand Down
1 change: 1 addition & 0 deletions examples/audio-classification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The following examples showcase how to fine-tune `Wav2Vec2` for audio classifica

Speech recognition models that have been pretrained in an unsupervised fashion on audio data alone, *e.g.* [Wav2Vec2](https://huggingface.co/transformers/main/model_doc/wav2vec2.html), have shown to require only very little annotated data to yield good performance on speech classification datasets.


## Single-HPU

The following command shows how to fine-tune [wav2vec2-base](https://huggingface.co/facebook/wav2vec2-base) on the 🗣️ [Keyword Spotting subset](https://huggingface.co/datasets/superb#ks) of the SUPERB dataset on a single HPU.
Expand Down
4 changes: 2 additions & 2 deletions examples/audio-classification/run_audio_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def check_optimum_habana_min_version(*a, **b):
logger = logging.getLogger(__name__)

# Will error if the minimal version of Transformers and Optimum Habana are not installed. Remove at your own risks.
check_min_version("4.34.0")
check_optimum_habana_min_version("1.8.1")
check_min_version("4.37.0")
check_optimum_habana_min_version("1.10.0")

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

Expand Down
5 changes: 4 additions & 1 deletion examples/contrastive-image-text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,8 @@ python run_clip.py \
--use_lazy_mode \
--use_hpu_graphs_for_inference \
--gaudi_config_name Habana/clip \
--bf16
--bf16 \
--mediapipe_dataloader
```

> `--mediapipe_dataloader` only works on Gaudi2.
60 changes: 26 additions & 34 deletions examples/contrastive-image-text/clip_media_pipe.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,37 @@

try:
from habana_frameworks.mediapipe import fn
from habana_frameworks.mediapipe.backend.nodes import opnode_tensor_info
from habana_frameworks.mediapipe.backend.operator_specs import schema
from habana_frameworks.mediapipe.media_types import dtype, ftype, imgtype, randomCropType, readerOutType
from habana_frameworks.mediapipe.mediapipe import MediaPipe
from habana_frameworks.mediapipe.operators.media_nodes import MediaReaderNode
from habana_frameworks.mediapipe.operators.reader_nodes.read_image_from_dir import get_max_file
from habana_frameworks.mediapipe.operators.reader_nodes.reader_nodes import (
media_ext_reader_op_impl,
media_ext_reader_op_tensor_info,
)
from habana_frameworks.torch.hpu import get_device_name
except ImportError:
pass

read_image_text_from_dataset_params = {
"label_dtype": dtype.UINT32,
"dataset": None,
}


class read_image_text_from_dataset(MediaReaderNode):
class read_image_text_from_dataset(media_ext_reader_op_impl):
"""
Class defining read image/text from directory node.
Class defining read image/text from clip dataset.

"""

def __init__(self, name, guid, device, inputs, params, cparams, node_attr):
super().__init__(name, guid, device, inputs, params, cparams, node_attr)
def __init__(self, params):
self.batch_size = 1
params = params["priv_params"]
self.meta_dtype = params["label_dtype"]
self.dataset = params["dataset"]
self.epoch = 0

self.batch_sampler_iter = None
self.iter_loc = 0
self.num_imgs_slice = len(ClipMediaPipe.batch_sampler.sampler)
self.num_batches_slice = len(ClipMediaPipe.batch_sampler)

Expand All @@ -62,13 +70,13 @@ def set_params(self, params):

def gen_output_info(self):
out_info = []
o = opnode_tensor_info(dtype.NDT, np.array([self.batch_size], dtype=np.uint32), "")
o = media_ext_reader_op_tensor_info(dtype.NDT, np.array([self.batch_size], dtype=np.uint32), "")
out_info.append(o)
o = opnode_tensor_info(
o = media_ext_reader_op_tensor_info(
self.meta_dtype, np.array([self.dataset.text_max_length, self.batch_size], dtype=np.uint32), ""
)
out_info.append(o)
o = opnode_tensor_info(
o = media_ext_reader_op_tensor_info(
self.meta_dtype, np.array([self.dataset.text_max_length, self.batch_size], dtype=np.uint32), ""
)
out_info.append(o)
Expand Down Expand Up @@ -112,27 +120,6 @@ def __next__(self):
return img_list, input_id_list, attention_mask_list


read_image_text_from_dataset_params = {
"label_dtype": dtype.UINT64,
"dataset": None,
}
schema.add_operator(
"ClipDataReader",
None,
0,
0,
[],
3,
read_image_text_from_dataset_params,
None,
read_image_text_from_dataset,
dtype.NDT,
)
op_class = fn.operator_add("ClipDataReader")
op_class.__module__ = fn.__name__
setattr(fn, "ClipDataReader", op_class)


class ClipMediaPipe(MediaPipe):
"""
Class defining clip media pipe:
Expand Down Expand Up @@ -160,8 +147,13 @@ def __init__(self, dataset=None, sampler=None, batch_size=512, drop_last=False,
super(ClipMediaPipe, self).__init__(
device=self.device, batch_size=batch_size, prefetch_depth=queue_depth, pipe_name=pipe_name
)

self.input = fn.ClipDataReader(label_dtype=dtype.UINT32, dataset=self.dataset)
params = read_image_text_from_dataset_params.copy()
params["dataset"] = self.dataset
self.input = fn.MediaExtReaderOp(
impl=read_image_text_from_dataset,
num_outputs=3,
priv_params=params,
)
def_output_image_size = [self.image_size, self.image_size]
res_pp_filter = ftype.BICUBIC
self.decode = fn.ImageDecoder(
Expand Down
4 changes: 2 additions & 2 deletions examples/contrastive-image-text/run_bridgetower.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def check_optimum_habana_min_version(*a, **b):
logger = logging.getLogger(__name__)

# Will error if the minimal version of Transformers and Optimum Habana are not installed. Remove at your own risks.
check_min_version("4.34.0")
check_optimum_habana_min_version("1.8.1")
check_min_version("4.37.0")
check_optimum_habana_min_version("1.10.0")

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

Expand Down
4 changes: 2 additions & 2 deletions examples/contrastive-image-text/run_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def check_optimum_habana_min_version(*a, **b):
logger = logging.getLogger(__name__)

# Will error if the minimal version of Transformers and Optimum Habana are not installed. Remove at your own risks.
check_min_version("4.34.0")
check_optimum_habana_min_version("1.8.1")
check_min_version("4.37.0")
check_optimum_habana_min_version("1.10.0")

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

Expand Down
2 changes: 1 addition & 1 deletion examples/image-classification/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
torch>=1.5.0
torchvision>=0.6.0
datasets>=2.4.0
datasets>=2.14.0
evaluate
scikit-learn
6 changes: 3 additions & 3 deletions examples/image-classification/run_image_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ def check_optimum_habana_min_version(*a, **b):
logger = logging.getLogger(__name__)

# Will error if the minimal version of Transformers and Optimum Habana are not installed. Remove at your own risks.
check_min_version("4.34.0")
check_optimum_habana_min_version("1.8.1")
check_min_version("4.37.0")
check_optimum_habana_min_version("1.10.0")

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

MODEL_CONFIG_CLASSES = list(MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING.keys())
MODEL_TYPES = tuple(conf.model_type for conf in MODEL_CONFIG_CLASSES)
Expand Down
14 changes: 11 additions & 3 deletions examples/language-modeling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ python3 run_lora_clm.py \
--max_grad_norm 0.3 \
--logging_steps 1 \
--do_train \
--do_eval \
--use_habana \
--use_lazy_mode \
--throughput_warmup_steps 3 \
Expand All @@ -380,6 +381,7 @@ python3 run_lora_clm.py \
--dataset_concatenation \
--max_seq_length 512 \
--low_cpu_mem_usage True \
--validation_split_percentage 4 \
--adam_epsilon 1e-08
```

Expand Down Expand Up @@ -414,7 +416,8 @@ LOWER_LIST=ops_bf16.txt python3 run_lora_clm.py \
--max_seq_length 256 \
--low_cpu_mem_usage True \
--adam_epsilon 1e-08 \
--do_eval
--do_eval \
--validation_split_percentage 5
```

- Multi-card finetuning of Llama1-7B:
Expand All @@ -436,6 +439,7 @@ python ../gaudi_spawn.py \
--max_grad_norm 0.3 \
--logging_steps 1 \
--do_train \
--do_eval \
--use_habana \
--use_lazy_mode \
--throughput_warmup_steps 3 \
Expand All @@ -447,6 +451,7 @@ python ../gaudi_spawn.py \
--max_seq_length 512 \
--ddp_bucket_cap_mb 50 \
--adam_epsilon 1e-08 \
--validation_split_percentage 4 \
--low_cpu_mem_usage True
```

Expand Down Expand Up @@ -512,7 +517,8 @@ LOWER_LIST=ops_bf16.txt python3 ../gaudi_spawn.py \
--ddp_bucket_cap_mb 50 \
--adam_epsilon 1e-08 \
--do_eval \
--low_cpu_mem_usage True
--low_cpu_mem_usage True \
--validation_split_percentage 6
```

- Multi-card finetuning of Llama2-70B with DeepSpeed ZeRO-3 optimization and LoRA:
Expand Down Expand Up @@ -550,7 +556,8 @@ python3 ../gaudi_spawn.py --use_deepspeed --world_size 8 run_lora_clm.py \
--lora_rank 4 \
--lora_target_modules "q_proj" "v_proj" "k_proj" "o_proj" \
--validation_split_percentage 4 \
--use_flash_attention True
--use_flash_attention True \
--flash_attention_causal_mask True
```

- Multi-card finetuning of Falcon-180B:
Expand Down Expand Up @@ -587,6 +594,7 @@ DEEPSPEED_HPU_ZERO3_SYNC_MARK_STEP_REQUIRED=1 LOWER_LIST=ops_bf16.txt python3 ..
--max_seq_length 256 \
--adam_epsilon 1e-08 \
--do_eval \
--validation_split_percentage 5 \
--deepspeed ds_falcon_180b_z3.json
```
## Streaming
Expand Down
10 changes: 7 additions & 3 deletions examples/language-modeling/run_clm.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def check_optimum_habana_min_version(*a, **b):
logger = logging.getLogger(__name__)

# Will error if the minimal version of Transformers and Optimum Habana are not installed. Remove at your own risks.
check_min_version("4.34.0")
check_optimum_habana_min_version("1.8.1")
check_min_version("4.37.0")
check_optimum_habana_min_version("1.10.0")

require_version("datasets>=1.8.0", "To fix: pip install -r examples/pytorch/language-modeling/requirements.txt")

Expand Down Expand Up @@ -243,6 +243,9 @@ class DataTrainingArguments:
keep_linebreaks: bool = field(
default=True, metadata={"help": "Whether to keep line breaks when using TXT files or not."}
)
save_last_ckpt: bool = field(
default=True, metadata={"help": "Whether to save checkpoint at the end of the training."}
)

def __post_init__(self):
if self.streaming:
Expand Down Expand Up @@ -643,7 +646,8 @@ def compute_metrics(eval_preds):
elif last_checkpoint is not None:
checkpoint = last_checkpoint
train_result = trainer.train(resume_from_checkpoint=checkpoint)
trainer.save_model() # Saves the tokenizer too for easy upload
if data_args.save_last_ckpt:
trainer.save_model() # Saves the tokenizer too for easy upload

metrics = train_result.metrics

Expand Down
Loading