I’m having a similar issue … but can’t seem to get my code to work (trying your suggested approach). (trying to implement Linear Probe: GitHub - openai/CLIP: Contrastive Language-Image Pretraining 2)
text = []
for example in dataset:
text.append(example[“label”])
text = torch.cat(text).cpu().numpy()
results in “TypeError: expected Tensor as element 0 in argument 0, but got numpy.int64”
text = []
for example in dataset:
text.append(example[“label”])
text = torch.tensor(text)
text = torch.cat(text).cpu().numpy()
Results in “TypeError: cat(): argument ‘tensors’ (position 1) must be tuple of Tensors, not Tensor”
Thoughts?