Downloads · 30 days
9
0% of all-time downloads
Sasidhar1826/fine-tuned-metaphor-detection
fine-tuned-metaphor-detection is a text classification model from Sasidhar1826. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
This is the extention of my previously trained model.
Downloads · 30 days
9
0% of all-time downloads
All-time downloads
3.8K
Public
Parameters
109M
438 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
This is the extention of my previously trained model.
This is a fine-tuned version of a BERT-based model used for metaphor detection in text. The model was trained on a custom dataset with sentences labeled as either metaphors or literals.
You can use this model to predict whether a sentence contains a metaphor or not. Below is an example of how to load the model and use it for inference:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("your-username/fine-tuned-metaphor-detection")
model = AutoModelForSequenceClassification.from_pretrained("your-username/fine-tuned-metaphor-detection")
# Example text
text = "Time is a thief."
# Tokenize input and get predictions
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
prediction = torch.argmax(logits, dim=-1)
print("Prediction:", "Metaphor" if prediction.item() == 1 else "Literal")