add test_cache_vs_nocache_prompt
This commit is contained in:
parent
217c9e4215
commit
52c262585b
1 changed files with 22 additions and 3 deletions
|
@ -62,7 +62,7 @@ def test_consistent_result_same_seed(n_slots: int):
|
||||||
"prompt": "I believe the meaning of life is",
|
"prompt": "I believe the meaning of life is",
|
||||||
"seed": 42,
|
"seed": 42,
|
||||||
"temperature": 1.0,
|
"temperature": 1.0,
|
||||||
"cache_prompt": False,
|
"cache_prompt": False, # TODO: remove this once test_cache_vs_nocache_prompt is fixed
|
||||||
})
|
})
|
||||||
if last_res is not None:
|
if last_res is not None:
|
||||||
assert res.body["content"] == last_res.body["content"]
|
assert res.body["content"] == last_res.body["content"]
|
||||||
|
@ -80,7 +80,7 @@ def test_different_result_different_seed(n_slots: int):
|
||||||
"prompt": "I believe the meaning of life is",
|
"prompt": "I believe the meaning of life is",
|
||||||
"seed": seed,
|
"seed": seed,
|
||||||
"temperature": 1.0,
|
"temperature": 1.0,
|
||||||
"cache_prompt": False,
|
"cache_prompt": False, # TODO: remove this once test_cache_vs_nocache_prompt is fixed
|
||||||
})
|
})
|
||||||
if last_res is not None:
|
if last_res is not None:
|
||||||
assert res.body["content"] != last_res.body["content"]
|
assert res.body["content"] != last_res.body["content"]
|
||||||
|
@ -99,13 +99,32 @@ def test_consistent_result_different_batch_size(n_batch: int, temperature: float
|
||||||
"prompt": "I believe the meaning of life is",
|
"prompt": "I believe the meaning of life is",
|
||||||
"seed": 42,
|
"seed": 42,
|
||||||
"temperature": temperature,
|
"temperature": temperature,
|
||||||
"cache_prompt": False,
|
"cache_prompt": False, # TODO: remove this once test_cache_vs_nocache_prompt is fixed
|
||||||
})
|
})
|
||||||
if last_res is not None:
|
if last_res is not None:
|
||||||
assert res.body["content"] == last_res.body["content"]
|
assert res.body["content"] == last_res.body["content"]
|
||||||
last_res = res
|
last_res = res
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip(reason="This test fails on linux, need to be fixed")
|
||||||
|
def test_cache_vs_nocache_prompt():
|
||||||
|
global server
|
||||||
|
server.start()
|
||||||
|
res_cache = server.make_request("POST", "/completion", data={
|
||||||
|
"prompt": "I believe the meaning of life is",
|
||||||
|
"seed": 42,
|
||||||
|
"temperature": 1.0,
|
||||||
|
"cache_prompt": True,
|
||||||
|
})
|
||||||
|
res_no_cache = server.make_request("POST", "/completion", data={
|
||||||
|
"prompt": "I believe the meaning of life is",
|
||||||
|
"seed": 42,
|
||||||
|
"temperature": 1.0,
|
||||||
|
"cache_prompt": False,
|
||||||
|
})
|
||||||
|
assert res_cache.body["content"] == res_no_cache.body["content"]
|
||||||
|
|
||||||
|
|
||||||
def test_completion_with_tokens_input():
|
def test_completion_with_tokens_input():
|
||||||
global server
|
global server
|
||||||
server.temperature = 0.0
|
server.temperature = 0.0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue