Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gemma QLoRA example #12969

Merged
merged 3 commits into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions python/llm/example/GPU/LLM-Finetuning/QLoRA/alpaca-qlora/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ To run this example with IPEX-LLM on Intel GPUs, we have some recommended requir

### 1. Install

For Gemma-2B, directly start from [here](README.md#3-qlora-finetune).

```bash
conda create -n llm python=3.11
conda activate llm
Expand Down Expand Up @@ -171,6 +173,35 @@ bash qlora_finetune_qwen15_7b_arc_1_card.sh

</details>

<details>
<summary> Show Gemma-2B example </summary>

##### 1. Install

```bash
conda create -n llm python=3.11
conda activate llm
# below command will install intel_extension_for_pytorch==2.1.10+xpu as default
pip install --pre --upgrade ipex-llm[xpu] --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/
pip install datasets
pip install transformers==4.38.1
pip install accelerate==0.27.2
pip install bitsandbytes==0.45.3
```
##### 2. Configures OneAPI environment variables

```bash
source /opt/intel/oneapi/setvars.sh
```

##### 3. Run on A770

```bash
bash qlora_finetune_gemma_2b_arc_1_card.sh
```

</details>

<details>
<summary> Show Baichuan2-7B examples </summary>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# 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
python ./alpaca_qlora_finetuning.py \
--base_model "google/gemma-2b-it" \
--data_path "yahma/alpaca-cleaned" \
--output_dir "./ipex-llm-qlora-alpaca"