PaddlePaddle / PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
https://paddlenlp.readthedocs.io
Apache License 2.0
12.16k stars 2.94k forks source link

[Bug]: FileNotFoundError: configuration file<config.json> or <model_config.json> not found #5927

Open SolarKnight1 opened 1 year ago

SolarKnight1 commented 1 year ago

软件环境

- paddlepaddle:2.4.2 
- paddlepaddle-gpu:2.4.2 
- paddlenlp: 2.5.2

重复问题

错误描述

python finetune.py      --device gpu     --logging_steps 10     --save_steps 100     --eval_steps 100     --seed 1000     --model_name_or_path uie-base     --output_dir ./checkpoint/model_best     --train_path data/train.txt     --dev_path data/dev.txt      --max_seq_len 512      --per_device_train_batch_size  16     --per_device_eval_batch_size 16     --num_train_epochs 20     --learning_rate 1e-5     --do_train     --do_eval     --do_export     --export_model_dir ./checkpoint/model_best     --overwrite_output_dir     --disable_tqdm True     --metric_for_best_model eval_f1     --load_best_model_at_end  True     --save_total_limit 1
/root/anaconda3/envs/qihangf/lib/python3.9/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
[2023-05-16 13:50:27,919] [ WARNING] - evaluation_strategy reset to IntervalStrategy.STEPS for do_eval is True. you can also set evaluation_strategy='epoch'.
[2023-05-16 13:50:27,919] [    INFO] - The default value for the training argument `--report_to` will change in v5 (from all installed integrations to none). In v5, you will need to use `--report_to all` to get the same behavior as now. You should start updating your code and make this info disappear :-).
[2023-05-16 13:50:27,919] [    INFO] - ============================================================
[2023-05-16 13:50:27,919] [    INFO] -      Model Configuration Arguments      
[2023-05-16 13:50:27,919] [    INFO] - paddle commit id              :0e92adceae06b6b7463f2dc7790ffb0601730009
[2023-05-16 13:50:27,919] [    INFO] - export_model_dir              :./checkpoint/model_best
[2023-05-16 13:50:27,919] [    INFO] - model_name_or_path            :uie-base
[2023-05-16 13:50:27,919] [    INFO] - 
[2023-05-16 13:50:27,920] [    INFO] - ============================================================
[2023-05-16 13:50:27,920] [    INFO] -       Data Configuration Arguments      
[2023-05-16 13:50:27,920] [    INFO] - paddle commit id              :0e92adceae06b6b7463f2dc7790ffb0601730009
[2023-05-16 13:50:27,920] [    INFO] - dev_path                      :data/dev.txt
[2023-05-16 13:50:27,920] [    INFO] - dynamic_max_length            :None
[2023-05-16 13:50:27,920] [    INFO] - max_seq_len                   :512
[2023-05-16 13:50:27,920] [    INFO] - train_path                    :data/train.txt
[2023-05-16 13:50:27,920] [    INFO] - 
[2023-05-16 13:50:27,920] [ WARNING] - Process rank: -1, device: gpu, world_size: 1, distributed training: False, 16-bits training: False
Traceback (most recent call last):
  File "/tmp/pycharm_project_599/document/finetune.py", line 178, in <module>
    main()
  File "/tmp/pycharm_project_599/document/finetune.py", line 112, in main
    model = UIEX.from_pretrained(model_args.model_name_or_path)
  File "/root/anaconda3/envs/qihangf/lib/python3.9/site-packages/paddlenlp/transformers/model_utils.py", line 484, in from_pretrained
    return cls.from_pretrained_v2(
  File "/root/anaconda3/envs/qihangf/lib/python3.9/site-packages/paddlenlp/transformers/model_utils.py", line 1320, in from_pretrained_v2
    config, model_kwargs = cls.config_class.from_pretrained(
  File "/root/anaconda3/envs/qihangf/lib/python3.9/site-packages/paddlenlp/transformers/configuration_utils.py", line 735, in from_pretrained
    config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/root/anaconda3/envs/qihangf/lib/python3.9/site-packages/paddlenlp/transformers/configuration_utils.py", line 761, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(
  File "/root/anaconda3/envs/qihangf/lib/python3.9/site-packages/paddlenlp/transformers/configuration_utils.py", line 836, in _get_config_dict
    raise FileNotFoundError(f"configuration file<{CONFIG_NAME}> or <{LEGACY_CONFIG_NAME}> not found")
FileNotFoundError: configuration file<config.json> or <model_config.json> not found

我看有人也是这个问题,但我也没加--multilingual啊,求助

稳定复现步骤 & 代码

model = UIEX.from_pretrained(model_args.model_name_or_path)

Infinityay commented 1 year ago

我也是同样的报错

AKother commented 1 year ago

试一下导入正确的finetune.py

f549263766 commented 1 year ago

用uie-x-base也是同样的报错

stgg0049 commented 1 year ago

可能是搞错了finetune.py,用 ./document/finetune.py, 不是 ./text/finetune.py

用uie-x-base也是同样的报错

zhaoqf-cq commented 1 year ago

可能是搞错了finetune.py,用 ./document/finetune.py, 不是 ./text/finetune.py

用uie-x-base也是同样的报错

个人觉得 document 是 文档信息抽取的微调, txt是文本信息抽取的吧

lurga commented 1 year ago

@zhaoqf-cq @qihangf 我也碰到同样的问题,后来换成了PaddleNLP/model_zoo/uie/finetune.py,就没问题了