Hi, I’m training model on semantic_search about news title and text -> is_related(bool)
I have changed title and text into vector using transformer and want to calculate similarity.
Since torch vector(each are tensors) was so huge (142565x1024), the code below gives me an error saying “allocated more memory than is available”.
util.pytorch_cos_sim(embeddings1[i], embeddings2[i])
The code above calculate mat mul of two vectors(A,B^T) but I only need diagonal result of cos_sim, since I only need to get a similarity only between matching title and context (cos_sim[i][i]).
Is there any way to calculate without using lots of rams?