Views
No views yet
PlanTL-GOB-ES/roberta-base-bne. As for September 2025, this checkpoint is deprecated and no longer actively maintained. For actively maintained Spanish RoBERTa models, please see the BSC-LT organization: https://huggingface.co/BSC-LT1
2 from transformers import AutoTokenizer, AutoModelForSequenceClassification
3 import torch
4
5 repo = "oeg/RoBERTaSense-FACIL"
6 tokenizer = AutoTokenizer.from_pretrained(repo)
7 model = AutoModelForSequenceClassification.from_pretrained(repo)
8 model.eval()
9
10 # Example pair
11 original = "Juan llegó tarde ya que perdió el autobús."
12 adapted = "Juan perdió el autobús. Por eso, Juan llegó tarde."
13
14 # Tokenization
15 inputs = tokenizer(
16 original,
17 adapted,
18 return_tensors="pt",
19 truncation=True,
20 max_length=512
21 )
22
23 # Inference
24 with torch.no_grad():
25 logits = model(**inputs).logits
26 probs = torch.softmax(logits, dim=-1)
27
28 # Meaning preservation score (0–1)
29 meaning_score = probs[0, 1].item()
30
31 print("Meaning Preservation Score:", meaning_score)PlanTL-GOB-ES/roberta-base-bne (deprecated; see notice above)inputs = tokenizer(text_original, text_adapted, return_tensors="pt", truncation=True, max_length=512)text1 (original), text2 (adaptation), Label (0/1), neg_type.1 = PRESERVES_MEANING, 0 = DOES_NOT_PRESERVE.shuffle, dropout, mismatch (derangement), paraphrase_distortion, nli_contradiction.Label (random_state=42).tokenizer(text1, text2, truncation=True, max_length=512)num_train_epochs=5per_device_train_batch_size=32per_device_eval_batch_size=16learning_rate=2e-5weight_decay=0.01warmup_ratio=0.1evaluation_strategy="epoch", save_strategy="epoch"load_best_model_at_end=True, metric_for_best_model="f1"mismatch, paraphrase_distortion, etc.).0.810.840.83Linear(hidden → 2)).1@software{roberta_facil_2025,
2 title = {RoBERTaSense-FACIL: Meaning Preservation for Easy-to-Read in Spanish},
3 author = {Diab-Lozano, Isam and Suárez-Figueroa, Mari Carmen},
4 year = {2025},
5 url = {https://huggingface.co/oeg/RoBERTaSense-FACIL}
6}