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

lora微调模型合并时报错 #6578

Closed
1 task done
xiao-liya opened this issue Jan 9, 2025 · 2 comments
Closed
1 task done

lora微调模型合并时报错 #6578

xiao-liya opened this issue Jan 9, 2025 · 2 comments
Labels
solved This problem has been already solved

Comments

@xiao-liya
Copy link

Reminder

  • I have read the README and searched the existing issues.

System Info

不能正常运行 llamafactory-cli env
与运行合并命令出现的报错一致

Reproduction

Put your message here.

运行合并命令:CUDA_VISIBLE_DEVICES=2 llamafactory-cli export examples/merge_lora/llama3_lora_sft.yaml
出现以下报错
Traceback (most recent call last):
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/import_utils.py", line 106, in _get_module
return importlib.import_module("." + module_name, self.name)
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/trainer/dpo_trainer.py", line 56, in
from .callbacks import SyncRefModelCallback
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/trainer/callbacks.py", line 44, in
from .judges import BasePairwiseJudge
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/trainer/judges.py", line 32, in
from openai import OpenAI
ImportError: cannot import name 'OpenAI' from 'openai' (/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/openai/init.py)

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

Traceback (most recent call last):
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/import_utils.py", line 106, in _get_module
return importlib.import_module("." + module_name, self.name)
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/trainer/dpo_trainer.py", line 56, in
from .callbacks import SyncRefModelCallback
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/trainer/callbacks.py", line 44, in
from .judges import BasePairwiseJudge
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/trainer/judges.py", line 32, in
from openai import OpenAI
ImportError: cannot import name 'OpenAI' from 'openai' (/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/openai/init.py)

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

Traceback (most recent call last): [54/1973]
File "/home/ps/miniconda3/envs/llamafactory/bin/llamafactory-cli", line 5, in
from llamafactory.cli import main
File "/home/ps/proj/LLaMA-Factory/src/llamafactory/init.py", line 3, in
from .cli import VERSION
File "/home/ps/proj/LLaMA-Factory/src/llamafactory/cli.py", line 7, in
from . import launcher
File "/home/ps/proj/LLaMA-Factory/src/llamafactory/launcher.py", line 1, in
from llamafactory.train.tuner import run_exp
File "/home/ps/proj/LLaMA-Factory/src/llamafactory/train/tuner.py", line 11, in
from .dpo import run_dpo
File "/home/ps/proj/LLaMA-Factory/src/llamafactory/train/dpo/init.py", line 1, in
from .workflow import run_dpo
File "/home/ps/proj/LLaMA-Factory/src/llamafactory/train/dpo/workflow.py", line 11, in
from .trainer import CustomDPOTrainer
File "/home/ps/proj/LLaMA-Factory/src/llamafactory/train/dpo/trainer.py", line 9, in
from trl import DPOTrainer
File "", line 1075, in _handle_fromlist
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/import_utils.py", line 97, in getattr
value = getattr(module, name)
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/import_utils.py", line 96, in getattr
module = self._get_module(self._class_to_module[name])
File "/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/trl/import_utils.py", line 108, in _get_module
raise RuntimeError(
RuntimeError: Failed to import trl.trainer.dpo_trainer because of the following error (look up to see its traceback):
cannot import name 'OpenAI' from 'openai' (/home/ps/miniconda3/envs/llamafactory/lib/python3.10/site-packages/openai/init.py)

Others

No response

@github-actions github-actions bot added the pending This problem is yet to be addressed label Jan 9, 2025
@codemayq
Copy link
Collaborator

codemayq commented Jan 9, 2025

看着是 openai的版本问题, 升级一下试试
pip install -U openai

@xiao-liya
Copy link
Author

看着是 openai的版本问题, 升级一下试试 pip install -U openai

解决了,感谢!

@hiyouga hiyouga added solved This problem has been already solved and removed pending This problem is yet to be addressed labels Jan 9, 2025
@hiyouga hiyouga closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved This problem has been already solved
Projects
None yet
Development

No branches or pull requests

3 participants