Correct bug with image ID loaded
Browse files
unsplash25k-image-embeddings.py
CHANGED
@@ -87,6 +87,6 @@ class Unsplash25kImageEmbeddingsDataset(datasets.GeneratorBasedBuilder):
|
|
87 |
with safe_open(embeddings_path, framework="pt", device="cpu") as f:
|
88 |
for key in f.keys():
|
89 |
tensors[key] = f.get_tensor(key)
|
90 |
-
for num_id
|
91 |
-
yield num_id, {"image_id": image_id, "image_embedding": tensors["embeddings"][num_id].unsqueeze(0)}
|
92 |
|
|
|
87 |
with safe_open(embeddings_path, framework="pt", device="cpu") as f:
|
88 |
for key in f.keys():
|
89 |
tensors[key] = f.get_tensor(key)
|
90 |
+
for num_id in range(len(image_ids)):
|
91 |
+
yield num_id, {"image_id": image_ids.iloc[num_id].image_id, "image_embedding": tensors["embeddings"][num_id].unsqueeze(0)}
|
92 |
|