Spaces:
Build error
Build error
File size: 617 Bytes
10f417b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from transformers import pipeline
from transformers import AutoTokenizer
from transformers import AutoModelForSequenceClassification
def load_pipeline(input_statement, pretrained_model_name):
classifier_ = pipeline("text-classification", model=pretrained_model_name, framework="pt")
cls_output = classifier_(input_statement)[0]
return cls_output
def load_models_from_pretrained(checkpoint):
checkpoint_local = checkpoint
tokenizer = AutoTokenizer.from_pretrained(checkpoint_local)
model = AutoModelForSequenceClassification.from_pretrained(checkpoint_local)
return tokenizer, model
|