diff --git a/integration-tests/models/__snapshots__/test_flash_gemma3/test_exceed_window.json b/integration-tests/models/__snapshots__/test_flash_gemma3/test_exceed_window.json index ec8cd4f6..5c6b4cb9 100644 --- a/integration-tests/models/__snapshots__/test_flash_gemma3/test_exceed_window.json +++ b/integration-tests/models/__snapshots__/test_flash_gemma3/test_exceed_window.json @@ -1,133 +1,109 @@ { "details": { "best_of_sequences": null, - "finish_reason": "length", - "generated_tokens": 20, + "finish_reason": "eos_token", + "generated_tokens": 16, "prefill": [], "seed": null, "tokens": [ + { + "id": 506, + "logprob": -1.3984375, + "special": false, + "text": " the" + }, + { + "id": 1331, + "logprob": -1.6953125, + "special": false, + "text": " people" + }, { "id": 236764, - "logprob": -0.44726562, + "logprob": -0.23535156, "special": false, "text": "," }, { - "id": 236743, - "logprob": -0.011413574, + "id": 532, + "logprob": -0.24316406, "special": false, - "text": " " + "text": " and" }, { - "id": 236812, - "logprob": -0.09814453, + "id": 506, + "logprob": -0.12109375, "special": false, - "text": "4" + "text": " the" }, { - "id": 236764, - "logprob": -0.044189453, + "id": 2780, + "logprob": -1.1640625, "special": false, - "text": "," + "text": " food" }, { - "id": 236743, - "logprob": -0.15625, + "id": 236761, + "logprob": -0.21386719, "special": false, - "text": " " + "text": "." }, { - "id": 236810, - "logprob": -0.010864258, + "id": 108, + "logprob": -0.64453125, "special": false, - "text": "5" + "text": "\n\n" }, { - "id": 236764, - "logprob": -0.040039062, + "id": 2094, + "logprob": -0.77734375, "special": false, - "text": "," + "text": "This" }, { - "id": 236743, - "logprob": -0.26757812, + "id": 563, + "logprob": -0.040283203, "special": false, - "text": " " + "text": " is" }, { - "id": 236825, - "logprob": -0.0047302246, + "id": 496, + "logprob": -0.03125, "special": false, - "text": "6" + "text": " a" }, { - "id": 236764, - "logprob": -0.026123047, + "id": 6290, + "logprob": -0.03515625, "special": false, - "text": "," + "text": " nice" }, { - "id": 236743, - "logprob": -0.265625, + "id": 1977, + "logprob": -0.0020751953, "special": false, - "text": " " + "text": " place" }, { - "id": 236832, - "logprob": -0.014160156, + "id": 236761, + "logprob": -0.0079956055, "special": false, - "text": "7" + "text": "." }, { - "id": 236764, - "logprob": -0.013977051, + "id": 107, + "logprob": -0.9921875, "special": false, - "text": "," + "text": "\n" }, { - "id": 236743, - "logprob": -0.103515625, - "special": false, - "text": " " - }, - { - "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": " " + "id": 106, + "logprob": -0.45507812, + "special": true, + "text": "" } ], "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" } diff --git a/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3.json b/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3.json index 1324555a..859544c8 100644 --- a/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3.json +++ b/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3.json @@ -8,31 +8,31 @@ "tokens": [ { "id": 1331, - "logprob": -0.32421875, + "logprob": -0.34960938, "special": false, "text": " people" }, { "id": 8390, - "logprob": -0.15332031, + "logprob": -0.14746094, "special": false, "text": " died" }, { "id": 528, - "logprob": -1.140625, + "logprob": -1.2265625, "special": false, "text": " in" }, { "id": 506, - "logprob": -0.42578125, + "logprob": -0.47070312, "special": false, "text": " the" }, { "id": 3640, - "logprob": -0.64453125, + "logprob": -0.5859375, "special": false, "text": " United" }, @@ -44,31 +44,31 @@ }, { "id": 236761, - "logprob": -0.37890625, + "logprob": -0.34765625, "special": false, "text": "." }, { "id": 108, - "logprob": -0.08300781, + "logprob": -0.0859375, "special": false, "text": "\n\n" }, { "id": 818, - "logprob": -1.1796875, + "logprob": -1.1640625, "special": false, "text": "The" }, { "id": 6816, - "logprob": -1.765625, + "logprob": -1.890625, "special": false, "text": " generally" }, { "id": 10951, - "logprob": -0.14550781, + "logprob": -0.14648438, "special": false, "text": " accepted" }, @@ -86,49 +86,49 @@ }, { "id": 600, - "logprob": -0.65625, + "logprob": -0.65234375, "special": false, "text": " that" }, { "id": 236743, - "logprob": -1.1796875, + "logprob": -1.2109375, "special": false, "text": " " }, { "id": 236825, - "logprob": -0.0009918213, + "logprob": -0.00088119507, "special": false, "text": "6" }, { "id": 236832, - "logprob": -6.532669e-05, + "logprob": -6.580353e-05, "special": false, "text": "7" }, { "id": 236810, - "logprob": -4.863739e-05, + "logprob": -5.2690506e-05, "special": false, "text": "5" }, { "id": 236764, - "logprob": -0.00017929077, + "logprob": -0.0001745224, "special": false, "text": "," }, { "id": 236771, - "logprob": -1.2397766e-05, + "logprob": -1.180172e-05, "special": false, "text": "0" }, { "id": 236771, - "logprob": -2.1457672e-06, + "logprob": -1.7881393e-06, "special": false, "text": "0" }, @@ -140,7 +140,7 @@ }, { "id": 1331, - "logprob": -0.50390625, + "logprob": -0.44921875, "special": false, "text": " people" }, @@ -152,67 +152,67 @@ }, { "id": 528, - "logprob": -0.08496094, + "logprob": -0.084472656, "special": false, "text": " in" }, { "id": 506, - "logprob": -0.0003299713, + "logprob": -0.00034713745, "special": false, "text": " the" }, { "id": 3640, - "logprob": -0.028442383, + "logprob": -0.028564453, "special": false, "text": " United" }, { "id": 4184, - "logprob": -0.00011014938, + "logprob": -0.00012207031, "special": false, "text": " States" }, { "id": 236761, - "logprob": -1.1796875, + "logprob": -1.15625, "special": false, "text": "." }, { "id": 3153, - "logprob": -0.104003906, + "logprob": -0.103027344, "special": false, "text": " However" }, { "id": 236764, - "logprob": -0.009094238, + "logprob": -0.009155273, "special": false, "text": "," }, { "id": 1070, - "logprob": -0.88671875, + "logprob": -0.92578125, "special": false, "text": " some" }, { "id": 61806, - "logprob": -0.84765625, + "logprob": -0.91796875, "special": false, "text": " historians" }, { "id": 4646, - "logprob": -1.34375, + "logprob": -1.3828125, "special": false, "text": " believe" }, { "id": 506, - "logprob": -0.59375, + "logprob": -0.65234375, "special": false, "text": " the" }, @@ -230,7 +230,7 @@ }, { "id": 1451, - "logprob": -0.60546875, + "logprob": -0.66015625, "special": false, "text": " could" }, @@ -242,73 +242,73 @@ }, { "id": 618, - "logprob": -0.61328125, + "logprob": -0.57421875, "special": false, "text": " as" }, { "id": 1494, - "logprob": -0.00033569336, + "logprob": -0.00036239624, "special": false, "text": " high" }, { "id": 618, - "logprob": -0.0001411438, + "logprob": -0.0001335144, "special": false, "text": " as" }, { "id": 236743, - "logprob": -0.001045227, + "logprob": -0.0009689331, "special": false, "text": " " }, { "id": 236770, - "logprob": -0.21289062, + "logprob": -0.26367188, "special": false, "text": "1" }, { "id": 236771, - "logprob": -0.13378906, + "logprob": -0.17773438, "special": false, "text": "0" }, { "id": 3625, - "logprob": -0.0087890625, + "logprob": -0.012084961, "special": false, "text": " million" }, { "id": 236761, - "logprob": -0.2109375, + "logprob": -0.21289062, "special": false, "text": "." }, { "id": 108, - "logprob": -0.39453125, + "logprob": -0.37304688, "special": false, "text": "\n\n" }, { "id": 236777, - "logprob": -1.1328125, + "logprob": -1.078125, "special": false, "text": "I" }, { "id": 1006, - "logprob": -1.4140625, + "logprob": -1.3203125, "special": false, "text": " am" }, { "id": 3182, - "logprob": -1.15625, + "logprob": -1.078125, "special": false, "text": " looking" }, @@ -320,13 +320,13 @@ }, { "id": 919, - "logprob": -1.2734375, + "logprob": -1.25, "special": false, "text": " more" }, { "id": 1938, - "logprob": -1.2265625, + "logprob": -1.2421875, "special": false, "text": " information" }, @@ -338,169 +338,169 @@ }, { "id": 672, - "logprob": -0.77734375, + "logprob": -0.73046875, "special": false, "text": " this" }, { "id": 59725, - "logprob": -0.70703125, + "logprob": -0.75, "special": false, "text": " discrepancy" }, { "id": 532, - "logprob": -0.8515625, + "logprob": -0.83984375, "special": false, "text": " and" }, { "id": 506, - "logprob": -0.65625, + "logprob": -0.7109375, "special": false, "text": " the" }, { "id": 5872, - "logprob": -1.15625, + "logprob": -1.2734375, "special": false, "text": " factors" }, { "id": 600, - "logprob": -0.2265625, + "logprob": -0.22851562, "special": false, "text": " that" }, { "id": 19263, - "logprob": -1.125, + "logprob": -1.1640625, "special": false, "text": " contributed" }, { "id": 531, - "logprob": -0.001083374, + "logprob": -0.0010757446, "special": false, "text": " to" }, { "id": 506, - "logprob": -0.2109375, + "logprob": -0.18945312, "special": false, "text": " the" }, { "id": 5777, - "logprob": -1.21875, + "logprob": -1.2734375, "special": false, "text": " wide" }, { "id": 2644, - "logprob": -0.018310547, + "logprob": -0.01940918, "special": false, "text": " range" }, { "id": 529, - "logprob": -0.12988281, + "logprob": -0.14550781, "special": false, "text": " of" }, { "id": 14287, - "logprob": -0.03564453, + "logprob": -0.032470703, "special": false, "text": " estimates" }, { "id": 236761, - "logprob": -0.010314941, + "logprob": -0.010375977, "special": false, "text": "." }, { "id": 108, - "logprob": -0.060546875, + "logprob": -0.06591797, "special": false, "text": "\n\n" }, { "id": 8291, - "logprob": -0.734375, + "logprob": -0.8046875, "special": false, "text": "Here" }, { "id": 236789, - "logprob": -0.26367188, + "logprob": -0.23828125, "special": false, "text": "'" }, { "id": 236751, - "logprob": -1.1920929e-06, + "logprob": -1.0728836e-06, "special": false, "text": "s" }, { "id": 496, - "logprob": -0.15527344, + "logprob": -0.17480469, "special": false, "text": " a" }, { "id": 25890, - "logprob": -0.08886719, + "logprob": -0.087402344, "special": false, "text": " breakdown" }, { "id": 529, - "logprob": -0.0020446777, + "logprob": -0.0021209717, "special": false, "text": " of" }, { "id": 506, - "logprob": -0.17871094, + "logprob": -0.19140625, "special": false, "text": " the" }, { "id": 5872, - "logprob": -0.90234375, + "logprob": -1.0078125, "special": false, "text": " factors" }, { "id": 20894, - "logprob": -0.25976562, + "logprob": -0.26367188, "special": false, "text": " contributing" }, { "id": 531, - "logprob": -8.34465e-05, + "logprob": -9.250641e-05, "special": false, "text": " to" }, { "id": 506, - "logprob": -0.008544922, + "logprob": -0.008666992, "special": false, "text": " the" }, { "id": 5777, - "logprob": -0.62109375, + "logprob": -0.6171875, "special": false, "text": " wide" }, { "id": 2644, - "logprob": -0.0023345947, + "logprob": -0.0023956299, "special": false, "text": " range" }, @@ -512,25 +512,25 @@ }, { "id": 14287, - "logprob": -0.011291504, + "logprob": -0.011352539, "special": false, "text": " estimates" }, { "id": 573, - "logprob": -0.29101562, + "logprob": -0.30664062, "special": false, "text": " for" }, { "id": 506, - "logprob": -0.21484375, + "logprob": -0.21386719, "special": false, "text": " the" }, { "id": 236743, - "logprob": -0.2890625, + "logprob": -0.35351562, "special": false, "text": " " }, @@ -566,19 +566,19 @@ }, { "id": 10248, - "logprob": -0.01953125, + "logprob": -0.015258789, "special": false, "text": " pandemic" }, { "id": 4355, - "logprob": -0.78515625, + "logprob": -0.83203125, "special": false, "text": " death" }, { "id": 25363, - "logprob": -6.771088e-05, + "logprob": -7.43866e-05, "special": false, "text": " toll" }, @@ -590,13 +590,13 @@ }, { "id": 506, - "logprob": -7.033348e-06, + "logprob": -6.67572e-06, "special": false, "text": " the" }, { "id": 3640, - "logprob": -0.0067443848, + "logprob": -0.0059509277, "special": false, "text": " United" }, diff --git a/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_cow.json b/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_cow.json index 6c30ada4..cd786b3c 100644 --- a/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_cow.json +++ b/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_cow.json @@ -5,7 +5,7 @@ "index": 0, "logprobs": null, "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, "role": "assistant", "tool_calls": null @@ -13,14 +13,14 @@ "usage": null } ], - "created": 1741703756, + "created": 1741964480, "id": "", - "model": "gg-hf-g/gemma-3-4b-it", + "model": "google/gemma-3-4b-it", "object": "chat.completion", - "system_fingerprint": "3.1.2-dev0-native", + "system_fingerprint": "3.2.1-dev0-native", "usage": { - "completion_tokens": 70, - "prompt_tokens": 277, - "total_tokens": 347 + "completion_tokens": 74, + "prompt_tokens": 275, + "total_tokens": 349 } } diff --git a/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_cow_dog.json b/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_cow_dog.json index fe67c995..5ed2c450 100644 --- a/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_cow_dog.json +++ b/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_cow_dog.json @@ -5,7 +5,7 @@ "index": 0, "logprobs": null, "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 I’ll do my best to identify it!", "name": null, "role": "assistant", "tool_calls": null @@ -13,14 +13,14 @@ "usage": null } ], - "created": 1741703753, + "created": 1741964477, "id": "", - "model": "gg-hf-g/gemma-3-4b-it", + "model": "google/gemma-3-4b-it", "object": "chat.completion", - "system_fingerprint": "3.1.2-dev0-native", + "system_fingerprint": "3.2.1-dev0-native", "usage": { - "completion_tokens": 48, - "prompt_tokens": 281, - "total_tokens": 329 + "completion_tokens": 75, + "prompt_tokens": 279, + "total_tokens": 354 } } diff --git a/integration-tests/models/test_flash_gemma3.py b/integration-tests/models/test_flash_gemma3.py index 022d2c47..1df85b34 100644 --- a/integration-tests/models/test_flash_gemma3.py +++ b/integration-tests/models/test_flash_gemma3.py @@ -49,9 +49,9 @@ async def test_flash_gemma3_image_cow_dog(flash_gemma3, response_snapshot): assert ( 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 I’ll do my best to identify it!" ) - assert response.usage["completion_tokens"] == 48 + assert response.usage["completion_tokens"] == 75 assert response == response_snapshot @@ -72,19 +72,22 @@ async def test_flash_gemma3_image_cow(flash_gemma3, response_snapshot): ) assert ( 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 async def test_exceed_window(flash_gemma3, response_snapshot): 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, max_new_tokens=20, ) - assert response.generated_text == ", 4, 5, 6, 7, 8, 9, " - assert response.details.generated_tokens == 20 + assert ( + 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