Closed glebzhelezov closed 2 months ago
Cool, I really like this change!
One small ask though, could you also add this change to the CLIP model here? That one also uses sentence-transformers under the hood. Would be nice to also add that to this PR.
@koaning Done!
Grand. Will merge once it looks green.
Just made a new release!
This small PR sets the torch device in
SentenceEncoder
tomps
whenever CUDA is not available, but MPS is. This speeds up inference on newer Macs, and doesn't affect other device.Running the following script
on my M3 MacBook Air with 16 GB of RAM takes ~10 seconds with the changes in this PR (and activates the GPU, according to
mactop
), and ~15 seconds without.