How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-classification", model="dhpollack/distilbert-dummy-sentiment")
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("dhpollack/distilbert-dummy-sentiment")
model = AutoModelForSequenceClassification.from_pretrained("dhpollack/distilbert-dummy-sentiment", device_map="auto")
Quick Links

DistilBert Dummy Sentiment Model

Purpose

This is a dummy model that can be used for testing the transformers pipeline with the task sentiment-analysis. It should always give random results (i.e. {"label": "negative", "score": 0.5}).

How to use

classifier = pipeline("sentiment-analysis", "dhpollack/distilbert-dummy-sentiment")
results  = classifier(["this is a test", "another test"])

Notes

This was created as follows:

  1. Create a vocab.txt file (in /tmp/vocab.txt in this example).
[UNK]
[SEP]
[PAD]
[CLS]
[MASK]
  1. Open a python shell:
import transformers
config = transformers.DistilBertConfig(vocab_size=5, n_layers=1, n_heads=1, dim=1, hidden_dim=4 * 1, num_labels=2, id2label={0: "negative", 1: "positive"}, label2id={"negative": 0, "positive": 1})
model = transformers.DistilBertForSequenceClassification(config)
tokenizer = transformers.DistilBertTokenizer("/tmp/vocab.txt", model_max_length=512)
config.save_pretrained(".")
model.save_pretrained(".")
tokenizer.save_pretrained(".")
Downloads last month
462
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support