JLD commited on
Commit
4746ea0
1 Parent(s): 27cd9c1

Introduce unsqueeze for first dimension

Browse files
Files changed (1) hide show
  1. unsplash25k-image-embeddings.py +2 -2
unsplash25k-image-embeddings.py CHANGED
@@ -49,7 +49,7 @@ class Unsplash25kImageEmbeddingsDataset(datasets.GeneratorBasedBuilder):
49
  {
50
  "image_id": datasets.Value("string"),
51
  # "image_embedding": datasets.Features({'x': datasets.Array2D(shape=(1, 512), dtype='float16')})
52
- "image_embedding": datasets.Array2D(shape=(512), dtype='float16')
53
  }
54
  )
55
  return datasets.DatasetInfo(
@@ -88,5 +88,5 @@ class Unsplash25kImageEmbeddingsDataset(datasets.GeneratorBasedBuilder):
88
  for key in f.keys():
89
  tensors[key] = f.get_tensor(key)
90
  for num_id, image_id in enumerate(image_ids):
91
- yield num_id, {"image_id": image_id, "image_embedding": tensors["embeddings"][num_id]}
92
 
 
49
  {
50
  "image_id": datasets.Value("string"),
51
  # "image_embedding": datasets.Features({'x': datasets.Array2D(shape=(1, 512), dtype='float16')})
52
+ "image_embedding": datasets.Array2D(shape=(1, 512), dtype='float16')
53
  }
54
  )
55
  return datasets.DatasetInfo(
 
88
  for key in f.keys():
89
  tensors[key] = f.get_tensor(key)
90
  for num_id, image_id in enumerate(image_ids):
91
+ yield num_id, {"image_id": image_id, "image_embedding": tensors["embeddings"][num_id].unsqueeze(0)}
92