hiyouga / LLaMA-Factory

Unify Efficient Fine-Tuning of 100+ LLMs
Apache License 2.0
25.52k stars 3.16k forks source link

[bug] unsloth坏了 #4593

Closed letterk closed 5 days ago

letterk commented 5 days ago

Reminder

System Info

llamafactory-cli env [2024-06-28 02:51:51,234] [INFO] [real_accelerator.py:203:get_accelerator] Setting ds_accelerator to cuda (auto detect) [WARNING] Please specify the CUTLASS repo directory as environment variable $CUTLASS_PATH [WARNING] sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.3 [WARNING] using untested triton version (2.3.0), only 1.0.0 is known to be compatible

Reproduction

### model
model_name_or_path: /home/kissoul/WORKDIR/hf/Qwen/Qwen2-1.5B-Instruct
flash_attn: fa2
use_unsloth: true

### method
stage: dpo
do_train: true
finetuning_type: lora
lora_rank: 128
lora_alpha: 192
lora_dropout: 0.05
lora_target: all
pref_loss: simpo  # choices: [sigmoid (dpo), orpo, simpo]
pref_beta: 2.0
simpo_gamma: 1.4

loraplus_lr_ratio: 20

pissa_init: true
pissa_iter: 16
pissa_convert: true

### dataset
dataset_dir: dataset
dataset: transl_dpo_100k
template: qwen
cutoff_len: 1024
# max_samples: 1000
packing: True
# overwrite_cache: true
preprocessing_num_workers: 6
buffer_size: 1.0e12
tokenized_path: dataset/tokenized/transl_dpo_100k

### output
output_dir: saves/Qwen2-1.5B-Instruct/pissa/simpo
logging_steps: 10
save_steps: 500
plot_loss: true
overwrite_output_dir: true
load_best_model_at_end: True
save_total_limit: 5
include_num_input_tokens_seen: True

### train
per_device_train_batch_size: 1
gradient_accumulation_steps: 8
gradient_checkpointing: true
gradient_checkpointing_kwargs: 
  use_reentrant: False
learning_rate: 1.0e-6
num_train_epochs: 3.0
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: true
# ddp_timeout: 180000000

### eval
val_size: 0.1
per_device_eval_batch_size: 1
eval_strategy: steps
eval_steps: 500
Traceback (most recent call last):
  File "/home/kissoul/miniconda3/envs/lf/bin/llamafactory-cli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/kissoul/WORKDIR/LLaMA-Factory/src/llamafactory/cli.py", line 111, in main
    run_exp()
  File "/home/kissoul/WORKDIR/LLaMA-Factory/src/llamafactory/train/tuner.py", line 56, in run_exp
    run_dpo(model_args, data_args, training_args, finetuning_args, callbacks)
  File "/home/kissoul/WORKDIR/LLaMA-Factory/src/llamafactory/train/dpo/workflow.py", line 45, in run_dpo
    model = load_model(tokenizer, model_args, finetuning_args, training_args.do_train)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kissoul/WORKDIR/LLaMA-Factory/src/llamafactory/model/loader.py", line 139, in load_model
    model = load_unsloth_pretrained_model(config, model_args)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kissoul/WORKDIR/LLaMA-Factory/src/llamafactory/model/model_utils/unsloth.py", line 53, in load_unsloth_pretrained_model
    from unsloth import FastLanguageModel
  File "/home/kissoul/WORKDIR/unsloth/unsloth/__init__.py", line 26, in <module>
    raise ImportError(f"Unsloth: Please import Unsloth before {module}.")
ImportError: Unsloth: Please import Unsloth before bitsandbytes.

Expected behavior

最新主分支

Others

No response

hiyouga commented 5 days ago

reinstall unsloth: https://github.com/unslothai/unsloth