Views
No views yet
bert-base-uncased on the RTE (Recognizing Textual Entailment) task from the GLUE benchmark. It was developed as part of the EEE 486/586 Statistical Foundations of Natural Language Processing course assignment.| Hyperparameter | Value |
|---|---|
| Learning rate | 1.304e-05 |
| Max sequence length | 128 |
| Dropout rate | 0.1 |
| Hidden size multiplier | 1 |
| Batch size | 16 |
| Training epochs | 4 (early stopping) |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3# Load model and tokenizer
4tokenizer = AutoTokenizer.from_pretrained("gal-lardo/BERT-RTE-LinearClassifier")
5model = AutoModelForSequenceClassification.from_pretrained("gal-lardo/BERT-RTE-LinearClassifier")
6
7# Prepare input texts
8premise = "The woman is sleeping on the couch."
9hypothesis = "There is a woman resting."
10
11# Tokenize and predict
12inputs = tokenizer(premise, hypothesis, return_tensors="pt", padding=True, truncation=True)
13outputs = model(**inputs)
14prediction = outputs.logits.argmax(-1).item()
15
16# Convert prediction to label
17label = "entailment" if prediction == 1 else "not_entailment"
18print(f"Prediction: {label}")