THUDM / ChatGLM3

ChatGLM3 series: Open Bilingual Chat LLMs | 开源双语对话语言模型
Apache License 2.0
13.5k stars 1.57k forks source link

第一次尝试 github 中 lora_finetune.ipynb 微调示例,未执行成功,报以下错误,请问如何解决? #1277

Open thomasyyang opened 5 months ago

thomasyyang commented 5 months ago

System Info / 系統信息

Cuda版本:cu118
transformers版本:4.30.2
Python版本:3.10.6
Operating System: CentOS Linux 7 (Core)
硬件:NVIDIA 1张A100-40G 18核CPU 92G内存

Who can help? / 谁可以帮助到您?

@Btlmd

Information / 问题信息

Reproduction / 复现过程

1. 执行命令:

CUDA_VISIBLE_DEVICES=0 NCCL_P2P_DISABLE="1" NCCL_IB_DISABLE="1" python finetune_hf.py data/AdvertiseGen_fix /home/notebook/toG_RMM/MHRED/chatglm3-6b configs/lora.yaml

2. 输出信息:

NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last): File "/opt/notebook/toG_RMM/MHRED/ChatGLM3-main/finetune_demo/finetune_hf.py", line 11, in
import torch
File "/home/conda/envs/python3.10.6/lib/python3.10/site-packages/torch/init.py", line 1382, in
from .functional import * # noqa: F403
File "/home/conda/envs/python3.10.6/lib/python3.10/site-packages/torch/functional.py", line 7, in
import torch.nn.functional as F
File "/home/conda/envs/python3.10.6/lib/python3.10/site-packages/torch/nn/init.py", line 1, in
from .modules import * # noqa: F403
File "/home/conda/envs/python3.10.6/lib/python3.10/site-packages/torch/nn/modules/init.py", line 35, in
from .transformer import TransformerEncoder, TransformerDecoder,
File "/home/conda/envs/python3.10.6/lib/python3.10/site-packages/torch/nn/modules/transformer.py", line 20, in
device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'),
/home/conda/envs/python3.10.6/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:84.)
device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'),
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /opt/notebook/toG_RMM/MHRED/ChatGLM3-main/finetune_demo/ │
│ finetune_hf.py:458 in main │
│ │
│ 455 │ │ ), │
│ 456 │
│ 457 ): │
│ ❱ 458 │ ft_config = FinetuningConfig.from_file(config_file) │
│ 459 │ tokenizer, model = load_tokenizer_and_model(model_dir, peft_config=ft_config.peft_co │
│ 460 │ data_manager = DataManager(data_dir, ft_config.data_config) │
│ 461 │
│ │
│ /opt/notebook/toG_RMM/MHRED/ChatGLM3-main/finetune_demo/ │
│ finetune_hf.py:209 in from_file │
│ │
│ 206 │ def from_file(cls, path: Union[str, Path]) -> 'FinetuningConfig': │
│ 207 │ │ path = _resolve_path(path) │
│ 208 │ │ kwargs = _get_yaml_parser().load(path) │
│ ❱ 209 │ │ return cls.from_dict(**kwargs) │
│ 210 │
│ 211 │
│ 212 def _load_datasets( │
│ │
│ /opt/notebook/toG_RMM/MHRED/ChatGLM3-main/finetune_demo/ │
│ finetune_hf.py:194 in from_dict │
│ │
│ 191 │ │ │ │ training_args['generation_config'] = GenerationConfig( │
│ 192 │ │ │ │ │ **gen_config │
│ 193 │ │ │ │ ) │
│ ❱ 194 │ │ │ kwargs['training_args'] = Seq2SeqTrainingArguments(**training_args) │
│ 195 │ │ │
│ 196 │ │ data_config = kwargs.get('data_config') │
│ 197 │ │ if not isinstance(data_config, DataConfig): │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: Seq2SeqTrainingArguments.init() got an unexpected keyword argument 'use_cpu'

Expected behavior / 期待表现

希望 lora_finetune.ipynb 能够顺利运营通过!

Docnoah commented 4 months ago

同问,我也是这个问题