I collected embeddings in a list or a pandas column, and np.array(embeddings) fails with an inhomogeneous shape error.

Find answers to your programming questions.
I collected embeddings in a list or a pandas column, and np.array(embeddings) fails with an inhomogeneous shape error.
I want cosine nearest neighbors with scikit-learn, but specifying algorithm='kdtree' or 'balltree' with metric='cosine' fails.
Brute-force search over millions of vectors takes seconds per query. I tried IndexIVFFlat and got an error about istrained.
index.search returns some IDs of -1, and I don't know how to get from the returned numbers back to my original documents.
With similaritysearchwithscore, the most relevant document has the lowest score. In another setup, all scores are high, even for unrelated text.
My embeddings are 1536 or 3072 dimensions. Storage and search are expensive, and some indexes have dimension limits. How can I make them smaller?
Re-embedding millions of documents is expensive. Can I map my old 768-dimensional vectors to the new model's 1024 dimensions?
torch.nn.functional.cosinesimilarity fails with a size or dimension error.