Skip to content

Commit

Permalink
fix pyright errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhue committed Sep 28, 2024
1 parent 2e17895 commit 7c7d333
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions afsl/sift.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from afsl.acquisition_functions import AcquisitionFunction, Targeted
from afsl.acquisition_functions.lazy_vtl import LazyVTL
from afsl.acquisition_functions.vtl import VTL
import faiss # type: ignore
import faiss
import torch
import time
import concurrent.futures
Expand Down Expand Up @@ -46,12 +46,12 @@ class Retriever:
```
"""

index: faiss.Index # type: ignore
index: faiss.Index
only_faiss: bool = False

def __init__(
self,
index: faiss.Index, # type: ignore
index: faiss.Index,
acquisition_function: AcquisitionFunction | None = None,
llambda: float = 0.01,
fast: bool = False,
Expand Down Expand Up @@ -148,7 +148,7 @@ def batch_search(
mean_queries = np.mean(queries, axis=1)

t_start = time.time()
faiss.omp_set_num_threads(threads) # type: ignore
faiss.omp_set_num_threads(threads)
D, I, V = self.index.search_and_reconstruct(mean_queries, K or self.index.ntotal) # type: ignore
t_faiss = time.time() - t_start

Expand Down
4 changes: 1 addition & 3 deletions examples/fine_tuning/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ def train_loop(
if faiss_index_path is not None:
acquisition_function.subsample = False

res = faiss.StandardGpuResources()
index = faiss.read_index(faiss_index_path)
index = faiss.index_cpu_to_gpu(res, 0, index)
retriever = Retriever(index, acquisition_function) # type: ignore
retriever = Retriever(index, acquisition_function)
else:
data_loader = ActiveDataLoader(
dataset=train_inputs,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
black~=24.8
faiss-cpu~=1.8
numpy~=2.1
pandas~=2.2
poetry~=1.8
Expand Down

0 comments on commit 7c7d333

Please sign in to comment.