Skip to content
Snippets Groups Projects
Commit d0ce44af authored by oschmanf's avatar oschmanf
Browse files

Evaluate trained BERT

parent 35189e2e
No related branches found
No related tags found
1 merge request!2Dev train models
from datasets import load_dataset
from evaluate import evaluator
from transformers import pipeline
data = load_dataset("imdb", split="test").shuffle(seed=42).select(range(10))
task_evaluator = evaluator("text-classification")
pipe = pipeline("text-classification", model="../saved_models/20230630-103946/")
eval_results = task_evaluator.compute(
model_or_pipeline=pipe,
data=data,
label_mapping={"NEGATIVE": 0, "POSITIVE": 1}
)
import pdb; pdb.set_trace()
print(eval_results)
from datasets import load_dataset
from evaluate import evaluator
from transformers import pipeline from transformers import pipeline
text = "This was a masterpiece. Not completely faithful to the books, but enthralling from beginning to end. Might be my favorite of the three." data = load_dataset("imdb", split="test").shuffle(seed=42).select(range(10))
task_evaluator = evaluator("text-classification")
pipe = pipeline("text-classification", model="../saved_models/20230630-103946/")
eval_results = task_evaluator.compute(
model_or_pipeline=pipe,
data=data,
label_mapping={"NEGATIVE": 0, "POSITIVE": 1}
)
import pdb; pdb.set_trace()
print(eval_results)
classifier = pipeline("sentiment-analysis", model="../saved_models/")
classifier(text)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment