mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-22 23:42:06 +00:00
fix(neuron): avoid using Levenshtein
This commit is contained in:
parent
88a0948692
commit
6f92198eb9
@ -1,4 +1,3 @@
|
|||||||
import Levenshtein
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@ -82,15 +81,13 @@ async def test_model_multiple_requests(tgi_service, neuron_generate_load):
|
|||||||
|
|
||||||
assert len(responses) == 4
|
assert len(responses) == 4
|
||||||
expectations = {
|
expectations = {
|
||||||
"gpt2": "\n\nDeep learning is a new field of research that has been around for a while",
|
"gpt2": "Deep learning is a new field of research that has been around for a while",
|
||||||
"llama": " A Beginner’s Guide\nDeep learning is a subset of machine learning that involves the use",
|
"llama": "Deep learning is a subset of machine learning that involves the use",
|
||||||
"mistral": "\nWhat is Deep Learning?\nDeep Learning is a type of machine learning that",
|
"mistral": "Deep Learning is a type of machine learning that",
|
||||||
"qwen2": " - Part 1\n\nDeep Learning is a subset of Machine Learning that is based on",
|
"qwen2": "Deep Learning is a subset of Machine Learning that is based on",
|
||||||
"granite": "\n\nDeep Learning is a subset of Machine Learning, which is a branch of Art",
|
"granite": "Deep Learning is a subset of Machine Learning, which is a branch of Art",
|
||||||
}
|
}
|
||||||
expected = expectations[tgi_service.client.service_name]
|
expected = expectations[tgi_service.client.service_name]
|
||||||
for r in responses:
|
for r in responses:
|
||||||
assert r.details.generated_tokens == 17
|
assert r.details.generated_tokens == 17
|
||||||
# Compute the similarity with the expectation using the levenshtein distance
|
assert expected in r.generated_text
|
||||||
# We should not have more than two substitutions or additions
|
|
||||||
assert Levenshtein.distance(r.generated_text, expected) < 3
|
|
||||||
|
Loading…
Reference in New Issue
Block a user