Views
No views yet
textlabellabel_name| Parameter | Value |
|---|---|
| Epochs | 2 |
| Learning Rate | 2e-5 |
| Batch Size | 64 |
| Optimizer | AdamW |
| Evaluation Strategy | Per Epoch |
| Weight Decay | 0.01 |
1from sklearn.metrics import classification_report
2print(classification_report(y_true, y_pred))pip install transformers torch1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="ForamSoni/bert-sentiment-detector"
6)
7
8classifier("I am feeling great today!")1texts = [
2 "I am super happy today!",
3 "I feel terrible",
4 "This is amazing",
5 "I am feeling low"
6]
7
8classifier(texts)1def get_prediction(text):
2 input_encoded = tokenizer(text, return_tensors='pt').to(device)
3
4 with torch.no_grad():
5 outputs = model(**input_encoded)
6
7 logits = outputs.logits
8 pred = torch.argmax(logits, dim=1).item()
9
10 return id2label[pred]bert-sentiment-detector
│
├── model.safetensors
├── config.json
├── tokenizer.json
├── tokenizer_config.json
├── README.md
└── training.ipynb