-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
.add_faiss_index and .add_elasticsearch_index returns ImportError at Google Colab #7456
Comments
I can fix this. |
I think I just had no chance to meet with faiss-cpu. |
Yes you can't meet the requirements because faiss-cpu runs only on
python3.10 and lower but the default version for colab is python3.11 which
results in pip not being able to find wheels for faiss-cpu with python3.11.
…On Mon, 17 Mar, 2025, 3:56 pm MapleBloom, ***@***.***> wrote:
I think I just had no chance to meet with faiss-cpu.
It could be import problem?
_has_faiss gets its value at the beginning of datasets/search.
I tried to call object before import faiss, so _has_faiss took False. And
never updated later.
—
Reply to this email directly, view it on GitHub
<#7456 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVUSZMBVD7LEDDUGALOTVN32U2PMBAVCNFSM6AAAAABZDBA426VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRYHE3TKNRXGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
[image: MapleBloom]*MapleBloom* left a comment (huggingface/datasets#7456)
<#7456 (comment)>
I think I just had no chance to meet with faiss-cpu.
It could be import problem?
_has_faiss gets its value at the beginning of datasets/search.
I tried to call object before import faiss, so _has_faiss took False. And
never updated later.
—
Reply to this email directly, view it on GitHub
<#7456 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVUSZMBVD7LEDDUGALOTVN32U2PMBAVCNFSM6AAAAABZDBA426VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRYHE3TKNRXGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
It is not the case (or I didn't reach this point) because the same code in notebook |
When you run the first cell containing pip install faiss-cpu does it
install it?
…On Mon, 17 Mar, 2025, 8:01 pm MapleBloom, ***@***.***> wrote:
you can't meet the requirements
It is not the case (or I didn't reach this point) because the same code in
notebook
importlib.util.find_spec("faiss")
finds faiss. I've mention it.
I think the problem is in the very moment when _has_faiss takes its value
and never try again.
(or it couldn't find the path that was easily found when started from my
code)
—
Reply to this email directly, view it on GitHub
<#7456 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVUSZMCCE6BPZCOVAWXKIY32U3MFVAVCNFSM6AAAAABZDBA426VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRZG4ZTONBRGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
[image: MapleBloom]*MapleBloom* left a comment (huggingface/datasets#7456)
<#7456 (comment)>
you can't meet the requirements
It is not the case (or I didn't reach this point) because the same code in
notebook
importlib.util.find_spec("faiss")
finds faiss. I've mention it.
I think the problem is in the very moment when _has_faiss takes its value
and never try again.
(or it couldn't find the path that was easily found when started from my
code)
—
Reply to this email directly, view it on GitHub
<#7456 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVUSZMCCE6BPZCOVAWXKIY32U3MFVAVCNFSM6AAAAABZDBA426VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRZG4ZTONBRGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yes. It was installed succesfully. |
Describe the bug
At Google Colab
!pip install faiss-cpu
worksimport faiss
no errorbut
embeddings_dataset.add_faiss_index(column='embeddings')
returns
because
_has_faiss = importlib.util.find_spec("faiss") is not None
at the beginning ofdatasets/search.py
returnsFalse
when
the same code at colab notebook returns
ModuleSpec(name='faiss', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7b7851449f50>, origin='/usr/local/lib/python3.11/dist-packages/faiss/init.py', submodule_search_locations=['/usr/local/lib/python3.11/dist-packages/faiss'])
But
at
colab notebook
also returnsFalse
The same story with
_has_elasticsearch
Steps to reproduce the bug
embeddings_dataset.add_faiss_index(column='embeddings')
embeddings_dataset.add_elasticsearch_index(column='embeddings')
Expected behavior
I've only started Tutorial and don't know exactly. But something tells me that
embeddings_dataset.add_faiss_index(column='embeddings')
should work without
Import Error
Environment info
Google Colab notebook with default config
The text was updated successfully, but these errors were encountered: