Need an efficient way to store data

I’m currently trying to run knn on lfw dataset.
I have trained dataset and got the vectors from forward pass.
The problem is, I can’t save all the vectors as I get memory out of range.
I get a 128*1 vector after forward pass, and i need to save around 9000.
How should i save the vectors for knn.
I don’t think I can’t store it in form of trainloader
Please help