fix: bump snapshots and improve exceed window test case

This commit is contained in:
drbh 2025-03-14 15:04:38 +00:00
parent 170a12f331
commit e5ec176bf4
5 changed files with 162 additions and 183 deletions

View File

@ -1,133 +1,109 @@
{ {
"details": { "details": {
"best_of_sequences": null, "best_of_sequences": null,
"finish_reason": "length", "finish_reason": "eos_token",
"generated_tokens": 20, "generated_tokens": 16,
"prefill": [], "prefill": [],
"seed": null, "seed": null,
"tokens": [ "tokens": [
{
"id": 506,
"logprob": -1.3984375,
"special": false,
"text": " the"
},
{
"id": 1331,
"logprob": -1.6953125,
"special": false,
"text": " people"
},
{ {
"id": 236764, "id": 236764,
"logprob": -0.44726562, "logprob": -0.23535156,
"special": false, "special": false,
"text": "," "text": ","
}, },
{ {
"id": 236743, "id": 532,
"logprob": -0.011413574, "logprob": -0.24316406,
"special": false, "special": false,
"text": " " "text": " and"
}, },
{ {
"id": 236812, "id": 506,
"logprob": -0.09814453, "logprob": -0.12109375,
"special": false, "special": false,
"text": "4" "text": " the"
}, },
{ {
"id": 236764, "id": 2780,
"logprob": -0.044189453, "logprob": -1.1640625,
"special": false, "special": false,
"text": "," "text": " food"
}, },
{ {
"id": 236743, "id": 236761,
"logprob": -0.15625, "logprob": -0.21386719,
"special": false, "special": false,
"text": " " "text": "."
}, },
{ {
"id": 236810, "id": 108,
"logprob": -0.010864258, "logprob": -0.64453125,
"special": false, "special": false,
"text": "5" "text": "\n\n"
}, },
{ {
"id": 236764, "id": 2094,
"logprob": -0.040039062, "logprob": -0.77734375,
"special": false, "special": false,
"text": "," "text": "This"
}, },
{ {
"id": 236743, "id": 563,
"logprob": -0.26757812, "logprob": -0.040283203,
"special": false, "special": false,
"text": " " "text": " is"
}, },
{ {
"id": 236825, "id": 496,
"logprob": -0.0047302246, "logprob": -0.03125,
"special": false, "special": false,
"text": "6" "text": " a"
}, },
{ {
"id": 236764, "id": 6290,
"logprob": -0.026123047, "logprob": -0.03515625,
"special": false, "special": false,
"text": "," "text": " nice"
}, },
{ {
"id": 236743, "id": 1977,
"logprob": -0.265625, "logprob": -0.0020751953,
"special": false, "special": false,
"text": " " "text": " place"
}, },
{ {
"id": 236832, "id": 236761,
"logprob": -0.014160156, "logprob": -0.0079956055,
"special": false, "special": false,
"text": "7" "text": "."
}, },
{ {
"id": 236764, "id": 107,
"logprob": -0.013977051, "logprob": -0.9921875,
"special": false, "special": false,
"text": "," "text": "\n"
}, },
{ {
"id": 236743, "id": 106,
"logprob": -0.103515625, "logprob": -0.45507812,
"special": false, "special": true,
"text": " " "text": "<end_of_turn>"
},
{
"id": 236828,
"logprob": -0.008178711,
"special": false,
"text": "8"
},
{
"id": 236764,
"logprob": -0.030151367,
"special": false,
"text": ","
},
{
"id": 236743,
"logprob": -0.39453125,
"special": false,
"text": " "
},
{
"id": 236819,
"logprob": -0.008728027,
"special": false,
"text": "9"
},
{
"id": 236764,
"logprob": -0.020629883,
"special": false,
"text": ","
},
{
"id": 236743,
"logprob": -0.08154297,
"special": false,
"text": " "
} }
], ],
"top_tokens": null "top_tokens": null
}, },
"generated_text": ", 4, 5, 6, 7, 8, 9, " "generated_text": " the people, and the food.\n\nThis is a nice place.\n"
} }

View File

@ -8,31 +8,31 @@
"tokens": [ "tokens": [
{ {
"id": 1331, "id": 1331,
"logprob": -0.32421875, "logprob": -0.34960938,
"special": false, "special": false,
"text": " people" "text": " people"
}, },
{ {
"id": 8390, "id": 8390,
"logprob": -0.15332031, "logprob": -0.14746094,
"special": false, "special": false,
"text": " died" "text": " died"
}, },
{ {
"id": 528, "id": 528,
"logprob": -1.140625, "logprob": -1.2265625,
"special": false, "special": false,
"text": " in" "text": " in"
}, },
{ {
"id": 506, "id": 506,
"logprob": -0.42578125, "logprob": -0.47070312,
"special": false, "special": false,
"text": " the" "text": " the"
}, },
{ {
"id": 3640, "id": 3640,
"logprob": -0.64453125, "logprob": -0.5859375,
"special": false, "special": false,
"text": " United" "text": " United"
}, },
@ -44,31 +44,31 @@
}, },
{ {
"id": 236761, "id": 236761,
"logprob": -0.37890625, "logprob": -0.34765625,
"special": false, "special": false,
"text": "." "text": "."
}, },
{ {
"id": 108, "id": 108,
"logprob": -0.08300781, "logprob": -0.0859375,
"special": false, "special": false,
"text": "\n\n" "text": "\n\n"
}, },
{ {
"id": 818, "id": 818,
"logprob": -1.1796875, "logprob": -1.1640625,
"special": false, "special": false,
"text": "The" "text": "The"
}, },
{ {
"id": 6816, "id": 6816,
"logprob": -1.765625, "logprob": -1.890625,
"special": false, "special": false,
"text": " generally" "text": " generally"
}, },
{ {
"id": 10951, "id": 10951,
"logprob": -0.14550781, "logprob": -0.14648438,
"special": false, "special": false,
"text": " accepted" "text": " accepted"
}, },
@ -86,49 +86,49 @@
}, },
{ {
"id": 600, "id": 600,
"logprob": -0.65625, "logprob": -0.65234375,
"special": false, "special": false,
"text": " that" "text": " that"
}, },
{ {
"id": 236743, "id": 236743,
"logprob": -1.1796875, "logprob": -1.2109375,
"special": false, "special": false,
"text": " " "text": " "
}, },
{ {
"id": 236825, "id": 236825,
"logprob": -0.0009918213, "logprob": -0.00088119507,
"special": false, "special": false,
"text": "6" "text": "6"
}, },
{ {
"id": 236832, "id": 236832,
"logprob": -6.532669e-05, "logprob": -6.580353e-05,
"special": false, "special": false,
"text": "7" "text": "7"
}, },
{ {
"id": 236810, "id": 236810,
"logprob": -4.863739e-05, "logprob": -5.2690506e-05,
"special": false, "special": false,
"text": "5" "text": "5"
}, },
{ {
"id": 236764, "id": 236764,
"logprob": -0.00017929077, "logprob": -0.0001745224,
"special": false, "special": false,
"text": "," "text": ","
}, },
{ {
"id": 236771, "id": 236771,
"logprob": -1.2397766e-05, "logprob": -1.180172e-05,
"special": false, "special": false,
"text": "0" "text": "0"
}, },
{ {
"id": 236771, "id": 236771,
"logprob": -2.1457672e-06, "logprob": -1.7881393e-06,
"special": false, "special": false,
"text": "0" "text": "0"
}, },
@ -140,7 +140,7 @@
}, },
{ {
"id": 1331, "id": 1331,
"logprob": -0.50390625, "logprob": -0.44921875,
"special": false, "special": false,
"text": " people" "text": " people"
}, },
@ -152,67 +152,67 @@
}, },
{ {
"id": 528, "id": 528,
"logprob": -0.08496094, "logprob": -0.084472656,
"special": false, "special": false,
"text": " in" "text": " in"
}, },
{ {
"id": 506, "id": 506,
"logprob": -0.0003299713, "logprob": -0.00034713745,
"special": false, "special": false,
"text": " the" "text": " the"
}, },
{ {
"id": 3640, "id": 3640,
"logprob": -0.028442383, "logprob": -0.028564453,
"special": false, "special": false,
"text": " United" "text": " United"
}, },
{ {
"id": 4184, "id": 4184,
"logprob": -0.00011014938, "logprob": -0.00012207031,
"special": false, "special": false,
"text": " States" "text": " States"
}, },
{ {
"id": 236761, "id": 236761,
"logprob": -1.1796875, "logprob": -1.15625,
"special": false, "special": false,
"text": "." "text": "."
}, },
{ {
"id": 3153, "id": 3153,
"logprob": -0.104003906, "logprob": -0.103027344,
"special": false, "special": false,
"text": " However" "text": " However"
}, },
{ {
"id": 236764, "id": 236764,
"logprob": -0.009094238, "logprob": -0.009155273,
"special": false, "special": false,
"text": "," "text": ","
}, },
{ {
"id": 1070, "id": 1070,
"logprob": -0.88671875, "logprob": -0.92578125,
"special": false, "special": false,
"text": " some" "text": " some"
}, },
{ {
"id": 61806, "id": 61806,
"logprob": -0.84765625, "logprob": -0.91796875,
"special": false, "special": false,
"text": " historians" "text": " historians"
}, },
{ {
"id": 4646, "id": 4646,
"logprob": -1.34375, "logprob": -1.3828125,
"special": false, "special": false,
"text": " believe" "text": " believe"
}, },
{ {
"id": 506, "id": 506,
"logprob": -0.59375, "logprob": -0.65234375,
"special": false, "special": false,
"text": " the" "text": " the"
}, },
@ -230,7 +230,7 @@
}, },
{ {
"id": 1451, "id": 1451,
"logprob": -0.60546875, "logprob": -0.66015625,
"special": false, "special": false,
"text": " could" "text": " could"
}, },
@ -242,73 +242,73 @@
}, },
{ {
"id": 618, "id": 618,
"logprob": -0.61328125, "logprob": -0.57421875,
"special": false, "special": false,
"text": " as" "text": " as"
}, },
{ {
"id": 1494, "id": 1494,
"logprob": -0.00033569336, "logprob": -0.00036239624,
"special": false, "special": false,
"text": " high" "text": " high"
}, },
{ {
"id": 618, "id": 618,
"logprob": -0.0001411438, "logprob": -0.0001335144,
"special": false, "special": false,
"text": " as" "text": " as"
}, },
{ {
"id": 236743, "id": 236743,
"logprob": -0.001045227, "logprob": -0.0009689331,
"special": false, "special": false,
"text": " " "text": " "
}, },
{ {
"id": 236770, "id": 236770,
"logprob": -0.21289062, "logprob": -0.26367188,
"special": false, "special": false,
"text": "1" "text": "1"
}, },
{ {
"id": 236771, "id": 236771,
"logprob": -0.13378906, "logprob": -0.17773438,
"special": false, "special": false,
"text": "0" "text": "0"
}, },
{ {
"id": 3625, "id": 3625,
"logprob": -0.0087890625, "logprob": -0.012084961,
"special": false, "special": false,
"text": " million" "text": " million"
}, },
{ {
"id": 236761, "id": 236761,
"logprob": -0.2109375, "logprob": -0.21289062,
"special": false, "special": false,
"text": "." "text": "."
}, },
{ {
"id": 108, "id": 108,
"logprob": -0.39453125, "logprob": -0.37304688,
"special": false, "special": false,
"text": "\n\n" "text": "\n\n"
}, },
{ {
"id": 236777, "id": 236777,
"logprob": -1.1328125, "logprob": -1.078125,
"special": false, "special": false,
"text": "I" "text": "I"
}, },
{ {
"id": 1006, "id": 1006,
"logprob": -1.4140625, "logprob": -1.3203125,
"special": false, "special": false,
"text": " am" "text": " am"
}, },
{ {
"id": 3182, "id": 3182,
"logprob": -1.15625, "logprob": -1.078125,
"special": false, "special": false,
"text": " looking" "text": " looking"
}, },
@ -320,13 +320,13 @@
}, },
{ {
"id": 919, "id": 919,
"logprob": -1.2734375, "logprob": -1.25,
"special": false, "special": false,
"text": " more" "text": " more"
}, },
{ {
"id": 1938, "id": 1938,
"logprob": -1.2265625, "logprob": -1.2421875,
"special": false, "special": false,
"text": " information" "text": " information"
}, },
@ -338,169 +338,169 @@
}, },
{ {
"id": 672, "id": 672,
"logprob": -0.77734375, "logprob": -0.73046875,
"special": false, "special": false,
"text": " this" "text": " this"
}, },
{ {
"id": 59725, "id": 59725,
"logprob": -0.70703125, "logprob": -0.75,
"special": false, "special": false,
"text": " discrepancy" "text": " discrepancy"
}, },
{ {
"id": 532, "id": 532,
"logprob": -0.8515625, "logprob": -0.83984375,
"special": false, "special": false,
"text": " and" "text": " and"
}, },
{ {
"id": 506, "id": 506,
"logprob": -0.65625, "logprob": -0.7109375,
"special": false, "special": false,
"text": " the" "text": " the"
}, },
{ {
"id": 5872, "id": 5872,
"logprob": -1.15625, "logprob": -1.2734375,
"special": false, "special": false,
"text": " factors" "text": " factors"
}, },
{ {
"id": 600, "id": 600,
"logprob": -0.2265625, "logprob": -0.22851562,
"special": false, "special": false,
"text": " that" "text": " that"
}, },
{ {
"id": 19263, "id": 19263,
"logprob": -1.125, "logprob": -1.1640625,
"special": false, "special": false,
"text": " contributed" "text": " contributed"
}, },
{ {
"id": 531, "id": 531,
"logprob": -0.001083374, "logprob": -0.0010757446,
"special": false, "special": false,
"text": " to" "text": " to"
}, },
{ {
"id": 506, "id": 506,
"logprob": -0.2109375, "logprob": -0.18945312,
"special": false, "special": false,
"text": " the" "text": " the"
}, },
{ {
"id": 5777, "id": 5777,
"logprob": -1.21875, "logprob": -1.2734375,
"special": false, "special": false,
"text": " wide" "text": " wide"
}, },
{ {
"id": 2644, "id": 2644,
"logprob": -0.018310547, "logprob": -0.01940918,
"special": false, "special": false,
"text": " range" "text": " range"
}, },
{ {
"id": 529, "id": 529,
"logprob": -0.12988281, "logprob": -0.14550781,
"special": false, "special": false,
"text": " of" "text": " of"
}, },
{ {
"id": 14287, "id": 14287,
"logprob": -0.03564453, "logprob": -0.032470703,
"special": false, "special": false,
"text": " estimates" "text": " estimates"
}, },
{ {
"id": 236761, "id": 236761,
"logprob": -0.010314941, "logprob": -0.010375977,
"special": false, "special": false,
"text": "." "text": "."
}, },
{ {
"id": 108, "id": 108,
"logprob": -0.060546875, "logprob": -0.06591797,
"special": false, "special": false,
"text": "\n\n" "text": "\n\n"
}, },
{ {
"id": 8291, "id": 8291,
"logprob": -0.734375, "logprob": -0.8046875,
"special": false, "special": false,
"text": "Here" "text": "Here"
}, },
{ {
"id": 236789, "id": 236789,
"logprob": -0.26367188, "logprob": -0.23828125,
"special": false, "special": false,
"text": "'" "text": "'"
}, },
{ {
"id": 236751, "id": 236751,
"logprob": -1.1920929e-06, "logprob": -1.0728836e-06,
"special": false, "special": false,
"text": "s" "text": "s"
}, },
{ {
"id": 496, "id": 496,
"logprob": -0.15527344, "logprob": -0.17480469,
"special": false, "special": false,
"text": " a" "text": " a"
}, },
{ {
"id": 25890, "id": 25890,
"logprob": -0.08886719, "logprob": -0.087402344,
"special": false, "special": false,
"text": " breakdown" "text": " breakdown"
}, },
{ {
"id": 529, "id": 529,
"logprob": -0.0020446777, "logprob": -0.0021209717,
"special": false, "special": false,
"text": " of" "text": " of"
}, },
{ {
"id": 506, "id": 506,
"logprob": -0.17871094, "logprob": -0.19140625,
"special": false, "special": false,
"text": " the" "text": " the"
}, },
{ {
"id": 5872, "id": 5872,
"logprob": -0.90234375, "logprob": -1.0078125,
"special": false, "special": false,
"text": " factors" "text": " factors"
}, },
{ {
"id": 20894, "id": 20894,
"logprob": -0.25976562, "logprob": -0.26367188,
"special": false, "special": false,
"text": " contributing" "text": " contributing"
}, },
{ {
"id": 531, "id": 531,
"logprob": -8.34465e-05, "logprob": -9.250641e-05,
"special": false, "special": false,
"text": " to" "text": " to"
}, },
{ {
"id": 506, "id": 506,
"logprob": -0.008544922, "logprob": -0.008666992,
"special": false, "special": false,
"text": " the" "text": " the"
}, },
{ {
"id": 5777, "id": 5777,
"logprob": -0.62109375, "logprob": -0.6171875,
"special": false, "special": false,
"text": " wide" "text": " wide"
}, },
{ {
"id": 2644, "id": 2644,
"logprob": -0.0023345947, "logprob": -0.0023956299,
"special": false, "special": false,
"text": " range" "text": " range"
}, },
@ -512,25 +512,25 @@
}, },
{ {
"id": 14287, "id": 14287,
"logprob": -0.011291504, "logprob": -0.011352539,
"special": false, "special": false,
"text": " estimates" "text": " estimates"
}, },
{ {
"id": 573, "id": 573,
"logprob": -0.29101562, "logprob": -0.30664062,
"special": false, "special": false,
"text": " for" "text": " for"
}, },
{ {
"id": 506, "id": 506,
"logprob": -0.21484375, "logprob": -0.21386719,
"special": false, "special": false,
"text": " the" "text": " the"
}, },
{ {
"id": 236743, "id": 236743,
"logprob": -0.2890625, "logprob": -0.35351562,
"special": false, "special": false,
"text": " " "text": " "
}, },
@ -566,19 +566,19 @@
}, },
{ {
"id": 10248, "id": 10248,
"logprob": -0.01953125, "logprob": -0.015258789,
"special": false, "special": false,
"text": " pandemic" "text": " pandemic"
}, },
{ {
"id": 4355, "id": 4355,
"logprob": -0.78515625, "logprob": -0.83203125,
"special": false, "special": false,
"text": " death" "text": " death"
}, },
{ {
"id": 25363, "id": 25363,
"logprob": -6.771088e-05, "logprob": -7.43866e-05,
"special": false, "special": false,
"text": " toll" "text": " toll"
}, },
@ -590,13 +590,13 @@
}, },
{ {
"id": 506, "id": 506,
"logprob": -7.033348e-06, "logprob": -6.67572e-06,
"special": false, "special": false,
"text": " the" "text": " the"
}, },
{ {
"id": 3640, "id": 3640,
"logprob": -0.0067443848, "logprob": -0.0059509277,
"special": false, "special": false,
"text": " United" "text": " United"
}, },

View File

@ -5,7 +5,7 @@
"index": 0, "index": 0,
"logprobs": null, "logprobs": null,
"message": { "message": {
"content": "Here's a description of what's shown in the image:\n\nThe image depicts a brown cow standing on a sandy beach. The beach has turquoise water and a distant island visible in the background. The sky is bright blue with some white clouds. \n\nIt's a humorous and unexpected sight of a cow enjoying a tropical beach!", "content": "Here's a description of what's shown in the image:\n\nThe image depicts a brown cow standing on a sandy beach. The beach has turquoise water and a distant island visible in the background. The sky is bright blue with some white clouds. \n\nIt's a quite a humorous and unusual scene a cow enjoying a day at the beach!",
"name": null, "name": null,
"role": "assistant", "role": "assistant",
"tool_calls": null "tool_calls": null
@ -13,14 +13,14 @@
"usage": null "usage": null
} }
], ],
"created": 1741703756, "created": 1741964480,
"id": "", "id": "",
"model": "gg-hf-g/gemma-3-4b-it", "model": "google/gemma-3-4b-it",
"object": "chat.completion", "object": "chat.completion",
"system_fingerprint": "3.1.2-dev0-native", "system_fingerprint": "3.2.1-dev0-native",
"usage": { "usage": {
"completion_tokens": 70, "completion_tokens": 74,
"prompt_tokens": 277, "prompt_tokens": 275,
"total_tokens": 347 "total_tokens": 349
} }
} }

View File

@ -5,7 +5,7 @@
"index": 0, "index": 0,
"logprobs": null, "logprobs": null,
"message": { "message": {
"content": "Based on the image, the animal is a cow, not a dog! \n\nIt appears to be a **Brazilian cattle breed** known as a **Gir Cow**. They are recognized for their reddish-brown color and distinctive markings.", "content": "That's a fantastic question! However, the image doesn't show a dog. It shows a **Brown Swiss cow** standing on a beach. \n\nBrown Swiss cows are known for their reddish-brown color and distinctive white markings. \n\nIf you'd like, you can send me another image and Ill do my best to identify it!",
"name": null, "name": null,
"role": "assistant", "role": "assistant",
"tool_calls": null "tool_calls": null
@ -13,14 +13,14 @@
"usage": null "usage": null
} }
], ],
"created": 1741703753, "created": 1741964477,
"id": "", "id": "",
"model": "gg-hf-g/gemma-3-4b-it", "model": "google/gemma-3-4b-it",
"object": "chat.completion", "object": "chat.completion",
"system_fingerprint": "3.1.2-dev0-native", "system_fingerprint": "3.2.1-dev0-native",
"usage": { "usage": {
"completion_tokens": 48, "completion_tokens": 75,
"prompt_tokens": 281, "prompt_tokens": 279,
"total_tokens": 329 "total_tokens": 354
} }
} }

View File

@ -49,9 +49,9 @@ async def test_flash_gemma3_image_cow_dog(flash_gemma3, response_snapshot):
assert ( assert (
response.choices[0].message.content response.choices[0].message.content
== "Based on the image, the animal is a cow, not a dog! \n\nIt appears to be a **Brazilian cattle breed** known as a **Gir Cow**. They are recognized for their reddish-brown color and distinctive markings." == "That's a fantastic question! However, the image doesn't show a dog. It shows a **Brown Swiss cow** standing on a beach. \n\nBrown Swiss cows are known for their reddish-brown color and distinctive white markings. \n\nIf you'd like, you can send me another image and Ill do my best to identify it!"
) )
assert response.usage["completion_tokens"] == 48 assert response.usage["completion_tokens"] == 75
assert response == response_snapshot assert response == response_snapshot
@ -72,19 +72,22 @@ async def test_flash_gemma3_image_cow(flash_gemma3, response_snapshot):
) )
assert ( assert (
response.choices[0].message.content response.choices[0].message.content
== "Here's a description of what's shown in the image:\n\nThe image depicts a brown cow standing on a sandy beach. The beach has turquoise water and a distant island visible in the background. The sky is bright blue with some white clouds. \n\nIt's a humorous and unexpected sight of a cow enjoying a tropical beach!" == "Here's a description of what's shown in the image:\n\nThe image depicts a brown cow standing on a sandy beach. The beach has turquoise water and a distant island visible in the background. The sky is bright blue with some white clouds. \n\nIt's a quite a humorous and unusual scene a cow enjoying a day at the beach!"
) )
assert response.usage["completion_tokens"] == 70 assert response.usage["completion_tokens"] == 74
assert response == response_snapshot assert response == response_snapshot
async def test_exceed_window(flash_gemma3, response_snapshot): async def test_exceed_window(flash_gemma3, response_snapshot):
response = await flash_gemma3.generate( response = await flash_gemma3.generate(
"This is a nice place. " * 800 + "Now count: 1, 2, 3", "This is a nice place. " * 800 + "I really enjoy the scenery,",
seed=42, seed=42,
max_new_tokens=20, max_new_tokens=20,
) )
assert response.generated_text == ", 4, 5, 6, 7, 8, 9, " assert (
assert response.details.generated_tokens == 20 response.generated_text
== " the people, and the food.\n\nThis is a nice place.\n"
)
assert response.details.generated_tokens == 16
assert response == response_snapshot assert response == response_snapshot