Spaces:
Runtime error
Runtime error
wuzengcheng
commited on
Commit
·
7f0e191
1
Parent(s):
4b4753d
[fix] base features and search features should be in the same device
Browse files- algorithm.py +1 -1
algorithm.py
CHANGED
|
@@ -116,7 +116,7 @@ class ImageSearch():
|
|
| 116 |
|
| 117 |
base_product_features /= base_product_features.norm(dim=-1, keepdim=True)
|
| 118 |
|
| 119 |
-
wait2search_image_features = torch.from_numpy(self.encode_image(wait2search_image_list))
|
| 120 |
wait2search_image_features /= wait2search_image_features.norm(dim=-1, keepdim=True)
|
| 121 |
|
| 122 |
similarity = wait2search_image_features @ base_product_features.T
|
|
|
|
| 116 |
|
| 117 |
base_product_features /= base_product_features.norm(dim=-1, keepdim=True)
|
| 118 |
|
| 119 |
+
wait2search_image_features = torch.from_numpy(self.encode_image(wait2search_image_list)).to(self.device)
|
| 120 |
wait2search_image_features /= wait2search_image_features.norm(dim=-1, keepdim=True)
|
| 121 |
|
| 122 |
similarity = wait2search_image_features @ base_product_features.T
|