Update the conftest to allow NaN (first logprob).

This commit is contained in:
Nicolas Patry 2024-08-16 13:16:51 +02:00
parent 772f0d1c80
commit 188ceb2fef
No known key found for this signature in database
GPG Key ID: 64AF4752B2967863
2 changed files with 6 additions and 4 deletions

View File

@ -118,6 +118,8 @@ class ResponseComparator(JSONSnapshotExtension):
and token.text == other.text and token.text == other.text
and ( and (
self.ignore_logprob self.ignore_logprob
or token.logprob == other.logprob
and token.logprob is None
or math.isclose(token.logprob, other.logprob, rel_tol=self.rtol) or math.isclose(token.logprob, other.logprob, rel_tol=self.rtol)
) )
and token.special == other.special and token.special == other.special

View File

@ -7,7 +7,7 @@
"prefill": [ "prefill": [
{ {
"id": 128000, "id": 128000,
"logprob": 0.0, "logprob": null,
"text": "<|begin_of_text|>" "text": "<|begin_of_text|>"
}, },
{ {
@ -96,7 +96,7 @@
"prefill": [ "prefill": [
{ {
"id": 128000, "id": 128000,
"logprob": 0.0, "logprob": null,
"text": "<|begin_of_text|>" "text": "<|begin_of_text|>"
}, },
{ {
@ -185,7 +185,7 @@
"prefill": [ "prefill": [
{ {
"id": 128000, "id": 128000,
"logprob": 0.0, "logprob": null,
"text": "<|begin_of_text|>" "text": "<|begin_of_text|>"
}, },
{ {
@ -274,7 +274,7 @@
"prefill": [ "prefill": [
{ {
"id": 128000, "id": 128000,
"logprob": 0.0, "logprob": null,
"text": "<|begin_of_text|>" "text": "<|begin_of_text|>"
}, },
{ {