Skip to content

Commit 2bd9d39

Browse files
author
ablattmann
committed
fixes
1 parent 78ef9ca commit 2bd9d39

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

ldm/util.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
import torch
44
import numpy as np
5+
from collections import abc
6+
from einops import rearrange
7+
from functools import partial
8+
9+
import multiprocessing as mp
10+
from threading import Thread
11+
from queue import Queue
512

613
from inspect import isfunction
714
from PIL import Image, ImageDraw, ImageFont

scripts/knn2img.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def __init__(self, database, retriever_version='ViT-L/14'):
7272
'img_id': [],
7373
'patch_coords': []}
7474
self.load_database()
75-
self.searcher = self.load_searcher()
75+
self.load_searcher()
7676

7777
def train_searcher(self, k,
7878
metric='dot_product',
@@ -117,7 +117,7 @@ def load_database(self):
117117
prefetched_data = parallel_data_prefetch(self.load_multi_files, data,
118118
n_proc=min(len(data), cpu_count()), target_data_type='dict')
119119

120-
self.database = {key: np.concatenate([od[key] for od in prefetched_data], axis=1)[0] for key in self.data_pool}
120+
self.database = {key: np.concatenate([od[key] for od in prefetched_data], axis=1)[0] for key in self.database}
121121
else:
122122
raise ValueError(f'No npz-files in specified path "{self.database_path}" is this directory existing?')
123123

0 commit comments

Comments
 (0)