Skip to content

Commit cd109bb

Browse files
Uxito-Adasgwhat
andauthoredMar 14, 2025··
Gemma QLoRA example (#12969)
* Gemma QLoRA example * Update README.md * Update README.md --------- Co-authored-by: sgwhat <[email protected]>
1 parent 8bc41c1 commit cd109bb

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
 

‎python/llm/example/GPU/LLM-Finetuning/QLoRA/alpaca-qlora/README.md

+31
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ To run this example with IPEX-LLM on Intel GPUs, we have some recommended requir
1010

1111
### 1. Install
1212

13+
For Gemma-2B, directly start from [here](README.md#3-qlora-finetune).
14+
1315
```bash
1416
conda create -n llm python=3.11
1517
conda activate llm
@@ -171,6 +173,35 @@ bash qlora_finetune_qwen15_7b_arc_1_card.sh
171173

172174
</details>
173175

176+
<details>
177+
<summary> Show Gemma-2B example </summary>
178+
179+
##### 1. Install
180+
181+
```bash
182+
conda create -n llm python=3.11
183+
conda activate llm
184+
# below command will install intel_extension_for_pytorch==2.1.10+xpu as default
185+
pip install --pre --upgrade ipex-llm[xpu] --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/
186+
pip install datasets
187+
pip install transformers==4.38.1
188+
pip install accelerate==0.27.2
189+
pip install bitsandbytes==0.45.3
190+
```
191+
##### 2. Configures OneAPI environment variables
192+
193+
```bash
194+
source /opt/intel/oneapi/setvars.sh
195+
```
196+
197+
##### 3. Run on A770
198+
199+
```bash
200+
bash qlora_finetune_gemma_2b_arc_1_card.sh
201+
```
202+
203+
</details>
204+
174205
<details>
175206
<summary> Show Baichuan2-7B examples </summary>
176207

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Copyright 2016 The BigDL Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
# You could also specify `--base_model` to the local path of the huggingface model checkpoint folder and `--data_path` to the local path of the dataset JSON file
18+
python ./alpaca_qlora_finetuning.py \
19+
--base_model "google/gemma-2b-it" \
20+
--data_path "yahma/alpaca-cleaned" \
21+
--output_dir "./ipex-llm-qlora-alpaca"

0 commit comments

Comments
 (0)
Please sign in to comment.