Notice
Recent Posts
Recent Comments
Link
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Archives
Today
Total
10-05 13:28
관리 메뉴

SJ_Koding

AttributeError: module 'faiss' has no attribute 'StandardGpuResources' 해결법 본문

카테고리 없음

AttributeError: module 'faiss' has no attribute 'StandardGpuResources' 해결법

성지코딩 2024. 7. 10. 10:46

 

faiss index를 생성할 때, CPU로 진행하면 굉장히 느리므로 GPU를 사용하려고 할 때 자주 보는 에러이다.

GPT에 물어보면 단순히 faiss-gpu를 install하라고 하는데, 이는 faiss-cpu가 설치되어있지 않은 경우를 가정한다.

즉, faiss-cpu가 install 되어있을 때, faiss-gpu를 install하더라도 faiss import시, faiss-cpu가 import되어 faiss-gpu라이브러리를 인식할 수 없다.

따라서 faiss-cpu를 uninstall하고 faiss-gpu를 설치해야하며, 만약 faiss-cpu가 설치되어있는 채로 faiss-gpu를 설치했다면 아마 uninstall했을 때 faiss 라이브러리 자체를 불러올 수 없다는 오류(ModuleNotFoundError)가 날 것이다.

이런 경우에는 faiss-gpu를 uninstall하고, 다시 설치하면 해결된다.

 

요약

pip uninstall -y faiss-cpu faiss-gpu
pip install faiss-gpu