Hi, actually you could use a Dense layer (from sentence-tranformers here 112 ) and go from 768 to 300 with a bit of finetuning.
If you still want to use PCA, huggingface (for what I know) doesn’t have it’s own implementation so I advice you to pick the best python library you know and use that implemlementation.
For example, if you want to use scikit-learn library they have PCA as well as other cool stuff. ( this 42 is the first example that I happen to see on scikit-learn PCA)