|
|
--- |
|
|
language: en |
|
|
tags: |
|
|
- clip-classifier |
|
|
- e5 |
|
|
- classification |
|
|
license: mit |
|
|
--- |
|
|
# Clip Classifier |
|
|
This model is fine-tuned from [intfloat/multilingual-e5-large-instruct](https://huggingface.co/intfloat/multilingual-e5-large-instruct) for classifying text as "Clip Worthy" or "Not Clip Worthy". |
|
|
## Model Details |
|
|
- **Model Type:** Sequence classification fine-tuned from E5 Large Instruct |
|
|
- **Task:** Binary classification (Clip worthy vs Not clip worthy) |
|
|
- **Training Data:** Custom dataset |
|
|
## Usage |
|
|
```python |
|
|
from transformers import AutoTokenizer, AutoModelForSequenceClassification |
|
|
import torch |
|
|
# Load model and tokenizer |
|
|
model_name = "umarfarzan/clip-classifier-v9_50_50" |
|
|
tokenizer = AutoTokenizer.from_pretrained(model_name) |
|
|
model = AutoModelForSequenceClassification.from_pretrained(model_name) |
|
|
# Example text |
|
|
text = "Your text here" |
|
|
# Tokenize and predict |
|
|
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512, padding="max_length") |
|
|
with torch.no_grad(): |
|
|
outputs = model(**inputs) |
|
|
# Get prediction |
|
|
probabilities = torch.nn.functional.softmax(outputs.logits, dim=1) |
|
|
prediction = torch.argmax(probabilities, dim=1).item() |
|
|
confidence = probabilities[0][prediction].item() |
|
|
# Map prediction to label |
|
|
id2label = {0: "Not Clip Worthy", 1: "Clip Worthy"} |
|
|
result = id2label[prediction] |
|
|
print(f"Prediction: {result}") |
|
|
print(f"Confidence: {confidence:.2f}") |
|
|
``` |
|
|
## Limitations |
|
|
[Describe any limitations here] |
|
|
## Citation |
|
|
If you use this model, please cite: |
|
|
[Your citation information] |
|
|
|