HuggingFaceFW/fineweb-edu-llama3-annotations
Viewer • Updated • 467k • 940 • 48
How to use pszemraj/mpnet-base-edu-classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="pszemraj/mpnet-base-edu-classifier") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("pszemraj/mpnet-base-edu-classifier")
model = AutoModelForSequenceClassification.from_pretrained("pszemraj/mpnet-base-edu-classifier")This model is a fine-tuned version of microsoft/mpnet-base on the HuggingFaceFW/fineweb-edu-llama3-annotations dataset. It achieves the following results on the evaluation set:
Note this is for CPU, for GPU you will need to make some (small) changes.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("pszemraj/mpnet-base-edu-classifier")
model = AutoModelForSequenceClassification.from_pretrained("pszemraj/mpnet-base-edu-classifier")
text = "This is a test sentence."
inputs = tokenizer(text, return_tensors="pt", padding="longest", truncation=True)
outputs = model(**inputs)
logits = outputs.logits.squeeze(-1).float().detach().numpy()
score = logits.item()
result = {
"text": text,
"score": score,
"int_score": int(round(max(0, min(score, 5)))),
}
print(result)
# {'text': 'This is a test sentence.', 'score': 0.3350256383419037, 'int_score': 0}
Refer to the hf classifier's model card for more details
The following hyperparameters were used during training:
Base model
microsoft/mpnet-base