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

Error in example after installation #47

Open
Yonggie opened this issue Apr 30, 2023 · 1 comment
Open

Error in example after installation #47

Yonggie opened this issue Apr 30, 2023 · 1 comment

Comments

@Yonggie
Copy link

Yonggie commented Apr 30, 2023

Is there any glitch in the installation?

I'm using Ubuntu.

After

git clone https://github.com/IDEA-CCNL/Fengshenbang-LM.git
cd Fengshenbang-LM
pip install --editable ./

I copied the example code into a python file named nlp.py and tried to have a test

import argparse
from fengshen import UbertPiplines

total_parser = argparse.ArgumentParser("TASK NAME")
total_parser = UbertPiplines.piplines_args(total_parser)
args = total_parser.parse_args()
args.pretrained_model_path = 'IDEA-CCNL/Erlangshen-Ubert-110M-Chinese'  #预训练模型路径
test_data=[
    {
        "task_type": "抽取任务", 
        "subtask_type": "实体识别", 
        "text": "这也让很多业主据此认为,雅清苑是政府公务员挤对了国家的经适房政策。", 
        "choices": [ 
            {"entity_type": "小区名字"}, 
            {"entity_type": "岗位职责"}
            ],
        "id": 0}
]

model = UbertPiplines(args)
result = model.predict(test_data)
for line in result:
    print(line)

but got

Exception has occurred: ImportError cannot import name 'UbertPiplines' from 'fengshen' (/home/yinzecheng/ChP2020/Fengshenbang-LM/fengshen/__init__.py)   File "/home/yin/chp/process/nlp.py", line 2, in <module>     from fengshen import UbertPiplines ImportError: cannot import name 'UbertPiplines' from 'fengshen' (/home/yin/chp/Fengshenbang-LM/fengshen/__init__.py)7

My directory:
图片

After I tried to import the model as

from fengshen.models.ubert.modeling_ubert import UbertPiplines

the same error still exists.

@Yonggie
Copy link
Author

Yonggie commented Apr 30, 2023

Solved here: #48

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

1 participant