最近在進行Facebook的基于faiss語義召回用于電商搜索的召回開發(fā)工作時候,基于tensorflow在訓練dssm模型的過程中,模型的代碼在圖的run過程中,出現(xiàn)了莫名其妙的bug,信息如下:


TypeErrorTraceback (most recent call last)TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'The above exception was the direct cause of the following exception:ValueErrorTraceback (most recent call last)
....
ValueError: setting an array element with a sequence.
困擾很久,原因是:安裝faiss時候把numpy版本升級為了1.19.1原來的1.15.1被替換了;但是把版本回退到1.15.1時候faiss計算向量相似性時候又出錯,所以只能分開兩個虛擬環(huán)境分別進行兩個階段的工作,具體原因還未查看源碼。
參考資料:
https://www.liangzl.com/get-article-detail-202136.html
https://stackoverflow.com/questions/63097829/debugging-numpy-visibledeprecationwarning-ndarray-from-ragged-nested-sequences