Edit model card

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 Examples
Inference API (serverless) does not yet support peft models for this pipeline type.

Dataset used to train solwol/roberta-sentiment-classifier-peft