Maybe solution is somewhat similar to this (without tokenizer) yet it will probably have no information on pretrained model.
feature_extraction = pipeline('feature-extraction', model="distilroberta-base", tokenizer="distilroberta-base")
features = feature_extraction("i am sentence")

Source: machine learning - Getting sentence embedding from huggingface Feature Extraction Pipeline - Stack Overflow 4