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

GPTQ model merged with LoRA become big size after merging #829

Closed
6 of 8 tasks
dahara111 opened this issue Nov 5, 2023 · 3 comments
Closed
6 of 8 tasks

GPTQ model merged with LoRA become big size after merging #829

dahara111 opened this issue Nov 5, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@dahara111
Copy link

dahara111 commented Nov 5, 2023

Please check that this issue hasn't been reported before.

  • I searched previous Bug Reports didn't find any similar reports.

Expected Behavior

If I create a LORA for a GPTQ model and merge it with the original GPTQ model, I should be able to create a model with approximately the same size.

Current behaviour

I used examples/llama-2/gptq-lora.yml.

After creating lora with reference to , I merged it with the following command.

CUDA_VISIBLE_DEVICES="" python3 -m axolotl.cli.merge_lora ../../gptq_qlora/axolotl/gptq-lora.yml --lora_model_dir="../../gptq_qlora/axolotl/checkpoint-800" --load_in_8bit=False --load_in_4bit=False

The original GPTQ version model is 3GB.
The created LoRA is 100MB (optimizer.pt + adapter_model.bin).
However, after merging LoRA, the size is 12.6G (pytorch_model-00001-of-00002.bin + pytorch_model-00002-of-00002.bin).
--load_in_4bit=True made no difference

Steps to reproduce

create lora from gptq model and merge with gptq model.

Config yaml

base_model: webbigdata/ALMA-7B-Ja-GPTQ-Ja-En
is_llama_derived_model: false
gptq: true
gptq_disable_exllama: true
model_type: AutoModelForCausalLM
tokenizer_type: AutoTokenizer
tokenizer_use_fast: true
tokenizer_legacy: true
trust_remote_code: true
load_in_8bit: false
load_in_4bit: false
strict: false
push_dataset_to_hub:
hf_use_auth_token: true
datasets:
  - path: alma-ja-v2_gptq/converted_file.jsonl
    type: alpaca
dataset_prepared_path:
val_set_size: 0.01
adapter: lora
lora_model_dir:
sequence_len: 4096
sample_packing:
lora_r: 8
lora_alpha: 32
lora_dropout: 0.05
lora_target_modules:
  - k_proj
  - o_proj
  - q_proj
  - v_proj
lora_target_linear:
lora_fan_in_fan_out:
wandb_project: test
wandb_watch:
wandb_run_id:
wandb_log_model:
output_dir: ./model-out
gradient_accumulation_steps: 2
micro_batch_size: 2
num_epochs: 4
optimizer: adamw_torch
adam_beta2: 0.95
adam_eps: 0.00001
max_grad_norm: 1.0
torchdistx_path:
lr_scheduler: cosine
lr_quadratic_warmup: true
learning_rate: 0.000017
train_on_inputs: false
group_by_length: false
bf16: true
fp16: false
float16: true
tf32: true
gradient_checkpointing: true
early_stopping_patience:
resume_from_checkpoint:
local_rank:
logging_steps: 1
xformers_attention:
flash_attention:
sdp_attention:
flash_optimum:
warmup_steps: 100
eval_steps: 50
save_steps: 200
debug:
deepspeed:
weight_decay: 0.1
special_tokens:
  bos_token: "<s>"
  eos_token: "</s>"
  unk_token: "<unk>"

Possible solution

No response

Which Operating Systems are you using?

  • Linux
  • macOS
  • Windows

Python Version

3.10

axolotl branch-commit

axolotl 0.3.0

Acknowledgements

  • My issue title is concise, descriptive, and in title casing.
  • I have searched the existing issues to make sure this bug has not been reported yet.
  • I am using the latest version of axolotl.
  • I have provided enough information for the maintainers to reproduce and diagnose the issue.
@dahara111 dahara111 added the bug Something isn't working label Nov 5, 2023
@Praful932
Copy link

Hi, afaik, merging isn't supported for gptq models - link

@webbigdata-jp
Copy link

@Praful932
Hi, Thank you very much.
Okay, So, if I want a single model that has been fine-tuned and GPTQ quantized,

Lora fine-tuning -> merge into one file -> GPTQ -> OK
GPTQ -> fine-tuning -> I can, but merging into one file is not supported.

@Foreist
Copy link

Foreist commented Dec 20, 2023

@Praful932 안녕하세요. 정말 감사합니다. 좋습니다. 미세 조정되고 GPTQ 양자화된 단일 모델을 원한다면

Lora 미세 조정 -> 하나의 파일로 병합 -> GPTQ -> OK GPTQ -> 미세 조정 -> 가능하지만 하나의 파일로 병합은 지원되지 않습니다.

Can anyone tell me how to apply GPTQ with axolotl after finetuning with LoRA and changing to a single file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants