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

LISA Finetuning Example #10743

Merged
merged 13 commits into from
Apr 18, 2024
Merged

LISA Finetuning Example #10743

merged 13 commits into from
Apr 18, 2024

Conversation

Jasonzzt
Copy link
Contributor

@Jasonzzt Jasonzzt commented Apr 11, 2024

Description

  • add an example of new fine-tuning algorithm on IPEX-LLM llama2 7b
    #nano

  • 'BF16Linear' object has no attribute 'enable_xetla', so 'enable_xetla' works only when q_proj.qtype == SYM_INT4/FP8E5

2. User API changes

How to run

python ./lisa_finetuning.py \
    --micro_batch_size 8 \
    --batch_size 128 \
    --base_model "/home/wangruonan/llm-models/Llama-2-70b-chat-hf" \
    --data_path "./alpaca_data_cleaned.json" \
    --output_dir "./ipex-llm-lisa-alpaca" \
    --gradient_checkpointing True \
    --lisa_activated_layers 1 \
    --lisa_interval_steps 20

3. Summary of the change

LISA Finetuning Example

4. How to test?

  • N/A
  • Unit test
  • Application test
  • Document test
  • ...

enable_xetla = self.q_proj.enable_xetla
if self.q_proj.qtype == SYM_INT4 or self.q_proj.qtype == FP8E5:
enable_xetla = self.q_proj.enable_xetla
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure other dtypes all do not need xetla?
maybe change else to elif BF16

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure other dtypes all do not need xetla? maybe change else to elif BF16

Here is the supported qtype of xetla.

supported_qtype = self.q_proj.qtype == SYM_INT4 and full_attn
supported_qtype = supported_qtype or self.q_proj.qtype == FP8E5

On XPU, the method returns True when q_proj.qtype is among supported_qtypes(SYM_INT4/FP8E5) and enable_xetla is True.

return device.type == "xpu" and enable_xetla and supported_qtype

So if qtype is other types, just set enable_xetla to False.

Copy link
Contributor

@Uxito-Ada Uxito-Ada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Uxito-Ada Uxito-Ada merged commit ff040c8 into intel-analytics:main Apr 18, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants