nyu-mll/glue
Viewer • Updated • 1.49M • 419k • 520
How to use echarlaix/distilbert-base-uncased-finetuned-sst-2-english-openvino with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="echarlaix/distilbert-base-uncased-finetuned-sst-2-english-openvino") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("echarlaix/distilbert-base-uncased-finetuned-sst-2-english-openvino")
model = AutoModelForSequenceClassification.from_pretrained("echarlaix/distilbert-base-uncased-finetuned-sst-2-english-openvino", device_map="auto")This model was converted to OpenVINO from distilbert/distilbert-base-uncased-finetuned-sst-2-english using optimum-intel
via the export space.
First make sure you have optimum-intel installed:
pip install optimum-intel
To load your model you can do as follows:
from optimum.intel import OVModelForSequenceClassification
model_id = "echarlaix/distilbert-base-uncased-finetuned-sst-2-english-openvino"
model = OVModelForSequenceClassification.from_pretrained(model_id)