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

ls_bert运行报错 #148

Closed
js19950726 opened this issue Aug 10, 2021 · 16 comments
Closed

ls_bert运行报错 #148

js19950726 opened this issue Aug 10, 2021 · 16 comments

Comments

@js19950726
Copy link

我安装了lightseq==2.1.1

但是运行时
image

找了半天bert在哪也没找到,可以告诉我咋解决吗,还是我少了什么步骤

@js19950726
Copy link
Author

能不能贴一个运行流程?

@Taka152
Copy link
Contributor

Taka152 commented Aug 10, 2021

The pypi version hasn't update Bert support, you can build from source and try.
I'll try to release a new pypi version these days.

@js19950726
Copy link
Author

我就是从源代码python setup.py install的啊
pypi上的版本不是2.1.0嘛
我的是2.1.1

@Taka152
Copy link
Contributor

Taka152 commented Aug 10, 2021

pip install only install training module if inference module installation failed, you can add -v to verify that.

lightseq/setup.py

Lines 130 to 139 in a57966a

try:
setup(ext_modules=ext_modules, **setup_kwargs)
except Exception as e:
logger.warning(e)
logger.warning("The inference extension could not be compiled")
# If this new 'setup' call don't fail, the module
# will be successfully installed, without the C extension :
setup(**setup_kwargs)
logger.info("lightseq training installation succeeded.")

Check here to install inference env and run python setup.py install again.

@godweiyang
Copy link
Collaborator

我就是从源代码python setup.py install的啊
pypi上的版本不是2.1.0嘛
我的是2.1.1

We have updated the pypi version to 2.1.2. which includes the BERT inference. You can try again.

@ZTurboX
Copy link

ZTurboX commented Aug 11, 2021

我也遇到了这个问题,pypi version to 2.1.2也会报错

@Taka152
Copy link
Contributor

Taka152 commented Aug 11, 2021

2.1.2 works for me, could you share the error log?

@ZTurboX
Copy link

ZTurboX commented Aug 11, 2021

2.1.2 works for me, could you share the error log?

AttributeError: module 'lightseq.inference' has no attribute 'Bert'

@Taka152
Copy link
Contributor

Taka152 commented Aug 11, 2021

could you share the pip list version and your terminal screeshot

@ZTurboX
Copy link

ZTurboX commented Aug 11, 2021

could you share the pip list version and your terminal screeshot

image

@ZTurboX
Copy link

ZTurboX commented Aug 11, 2021

could you share the pip list version and your terminal screeshot

version = "2.1.2"

@Taka152
Copy link
Contributor

Taka152 commented Aug 11, 2021

Just want to make sure your pwd, this error may due to wrong package import, you can try running in different working directory

@ZTurboX
Copy link

ZTurboX commented Aug 12, 2021

pwd is correct

@godweiyang
Copy link
Collaborator

I try it successfully:

<Trial 3417505 worker_0> tiger $ pip3 install lightseq
Defaulting to user installation because normal site-packages is not writeable
Collecting lightseq
  Downloading lightseq-2.1.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (40.8 MB)
     |████████████████████████████████| 40.8 MB 106 kB/s 
Requirement already satisfied: ninja in /usr/local/lib/python3.7/dist-packages (from lightseq) (1.10.2)
Installing collected packages: lightseq
Successfully installed lightseq-2.1.2
<Trial 3417505 worker_0> tiger $ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lightseq.inference as lsi
>>> lsi.Bert
<class 'lightseq.inference.Bert'>

@js19950726
Copy link
Author

2.1.2 works for me, could you share the error log?

AttributeError: module 'lightseq.inference' has no attribute 'Bert'

你这个问题是因为里面有个叫lightseq的文件夹,你import的是文件夹而不是你安装的lightseq库,你可以在gpu上把lightseq文件夹删除就好了

@godweiyang
Copy link
Collaborator

2.1.2 works for me, could you share the error log?

AttributeError: module 'lightseq.inference' has no attribute 'Bert'

你这个问题是因为里面有个叫lightseq的文件夹,你import的是文件夹而不是你安装的lightseq库,你可以在gpu上把lightseq文件夹删除就好了

Another reason is that he directly clones and uses pip install -e . to install the source code, which will only install the training library for lack of inference environment. So we recommend installing by PyPi using pip install lightseq.

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