Fix vLLM prompt logprobs calculation #960
Annotations
5 errors
|
unittest
Process completed with exit code 1.
|
|
Failed Test: tests/common/vllm_test.py::TestAsyncAPIServer::test_api_async
tests/common/vllm_test.py::TestAsyncAPIServer::test_api_async: The test failed in the call phase due to an assertion error - self = <tests.common.vllm_test.TestAsyncAPIServer testMethod=test_api_async>
async def test_api_async(self):
await self.model_wrapper.prepare()
await self.model_wrapper_no_history.prepare()
openai_client = self.model_wrapper.get_openai_async_client()
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is your name?"},
]
model_id = (await openai_client.models.list()).data[0].id
response = await openai_client.chat.completions.create(
model=model_id, messages=messages, n=1
)
self.assertEqual(1, len(response.choices))
self.assertTrue(len(response.choices[0].message.content) > 0)
response = await openai_client.chat.completions.create(
model=model_id,
messages=messages,
n=2,
temperature=0.5,
logprobs=True,
top_logprobs=0,
)
self.assertEqual(2, len(response.choices))
self.assertTrue(response.choices[0].logprobs is not None)
self.assertEqual(0, len(response.choices[0].logprobs.content[0].top_logprobs))
> self.assertTrue(response.choices[0].logprobs.content[0].logprob < 0)
E AssertionError: False is not true
tests/common/vllm_test.py:490: AssertionError
|
|
Failed Test: tests/common/vllm_test.py::TestLogprobs::test_logprobs
tests/common/vllm_test.py::TestLogprobs::test_logprobs: The test failed in the call phase due to an assertion error - self = <tests.common.vllm_test.TestLogprobs testMethod=test_logprobs>
async def test_logprobs(self):
# use init process group to apply patches
sync = (
ray.remote(DummySynchronizer)
.options(name="synchronizer", namespace=self.config.ray_namespace)
.remote()
)
await sync.__ray_ready__.remote()
await self.model_wrapper.prepare()
master_address, master_port = await self.engines[0].get_available_address.remote()
await self.engines[0].init_process_group.remote(
master_address,
master_port,
world_size=1,
rank_offset=0,
group_name=ROLLOUT_WEIGHT_SYNC_GROUP_NAME,
explorer_name=self.config.explorer.name,
timeout=20,
)
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is your name?"},
]
response_1 = self.model_wrapper.chat(messages, n=1, temperature=1.0, logprobs=True)[0]
response_2 = self.model_wrapper.chat(messages, n=1, temperature=0.5, logprobs=True)[0]
self.assertTrue(response_1.logprobs is not None)
self.assertTrue(len(response_1.logprobs) > 0)
self.assertTrue(response_2.logprobs is not None)
self.assertTrue(len(response_2.logprobs) > 0)
logprobs_1 = self.model_wrapper.logprobs(response_1.tokens.tolist(), temperature=1.0)
logprobs_2 = self.model_wrapper.logprobs(response_1.tokens.tolist(), temperature=0.5)
logprobs_3 = self.model_wrapper.logprobs(response_2.tokens.tolist(), temperature=1.0)
logprobs_4 = self.model_wrapper.logprobs(response_2.tokens.tolist(), temperature=0.5)
self.assertEqual(logprobs_1.shape, logprobs_2.shape)
self.assertFalse(torch.equal(logprobs_1, logprobs_2))
logprobs_1_prompt = logprobs_1[: response_1.prompt_length - 1]
logprobs_2_prompt = logprobs_2[: response_1.prompt_length - 1]
logprobs_3_prompt = logprobs_3[: response_2.prompt_length - 1]
logprobs_4_prompt = logprobs_4[: response_2.prompt_length - 1]
self.assertEqual(logprobs_1_prompt.shape, logprobs_2_prompt.shape)
self.assertFalse(torch.isclose(logprobs_1_prompt, logprobs_2_prompt, atol=1e-2).all())
self.assertFalse(torch.isclose(logprobs_3_prompt, logprobs_4_prompt, atol=1e-2).all())
> self.assertTrue(torch.isclose(logprobs_1_prompt, logprobs_3_prompt, atol=1e-2).all())
E AssertionError: tensor(False) is not true
tests/common/vllm_test.py:431: AssertionError
|
|
Failed Test: tests/common/vllm_test.py::TestAPIServer::test_api
tests/common/vllm_test.py::TestAPIServer::test_api: The test failed in the call phase due to an assertion error - self = <tests.common.vllm_test.TestAPIServer testMethod=test_api>
async def test_api(self):
await self.model_wrapper.prepare()
await self.model_wrapper_no_history.prepare()
openai_client = self.model_wrapper.get_openai_client()
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is your name?"},
]
model_id = openai_client.models.list().data[0].id
response = openai_client.chat.completions.create(model=model_id, messages=messages, n=1)
self.assertEqual(1, len(response.choices))
self.assertTrue(len(response.choices[0].message.content) > 0)
response = openai_client.chat.completions.create(
model=model_id,
messages=messages,
n=2,
temperature=0.5,
logprobs=True,
top_logprobs=0,
)
self.assertEqual(2, len(response.choices))
self.assertTrue(response.choices[0].logprobs is not None)
self.assertEqual(0, len(response.choices[0].logprobs.content[0].top_logprobs))
> self.assertTrue(response.choices[0].logprobs.content[0].logprob < 0)
E AssertionError: False is not true
tests/common/vllm_test.py:316: AssertionError
|
|
unittest
Process completed with exit code 1.
|
Artifacts
Produced during runtime
| Name | Size | Digest | |
|---|---|---|---|
|
pytest-results
|
2.92 KB |
sha256:a7c6189ade58a9aee888b9fb29971a795ab68b9399e7fdff71b797d6341dfd91
|
|