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

运行download.py出现的错误 #1

Open
NingYueran opened this issue May 10, 2023 · 2 comments
Open

运行download.py出现的错误 #1

NingYueran opened this issue May 10, 2023 · 2 comments

Comments

@NingYueran
Copy link

您好,想问一下,我在运行python download.py的时候出现如下错误:
raceback (most recent call last):
File "download.py", line 2, in
import pathlib
ValueError: source code string cannot contain null bytes
该如何解决?谢谢您
修改了好几次都不对,还是报这个错误。

@guanqun-yang
Copy link
Owner

guanqun-yang commented May 17, 2023

I'm sorry, I can't type Chinese on my school workstation.
Can you instead run the following (it is a part of download.py)?

from transformers import AutoConfig, AutoTokenizer, AutoModelForTokenClassification

model_name = "bert-base-uncased"

config = AutoConfig.from_pretrained(model_name, num_labels=3)
model = AutoModelForTokenClassification.from_pretrained(model_name, config=config)
tokenizer = AutoTokenizer.from_pretrained(model_name)

@NingYueran
Copy link
Author

Teacher, thank you very much for your answer. Now download.py can run normally.
But there is a new problem, Can you provide me with the function create json file?
Traceback (most recent call last):
File "tl_agg.py", line 289, in
prepare_data(dataset)
File "/root/FewVulnerability/transfer_learning/../utils/bert.py", line 114, in prepare_data
record_list = create_json_file(df.loc[idx])
NameError: name 'create_json_file' is not defined

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

2 participants