OpenAccess-AI-Collective / axolotl

Go ahead and axolotl questions
https://openaccess-ai-collective.github.io/axolotl/
Apache License 2.0
6.83k stars 749 forks source link

Can't load BnB models #1513

Open Blaizzy opened 2 months ago

Blaizzy commented 2 months ago

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

Expected Behavior

I want to load a BnB quantized model.

Current behaviour

It throws a ValueError.

Steps to reproduce

Launch the config yaml.

Config yaml

base_model: unsloth/tinyllama-bnb-4bit
model_type: LlamaForCausalLM
tokenizer_type: LlamaTokenizer
is_llama_derived_model: true

load_in_8bit: false
load_in_4bit: true
strict: false

datasets:
  - path: HuggingFaceH4/ultrachat_200k
    split: train_sft
    type: sharegpt
    conversation: chatml

dataset_prepared_path:
val_set_size: 0.05
output_dir: ./qlora-out

adapter: qlora
lora_model_dir:

sequence_len: 1096
sample_packing: true
pad_to_sequence_len: true

lora_r: 32
lora_alpha: 16
lora_dropout: 0.05
lora_target_modules:
lora_target_linear: true
lora_fan_in_fan_out:

wandb_project: axolotl
wandb_entity:
wandb_watch:
wandb_name: tinyllama
wandb_log_model:

gradient_accumulation_steps: 1
micro_batch_size: 1
max_steps: 20
optimizer: paged_adamw_32bit
lr_scheduler: cosine
learning_rate: 0.0002

train_on_inputs: false
group_by_length: false
bf16: false
fp16: true
tf32: false

gradient_checkpointing: true
early_stopping_patience:
resume_from_checkpoint:
local_rank:
logging_steps: 1
xformers_attention:
flash_attention: false

warmup_steps: 10
evals_per_epoch:
saves_per_epoch:
debug:
deepspeed:
weight_decay: 0.0
fsdp:
fsdp_config:
special_tokens:
  eos_token: "<|im_end|>"

tokens:
- "<|im_start|>"

Possible solution

Extend or remove the fixed check of gptq introduced here: https://github.com/OpenAccess-AI-Collective/axolotl/pull/913

Which Operating Systems are you using?

Python Version

3.10

axolotl branch-commit

main

Acknowledgements

NanoCode012 commented 2 months ago

More details regarding error please. Were you also the one who posted a bnb issue on discord?

tsunayoshi21 commented 1 week ago

Any new update regarding this error? I have a similar issue

Blaizzy commented 1 week ago

@NanoCode012

Could you let me know what else are you looking for?

NanoCode012 commented 1 week ago

Could someone post logs of the issue? Is it due to the check of quant_config?

Blaizzy commented 1 week ago

Ayt, got it!

I will post the logs later today

tsunayoshi21 commented 1 week ago

@NanoCode012 Yes, for me the error is that the check of quant_config always raises a error because the quant_method is not gptq, and if i set gptq:false in the yaml, it raises a error that says i can't load a quantized model without gptq.

So if my model is previously BnB quantized i have no clue of how i can finetune with axolotl