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

您好,当我运行adaptive-knn-mt中的build_datasotre.sh时,报No moudle named'knnbox' #29

Open
claire360 opened this issue Nov 20, 2023 · 12 comments

Comments

@claire360
Copy link

我什么也没改啊

image

@sxysxy
Copy link
Contributor

sxysxy commented Nov 20, 2023

请确认,在knnbox的根目录

pip install --editable ./

了吗:)

@claire360
Copy link
Author

您好,这个?
image

@claire360
Copy link
Author

image

@sxysxy
Copy link
Contributor

sxysxy commented Nov 20, 2023

看起来似乎是网络问题,下载knnbox的依赖失败了。挂个🪜试试

@claire360
Copy link
Author

好的,非常感谢🙇‍

@claire360
Copy link
Author

不好意思,在服务器上不好挂T,我就在本地安装,挂了T,但是还是报这样子的错误。
image

@sxysxy
Copy link
Contributor

sxysxy commented Nov 21, 2023

看截图你这本地用的是清华源,清华源就不用挂🪜了。
如果还不行,你可以打开setup.py看看knnbox的依赖项,然后手动用pip命令安装,然后最后pip install --editable ./ 再试试。

@claire360
Copy link
Author

您好,我安装了faiss-gpu,之前同时安装了faiss,会报错:AttributeError: module 'faiss' has no attribute 'read_index'。
我把faiss卸载了,会出现如下报错。请问一下怎么解决呢?
image
image

@claire360
Copy link
Author

我最后也用了 pip install --editable ./
image

@sxysxy
Copy link
Contributor

sxysxy commented Nov 21, 2023

AttributeError: module 'faiss' has no attribute 'read_index' 你可以提供一下报这个错误的代码的具体位置吗。我ctrl-f全局搜索了knn-box的源码并没有发现faiss.read_index的代码。

此外,我检查了一下我这边能正常运行的环境,我的faiss的版本是1.7.3

这是我的pip list的输出,可以参考:

(knn-box) ➜  knn-box git:(master) ✗ pip list 
Package                       Version            Editable project location
----------------------------- ------------------ -----------------------------
absl-py                       1.4.0
aiohttp                       3.8.6
aiosignal                     1.3.1
alabaster                     0.7.13
altair                        5.0.1
AMP                           1.1.4
antlr4-python3-runtime        4.9.3
anykeystore                   0.2
apex                          0.9.10.dev0
appdirs                       1.4.4
asgiref                       3.7.2
async-timeout                 4.0.3
asynctest                     0.13.0
attrs                         23.1.0
Babel                         2.12.1
backcall                      0.2.0
backports.zoneinfo            0.2.1
beautifulsoup4                4.12.2
bert-score                    0.3.13
blinker                       1.6.2
cachetools                    5.3.1
caldav                        0.1.4
cattrs                        23.1.2
certifi                       2023.7.22
cffi                          1.15.1
charset-normalizer            3.2.0
click                         8.1.6
colorama                      0.4.6
coverage                      7.2.7
cryptacular                   1.6.2
cycler                        0.11.0
Cython                        3.0.0
dataclasses                   0.6
decorator                     5.1.1
defusedxml                    0.7.1
Django                        3.2.20
docutils                      0.19
editdistance                  0.6.2
elastic-transport             8.4.0
elasticsearch                 8.8.2
esbonio                       0.16.1
exceptiongroup                1.1.2
fairseq                       0.10.1             /home/hfcloud/Program/knn-box
faiss                         1.7.3
fastBPE                       0.1.0
filelock                      3.12.2
fonttools                     4.38.0
frozenlist                    1.3.3
fsspec                        2023.1.0
fvcore                        0.1.5.post20221221
gdown                         4.7.1
gitdb                         4.0.10
GitPython                     3.1.32
google-api-core               2.11.1
google-auth                   2.22.0
google-auth-oauthlib          0.4.6
google-cloud-core             2.3.3
google-cloud-translate        3.11.2
googleapis-common-protos      1.59.1
greenlet                      2.0.2
grpcio                        1.56.2
grpcio-status                 1.56.2
huggingface-hub               0.16.4
hupper                        1.12
hydra-core                    1.3.2
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.7.0
importlib-resources           5.12.0
indicnlp                      0.0.1
iopath                        0.1.10
ipython                       7.34.0
jedi                          0.18.2
jieba                         0.42.1
Jinja2                        3.1.2
joblib                        1.3.1
jsonargparse                  3.13.1
jsonschema                    4.17.3
kiwisolver                    1.4.4
langid                        1.1.6
laserembeddings               1.1.2
lazy-property                 0.0.1
lsprotocol                    2023.0.0a2
lxml                          4.9.3
Markdown                      3.4.4
markdown-it-py                2.2.0
MarkupSafe                    2.1.3
matplotlib                    3.5.3
matplotlib-inline             0.1.6
mdurl                         0.1.2
mkl-fft                       1.3.1
mkl-random                    1.2.2
mkl-service                   2.4.0
mock                          5.1.0
more-itertools                10.0.0
multidict                     6.0.4
nltk                          3.8.1
nose                          1.3.7
numpy                         1.21.5
oauthlib                      3.2.2
omegaconf                     2.3.0
packaging                     23.1
pandas                        1.1.5
parso                         0.8.3
PasteDeploy                   3.0.1
pbkdf2                        1.3
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.5.0
pip                           22.3.1
pkgutil_resolve_name          1.3.10
plaster                       1.1.2
plaster-pastedeploy           1.0.1
portalocker                   2.0.0
prompt-toolkit                3.0.39
proto-plus                    1.22.3
protobuf                      3.20.1
ptyprocess                    0.7.0
py-rouge                      1.1
pyarrow                       12.0.1
pyasn1                        0.5.0
pyasn1-modules                0.3.0
pycparser                     2.21
pydeck                        0.8.1b0
pyDeprecate                   0.3.2
pygls                         1.0.2
Pygments                      2.15.1
Pympler                       1.0.1
pyparsing                     3.1.0
pyramid                       2.0.1
pyramid-mailer                0.15.1
pyrsistent                    0.19.3
PySocks                       1.7.1
pyspellchecker                0.7.2
pythainlp                     4.0.2
python-dateutil               2.8.2
python3-openid                3.2.0
pytorch-lightning             1.6.4
pytz                          2023.3
PyYAML                        6.0.1
regex                         2023.6.3
repoze.sendmail               4.4.1
requests                      2.31.0
requests-oauthlib             1.3.1
rich                          13.4.2
rsa                           4.9
sacrebleu                     2.3.1
sacremoses                    0.0.35
safetensors                   0.3.1
scikit-learn                  1.0.2
scipy                         1.7.3
seaborn                       0.12.1
semver                        3.0.1
sentencepiece                 0.1.99
setuptools                    65.6.3
six                           1.16.0
smmap                         5.0.0
snowballstemmer               2.2.0
soundfile                     0.12.1
soupsieve                     2.4.1
Sphinx                        5.3.0
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
SQLAlchemy                    2.0.19
sqlparse                      0.4.4
streamlit                     1.13.0
subword-nmt                   0.3.8
tabulate                      0.9.0
tensorboard                   2.11.2
tensorboard-data-server       0.6.1
tensorboard-plugin-wit        1.8.1
tensorboardX                  2.6.1
termcolor                     2.3.0
threadpoolctl                 3.1.0
tokenizers                    0.13.3
toml                          0.10.2
toolz                         0.12.0
torch                         1.10.0
torch-tb-profiler             0.4.1
torchmetrics                  0.8.2
tornado                       6.2
tqdm                          4.65.0
traitlets                     5.9.0
transaction                   3.1.0
transformers                  4.30.2
translationstring             1.4
transliterate                 1.10.2
typeguard                     3.0.2
typing_extensions             4.7.1
tzlocal                       5.0.1
unbabel-comet                 1.1.2
urllib3                       1.26.16
validators                    0.20.0
velruse                       1.1.1
venusian                      3.0.0
vizseq                        0.1.15
vobject                       0.9.6.1
watchdog                      3.0.0
wcwidth                       0.2.6
WebOb                         1.8.7
Werkzeug                      2.1.2
wheel                         0.38.4
WTForms                       3.0.1
wtforms-recaptcha             0.3.2
yacs                          0.1.8
yarl                          1.9.2
zipp                          3.15.0
zope.deprecation              5.0
zope.interface                6.0
zope.sqlalchemy               3.0

@claire360
Copy link
Author

太感谢了,终于好了!

@claire360
Copy link
Author

实在不好意思,再来打扰一下。
我想问问,为什么需要用faiss啊。我目前是就把key,value存储在txt文件里面,之后测试的时候就拿出来,和查询向量进行余弦相似度。如果用faiss,是能够更快的进行余弦相似度吗?我看见网上的都是说faiss能够更好的减小内存和更快,之后用各种的方式去查询。

还有一个问题关系adaptive-knn-mt,目前已经有一个训练好的模型了,我从这个模型里面得到了datastore,我需要动态的选择k。但是我之前的模型没有这个metaK网络层,所以我还是要重新的训练模型。在训练的时候要加上datastore里面的信息,这样子关于knn的lamuta不会变得很大吗?因为knn检索出来得就是很准确得了。

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