lm-sys / lm-sys/FastChat

"FAILED: cpu_adam.so " when I use LoRA to train the model😭😭😭

Open
#3,424 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.5k
Forks
4.8k
PR merge metrics
No merged PRs in 30d

Description

When I run

deepspeed fastchat/train/train_lora.py     --model_name_or_path /root/autodl-tmp/cjk/Fast-Chat-main/Codellama-7B     --lora_r 16     --lora_alpha 16     --lora_dropout 0.05     --data_path /root/autodl-tmp/cjk/Fast-Chat-main/data/Tool_ReAct_train_bird_Qshot.json     --bf16 True     --output_dir ./checkpoints     --num_train_epochs 8     --per_device_train_batch_size 1     --per_device_eval_batch_size 1     --gradient_accumulation_steps 1     --evaluation_strategy "no"     --save_strategy "steps"     --save_steps 1200     --save_total_limit 100     --learning_rate 2e-4     --weight_decay 0.     --warmup_ratio 0.03     --lr_scheduler_type "cosine"     --logging_steps 1     --tf32 True     --model_max_length 4096     --q_lora True     --deepspeed playground/deepspeed_config_s2.json

I got the error below:

FAILED: cpu_adam.so 
c++ cpu_adam.o cpu_adam_impl.o -shared -lcurand -L/root/miniconda3/envs/fastchat/lib/python3.10/site-packages/torch/lib -lc10 -ltorch_cpu -ltorch -ltorch_python -o cpu_adam.so
/usr/bin/ld: cannot find -lcurand: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/root/miniconda3/envs/fastchat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2107, in _run_ninja_build
    subprocess.run(
  File "/root/miniconda3/envs/fastchat/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/autodl-tmp/cjk/Fast-Chat-main/fastchat/train/train_lora.py", line 44, in <module>
    deepspeed.ops.op_builder.CPUAdamBuilder().load()
  File "/root/miniconda3/envs/fastchat/lib/python3.10/site-packages/deepspeed/ops/op_builder/builder.py", line 508, in load
    return self.jit_load(verbose)
  File "/root/miniconda3/envs/fastchat/lib/python3.10/site-packages/deepspeed/ops/op_builder/builder.py", line 555, in jit_load
    op_module = load(name=self.name,
  File "/root/miniconda3/envs/fastchat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1309, in load
    return _jit_compile(
  File "/root/miniconda3/envs/fastchat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1719, in _jit_compile
    _write_ninja_file_and_build_library(
  File "/root/miniconda3/envs/fastchat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1832, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "/root/miniconda3/envs/fastchat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2123, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'cpu_adam'

Here are some information on my device:

PyTorch  2.1.0
Python  3.10(ubuntu22.04)
Cuda  12.1

And I was strictly following the step in README, and those packages were all installed sucessfully, who can help me😭😭😭

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at fastchat/train/train_lora.py, especially the deepspeed.ops.op_builder.CPUAdamBuilder().load() call, and reproduce the command using playground/deepspeed_config_s2.json. Inspect the reported linker failure for the missing libcurand dependency and the stated PyTorch, Python, CUDA, and Ubuntu versions; done means the CPUAdam extension builds and LoRA training starts successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch, ubuntu
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.