epfml / sent2vec

General purpose unsupervised sentence representations
Other
1.19k stars 256 forks source link

Shared-memory matrix #56

Closed ivonindza closed 5 years ago

ivonindza commented 5 years ago

It's about optimizing memory usage when doing inference with multiple processes. Instead of each process loading the matrix, it is only loaded once in a shared memory region and used by all processes. This can also speed up the startup time if matrix is preloaded. The output matrix is not loaded at all as it is not needed during inference, which saves just under 50% of memory. There is no loss in speed, and potential savings in RAM can be huge.

mpagli commented 5 years ago

LGTM, nice feature, the code looks clean, will merge tomorrow if no complaint from other interested parties

ivonindza commented 5 years ago

Good catch, I forgot to update that