stanfordnlp/sst2
Viewer • Updated • 70k • 26k • 161
How to use ajinathgh/sentiment_analysis with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="ajinathgh/sentiment_analysis") # Load model directly
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("ajinathgh/sentiment_analysis")
model = AutoModelForMaskedLM.from_pretrained("ajinathgh/sentiment_analysis")# Load model directly
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("ajinathgh/sentiment_analysis")
model = AutoModelForMaskedLM.from_pretrained("ajinathgh/sentiment_analysis")This is a fine-tuned model for text classification based on distilbert-base-uncased.
from transformers import AutoTokenizer
from huggingface_text_classifier.model import SimpleTextClassifier
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("ajinathgh/sentiment_analysis")
model = SimpleTextClassifier.from_pretrained("ajinathgh/sentiment_analysis")
# Prepare input
inputs = tokenizer("Example text to classify", return_tensors="pt")
# Get predictions
outputs = model(**inputs)
predicted_class = outputs.argmax(-1).item()
Base model
distilbert/distilbert-base-uncased
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ajinathgh/sentiment_analysis")