Faiss in python and GPU报错:NotImplementedError: Wrong number or type of arguments for overloaded function 'new_GpuIndexFlatL2'.
最近在玩faiss,运行这段代码的时候报错了:
res = faiss.StandardGpuResources()
flat_config = 0
index = faiss.GpuIndexFlatL2(res,d,flat_config)
报错内容见上:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "swigfaiss_gpu.py", line 2958, in __init__
this = _swigfaiss_gpu.new_GpuIndexFlatL2(*args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'new_GpuIndexFlatL2'.
Possible C/C++ prototypes are:
faiss::gpu::GpuIndexFlatL2::GpuIndexFlatL2(faiss::gpu::GpuResources *,faiss::IndexFlatL2 *,faiss::gpu::GpuIndexFlatConfig)
faiss::gpu::GpuIndexFlatL2::GpuIndexFlatL2(faiss::gpu::GpuResources *,faiss::IndexFlatL2 *)
faiss::gpu::GpuIndexFlatL2::GpuIndexFlatL2(faiss::gpu::GpuResources *,int,faiss::gpu::GpuIndexFlatConfig)
faiss::gpu::GpuIndexFlatL2::GpuIndexFlatL2(faiss::gpu::GpuResources *,int)
一开始怀疑是因为之前用conda安装过 faiss,索性conda uninstall faiss-gpu。卸载后还是报错。
找了半天也没找到资料。最后看了底层代码才解决。
既然解决了就分享给大家:
解决的方法是:
flat_config = faiss.GpuIndexFlatConfig()
flat_config.device = 0
index = faiss.GpuIndexFlatL2(res, d, flat_config)
原因是API接口有了变动,指定GPU卡号的方式不一样了。
另外:
安装faiss只要下载源码安装即可。不需要conda 安装Python版本。
安装的时候需要提前安装swig。
Faiss in python and GPU报错:NotImplementedError: Wrong number or type of arguments for overloaded function 'new_GpuIndexFlatL2'.的更多相关文章
- 【.NET调用Python脚本】C#调用python requests类库报错 'module' object has no attribute '_getframe' - IronPython 2.7
最近在开发微信公众号,有一个自定义消息回复的需求 比如用户:麻烦帮我查询一下北京的天气? 系统回复:北京天气,晴,-℃... 这时候需要根据关键字[北京][天气],分词匹配需要执行的操作,然后去调用天 ...
- python pip install 报错TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' Command "python setup.py egg_info" failed with error code 1 in
pip install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl ...
- 【python】python读取文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 2: illegal multibyte sequence
python读取文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 2: illegal multibyte ...
- 【python】python安装tensorflow报错:python No matching distribution found for tensorflow==1.12.0
python安装tensorflow报错:python No matching distribution found for tensorflow==1.12.0 python版本是3.7.2 要安装 ...
- mac下python环境pip报错[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) 的解决方法
1.mac下python环境pip报错: issuserdeMacBook-Pro:~ issuser$ pip install pyinstallerCollecting pyinstaller ...
- Django中修改DATABASES后,执行python manage.py ****报错!UnicodeEncodeError
Django中修改DATABASES后,执行python manage.py ****报错!UnicodeEncodeError: 'latin-1' codec can't encode chara ...
- python 安装模块报错 response.py", line 302, in _error_catcher
python 安装模块报错 Exception:Traceback (most recent call last): File "/usr/share/python-wheels/urlli ...
- 关于编译报错“dereferencing pointer to incomplete type...
今天同事问了我一个问题,他make的时候报错,“第201行:dereferencing pointer to incomplete type”,我随即查阅了很多资料,也没看出个所以然.最后问题得到了解 ...
- 编译报错dereferencing pointer to incomplete type
关于编译报错“dereferencing pointer to incomplete type... 多是没找到结构体的定义,可以在本地复制其定义试试. 参考: http://my.oschina.n ...
随机推荐
- springAop整合自定义注解做方法日志配置(源码在附件)
package com.aop.log.anno; import java.lang.annotation.ElementType; import java.lang.annotation.Reten ...
- 正则替换HTML里的style属性
一个网友问: <p class="a" style="font-size: 12pt; font-family: ""; color: red ...
- 安装Visual Studio 语言包时出现windows 程序兼容模式已打开.请将其关闭
打开 cmd.exe 输入 安装包路径 /Uninstall例如:D:\vs_lang_cn.exe /Uninstall (中间有个空格,Uninstall前是个左斜杠)回车 后 安装包会运行.点击 ...
- CentOS7.3安装Go运行和开发环境
https://blog.csdn.net/warnerwu/article/details/73825105
- 【C++】反斜杠“\”的作用
转自 https://blog.csdn.net/ismallboy/article/details/8082514 转义字符:如:\n表示回车+换行等. 续行符:这个需要注意一下,在一般的语句中,这 ...
- 使用java注解实现toJson方法
如果我有一个对象user,它有几个属性,我想把该对象序列化成一个json字符串,怎么做?我怎么把这种类型的问题实现成一个函数? 注解类似于在被注解的对象上,添加一些简单的属性.在运行时解析这些属性,以 ...
- JNDI是什么
参考文章:---为什么 追本溯源 http://www.cnblogs.com/xx0405/p/5332198.html jndi在Spring和tomcat下的使用: https://www.cn ...
- 搭建vsftpd服务
配置文件 anonymous_enable=NOlocal_enable=YESwrite_enable=YESlocal_umask=022dirmessage_enable=YESxferlog_ ...
- Linux设置虚拟内存教学和实战
介绍 在我们自己的购买的服务器环境中,一般是买的1g的内存,但是当服务器里面的东西装的比较多的时候就会导致内存不够用了,本文将模拟一个真实的内存不够用的情况下,如何通过修改虚拟内存来让系统正常运行,我 ...
- analyse idoc by creation date
t-code ZMM0127 infoset: ZMM_IDOC_READ_01 go to code: AUTHORITY-CHECK OBJECT 'S_IDOCMONI'ID 'ACTVT' F ...