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

代码复现失败 #7

Open
sore-2001 opened this issue May 20, 2024 · 6 comments
Open

代码复现失败 #7

sore-2001 opened this issue May 20, 2024 · 6 comments

Comments

@sore-2001
Copy link

python3.8.18按照要求安装对应版本的库报错如下:
File "train.py", line 116, in
model = BartSeq2SeqModel.build_model(args.bart_name, tokenizer, label_ids=label_ids, decoder_type=args.decoder_type,
File "/data0/pjy_data/zqz/GMNER/model/bart_multi_concat.py", line 275, in build_model
model = BartModel.from_pretrained(bart_model)
File "/data0/pjy_data/anaconda/envs/zqzpy3.8/lib/python3.8/site-packages/transformers/modeling_utils.py", line 935, in from_pretrained
raise EnvironmentError(msg)
OSError: Can't load weights for 'facebook/bart-base'. Make sure that:

  • 'facebook/bart-base' is a correct model identifier listed on 'https://huggingface.co/models'

  • or 'facebook/bart-base' is the correct path to a directory containing a file named one of pytorch_model.bin, tf_model.h5, model.ckpt.

尝试在train.py 加入代码
import os
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com' 未成功

将模型拷入本地,在train.sh中修改模型地址也未成功
求解答,谢谢

@lxystaruni
Copy link

你好,我也在复现作者的代码。将模型拷入本地后,在train.sh中修改“--bart_name facebook/bart-base“为”--bart_name ./pretrained_model/bart-base“应该可以解决这个问题。

@sore-2001
Copy link
Author

sore-2001 commented May 21, 2024 via email

@lxystaruni
Copy link

或许你可以检查一下模型路径是否正确,或者bart-base文件夹下的配置文件是否完整。

@sore-2001
Copy link
Author

或许你可以检查一下模型路径是否正确,或者bart-base文件夹下的配置文件是否完整。

在删除源代码,重新搭建模型后解决上述问题。但是现在又面临报错
image
我并未修改项目,不知道如何解决

@zyLiRere
Copy link
Collaborator

#2 (comment)

看到之前好像已经有类似的问题已被解决,您可以尝试一下

@xiaoding06
Copy link

您好这个图片上的问题您解决了吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants