You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
383 B
Python
11 lines
383 B
Python
8 months ago
|
import evaluate
|
||
|
|
||
|
perplexity = evaluate.load("../metrics/perplexity")
|
||
|
input_texts = ["你好!", "打死哦对吉萨大你去我家而且我就", "这辆车非常优秀"]
|
||
|
results = perplexity.compute(model_id='gpt2',
|
||
|
add_start_token=False,
|
||
|
predictions=input_texts)
|
||
|
print(list(results.keys()))
|
||
|
print(results["perplexities"])
|
||
|
|