Skip to content

Commit

Permalink
bugfix for qlora finetuning on GPU (intel-analytics#12298)
Browse files Browse the repository at this point in the history
* bugfix for qlora 100 step error

* indent fix

* annotation fix
  • Loading branch information
JinheTang authored Oct 30, 2024
1 parent 70037ad commit 46d8300
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ pip install bitsandbytes scipy
source /opt/intel/oneapi/setvars.sh # necessary to run before installing deepspeed
pip install git+https://github.com/microsoft/DeepSpeed.git@78c518e
pip install git+https://github.com/intel/intel-extension-for-deepspeed.git@ec33277
# (optional) install mpirun to run multi-card finetuning
sudo apt install openmpi-bin
```

### 2. Configures OneAPI environment variables
Expand Down
8 changes: 6 additions & 2 deletions python/llm/src/ipex_llm/transformers/low_bit_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,12 @@ def forward(self, x: torch.Tensor):
self.weight.qtype, input_seq_size)
result = result.to(x.dtype)
else:
result = xe_linear.forward_new(x_2d, self.weight.data,
self.weight.qtype, input_seq_size)
if self.weight.qtype == NF4:
result = xe_linear.forward_new(x_2d, self.weight.data.view(torch.uint8),
self.weight.qtype, input_seq_size)
else:
result = xe_linear.forward_new(x_2d, self.weight.data,
self.weight.qtype, input_seq_size)

if do_empty_cache:
torch.xpu.empty_cache()
Expand Down

0 comments on commit 46d8300

Please sign in to comment.