Adapter solwol/roberta-sentiment-classifier-peft
for roberta-base
Usage
First, install transformers
and peft
:
pip install -U transformers peft
Now, the peft adapter can be loaded and activated like this:
from peft import PeftModel, PeftConfig
from transformers import AutoModelForSequenceClassification, RobertaConfig
config = RobertaConfig.from_pretrained(
"roberta-base",
id2label={0: "π", 1: "π"}
)
model = AutoModelForSequenceClassification.from_pretrained("roberta-base", config=config)
model = PeftModel.from_pretrained(model, "solwol/roberta-sentiment-classifier-peft")
Next, to perform sentiment classification:
from transformers import AutoTokenizer, TextClassificationPipeline
tokenizer = AutoTokenizer.from_pretrained("roberta-base")
classifier = TextClassificationPipeline(model=model, tokenizer=tokenizer)
classifier("This is awesome!")
[{'label': 'π', 'score': 0.9765560626983643}]
- Downloads last month
- 0
Inference Providers
NEW
This model is not currently available via any of the supported third-party Inference Providers, and
the HF Inference API does not support peft models with pipeline type text-classification