PaddleNLP icon indicating copy to clipboard operation
PaddleNLP copied to clipboard

[Bug]: GPTModel.from_pretrained() 加载仅有 config 无权重文件模型 "gpt2-small-en" 报错 FileNotFoundError

Open Yam0214 opened this issue 3 years ago • 1 comments

软件环境

- paddlepaddle-gpu: 2.3.2.post116
- paddlenlp: 2.4.0

重复问题

  • [X] I have searched the existing issues

错误描述

当使用 `GPTModel.from_pretrained("gpt2-small-en")`时无法创建模型,报错:

FileNotFoundError: [Errno 2] No such file or directory: '/home/username/.paddlenlp/models/gpt2-small-en/model_config.json'

而事实上在该目录下,连 gpt2-small-en 文件夹也没有创建。

更新 paddlenlp 版本至 2.4.1 也不能解决该问题。

稳定复现步骤 & 代码

首先删除本地已有的文件夹

rm -rf ~/.paddlenlp/models/gpt2-small-en

然后运行以下脚本

from paddlenlp.transformers import GPTModel

gpt = GPTModel.from_pretrained("gpt2-small-en")

Yam0214 avatar Oct 18 '22 09:10 Yam0214

当前 gpt2-small-en 模型是一个 CE 随机模型,仅有设置 pretrained_init_configuration 而无 pretrained_resource_files_map,@guoshengCS @wj-Mcat 看看 from_pretrained() 的是否有相关修改删除了这个功能。

FrostML avatar Oct 18 '22 10:10 FrostML

This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

github-actions[bot] avatar Dec 18 '22 00:12 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。

github-actions[bot] avatar Jan 01 '23 00:01 github-actions[bot]