Skip to content

Commit

Permalink
fix windows test (#2775)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #2775

Differential Revision: D44210010

fbshipit-source-id: 9f8490430b4f8659ff8b430edea23c2aeb4f6505
  • Loading branch information
mdouze authored and facebook-github-bot committed Mar 21, 2023
1 parent 2d7dd5b commit 7244549
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contrib/ivf_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def write_checkpoint(self, fname, cur_list_no):
"rh": (self.rh.D, self.rh.I),
}, open(tmpname, "wb"), -1
)
os.rename(tmpname, fname)
os.replace(tmpname, fname)

def read_checkpoint(self, fname):
ckp = pickle.load(open(fname, "rb"))
Expand Down
4 changes: 3 additions & 1 deletion tests/test_contrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import numpy as np
import platform
import os
import random

from faiss.contrib import datasets
from faiss.contrib import inspect_tools
Expand Down Expand Up @@ -525,7 +526,8 @@ def test_checkpoint(self):
index.nprobe = 5
Dref, Iref = index.search(ds.get_queries(), k)

checkpoint = "/tmp/test_big_batch_checkpoint.%d" % np.random.randint(int(1e16))
r = random.randrange(1<<60)
checkpoint = "/tmp/test_big_batch_checkpoint.%d" % r
try:
# First big batch search
try:
Expand Down

0 comments on commit 7244549

Please sign in to comment.