Skip to content

Conversation

@genislm
Copy link

@genislm genislm commented May 3, 2024

Descriptilon:

Deleted unnecessary ' ' (text) embeddings that cause a dimension error when stacked to image embeddings.

Explanation

The script to generate image embeddings was reclycled from the one used for text embeddings generation.
This causes not only unnecessary text embeddings but a bug in which a dimension error shows up.

To be more specific, the line 37 that said:
txt_feats = txt_feats.reshape(-1, txt_feats.shape[-1]).cpu().data.numpy()
Has the correct dimensions to be stored directly. However, after appending it to a list and np.stack it with the images embeddings (notice the [0] before converting it to numpy)
img_feats = img_feats.reshape(-1, img_feats.shape[-1])[0].cpu().data.numpy()
the dimensions of the np arrays to stack were not compatible.

This can be solved in two ways.

  1. change the text embedding for
    txt_feats = txt_feats.reshape(-1, txt_feats.shape[-1])[0].cpu().data.numpy() (notice the [0])
  2. Directly avoiding the text embedding, as I suggest.

Deleted unnecessary ' ' (text) embeddings that cause a dimension error when stacked to image embeddings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant