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

运行python bert_example.py报错 #242

Open
Hap-Zhang opened this issue Jun 25, 2021 · 4 comments
Open

运行python bert_example.py报错 #242

Hap-Zhang opened this issue Jun 25, 2021 · 4 comments

Comments

@Hap-Zhang
Copy link

大家好,
我在hugging face上面下载了bert-base-uncased模型来测试bert_example.py脚本,操作完全按照TurboTransformers/example/python/README.md这个里面来操作,不过因为本地编译有问题,所以我这里用的是作者提供的编译好的镜像(docker pull thufeifeibear/turbo_transformers_cpu:latest),结果报以下错误:

Traceback (most recent call last):
File "", line 3, in
File "/opt/miniconda3/lib/python3.7/site-packages/turbo_transformers/layers/modeling_bert.py", line 495, in call
outputs = self.onnxmodel.run(inputs=data)
AttributeError: 'BertModelNoPooler' object has no attribute 'run'

请问有大佬遇到过类似问题吗,非常感谢各位的答复。

@feifeibear
Copy link
Collaborator

你在镜像里编译一下最新代码吧,你用的example代码是最新的,镜像里的代码不一定是。
你现在用turbo做backend,却用onnxrt的方式调用

https://github.com/Tencent/TurboTransformers/blob/f43f35b792/example/python/bert_example.py#L65

@Hap-Zhang
Copy link
Author

@feifeibear
您好,涉及到编译又会回到我在另一个issue里面遇到的问题,编译CPU版本一直会有报错,不知道该怎么解决呢

#238

@feifeibear
Copy link
Collaborator

feifeibear commented Jun 27, 2021

你要不直接用我提供的镜像试试?
FROM thufeifeibear/turbo_transformers_cpu:latest
在这个镜像里编译

你如果要自己从头开始编译,自己在container里看一下conda install哪个具体的包出问题,然后更改一下。

@Hap-Zhang
Copy link
Author

好的,在你的镜像里编译是没问题的,谢谢

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