diff --git a/tests/test_prediction.py b/tests/test_prediction.py index 96c2f778ee93264fa67501dd40e38282acf8b77f..b65c749416d1676b9fd5cd20a7cbcaf872e376bc 100644 --- a/tests/test_prediction.py +++ b/tests/test_prediction.py @@ -506,27 +506,38 @@ def test_run_prediction_batch( { "text": "ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…Patron?12241", "language_model": { +<<<<<<< HEAD <<<<<<< HEAD "text": "ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…Patron?12241", "confidence": 0.92, ======= "text": "ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…Patron?12241" >>>>>>> c80c413 (Write tests for LM decoding) +======= + "text": "ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…Patron?12241", + "confidence": 0.9226743371961854, +>>>>>>> e1ebd55 (Fix tests) }, }, { "text": "ⓈTemplié â’»Marcelle â’·93 â“S â“€ch â“„E dactylo â“…18376", "language_model": { +<<<<<<< HEAD <<<<<<< HEAD "text": "ⓈTemplié â’»Marcelle â’·93 â“S â“€ch â“„E dactylo â“…18376", "confidence": 0.88, ======= "text": "ⓈTemplié â’»Marcelle â’·93 â“S â“€ch â“„E dactylo â“…18376" >>>>>>> c80c413 (Write tests for LM decoding) +======= + "text": "ⓈTemplié â’»Marcelle â’·93 â“S â“€ch â“„E dactylo â“…18376", + "confidence": 0.8759829104754289, +>>>>>>> e1ebd55 (Fix tests) }, }, { "text": "Ⓢd â’»Charles â’·11 â“P â’¸C â“€F â“„d â“…14 31", +<<<<<<< HEAD <<<<<<< HEAD "language_model": { "text": "Ⓢd â’»Charles â’·11 â“P â’¸C â“€F â“„d â“…14 31", @@ -546,6 +557,19 @@ def test_run_prediction_batch( "text": "ⓈNaudin â’»Marie â’·53 â“S â’¸v â“€Belle mère", "language_model": {"text": "ⓈNaudin â’»Marie â’·53 â“S â’¸v â“€Belle mère"}, >>>>>>> c80c413 (Write tests for LM decoding) +======= + "language_model": { + "text": "Ⓢd â’»Charles â’·11 â“P â’¸C â“€F â“„d â“…14 31", + "confidence": 0.864021797502254, + }, + }, + { + "text": "ⓈNaudin â’»Marie â’·53 â“S â’¸v â“€Belle mère", + "language_model": { + "text": "ⓈNaudin â’»Marie â’·53 â“S â’¸v â“€Belle mère", + "confidence": 0.8903665579889012, + }, +>>>>>>> e1ebd55 (Fix tests) }, ], ), @@ -561,27 +585,38 @@ def test_run_prediction_batch( { "text": "ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…Patron?12241", "language_model": { +<<<<<<< HEAD <<<<<<< HEAD "text": "ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…Patron?12241", "confidence": 0.90, ======= "text": "ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…Patron?12241" >>>>>>> c80c413 (Write tests for LM decoding) +======= + "text": "ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…Patron?12241", + "confidence": 0.8982517863786614, +>>>>>>> e1ebd55 (Fix tests) }, }, { "text": "ⓈTemplié â’»Marcelle â’·93 â“S â“€ch â“„E dactylo â“…18376", "language_model": { +<<<<<<< HEAD <<<<<<< HEAD "text": "ⓈTemplié â’»Marcelle â’·93 â“S â“€ch â“„E dactylo â“…18376", "confidence": 0.84, ======= "text": "ⓈTemplié â’»Marcelle â’·93 â“S â“€ch â“„E dactylo â“…18376" >>>>>>> c80c413 (Write tests for LM decoding) +======= + "text": "ⓈTemplié â’»Marcelle â’·93 â“S â“€ch â“„E dactylo â“…18376", + "confidence": 0.8386571587822831, +>>>>>>> e1ebd55 (Fix tests) }, }, { "text": "Ⓢd â’»Charles â’·11 â“P â’¸C â“€F â“„d â“…14 31", +<<<<<<< HEAD <<<<<<< HEAD "language_model": { "text": "Ⓢd â’»Charles â’·11 â“P â’¸C â“€F â“„d â“…14331", @@ -601,6 +636,19 @@ def test_run_prediction_batch( "text": "ⓈNaudin â’»Marie â’·53 â“S â’¸v â“€Belle mère", "language_model": {"text": "ⓈNaudin â’»Marie â’·53 â“S â’¸v â“€Belle mère"}, >>>>>>> c80c413 (Write tests for LM decoding) +======= + "language_model": { + "text": "Ⓢd â’»Charles â’·11 â“P â’¸C â“€F â“„d â“…14331", + "confidence": 0.8334836549049839, + }, + }, + { + "text": "ⓈNaudin â’»Marie â’·53 â“S â’¸v â“€Belle mère", + "language_model": { + "text": "ⓈNaudin â’»Marie â’·53 â“S â’¸v â“€Belle mère", + "confidence": 0.8565623750166133, + }, +>>>>>>> e1ebd55 (Fix tests) }, ], ), @@ -622,17 +670,23 @@ def test_run_prediction_batch( ), ) <<<<<<< HEAD +<<<<<<< HEAD ======= @pytest.mark.parametrize("batch_size", [1, 2]) >>>>>>> c80c413 (Write tests for LM decoding) +======= +>>>>>>> e1ebd55 (Fix tests) def test_run_prediction_language_model( image_names, language_model_weight, expected_predictions, <<<<<<< HEAD +<<<<<<< HEAD ======= batch_size, >>>>>>> c80c413 (Write tests for LM decoding) +======= +>>>>>>> e1ebd55 (Fix tests) tmp_path, ): # Make tmpdir and copy needed images inside @@ -674,11 +728,15 @@ def test_run_prediction_language_model( max_object_height=None, image_extension=".png", gpu_device=None, +<<<<<<< HEAD <<<<<<< HEAD batch_size=1, ======= batch_size=batch_size, >>>>>>> c80c413 (Write tests for LM decoding) +======= + batch_size=1, +>>>>>>> e1ebd55 (Fix tests) tokens=parse_tokens(PREDICTION_DATA_PATH / "tokens.yml"), start_token=None, use_language_model=True, @@ -691,14 +749,24 @@ def test_run_prediction_language_model( assert prediction["text"] == expected_prediction["text"] if language_model_weight > 0: + print( + prediction["language_model"]["text"], + prediction["language_model"]["confidence"], + ) assert ( prediction["language_model"]["text"] == expected_prediction["language_model"]["text"] ) <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> e1ebd55 (Fix tests) assert np.isclose( prediction["language_model"]["confidence"], expected_prediction["language_model"]["confidence"], ) +<<<<<<< HEAD ======= >>>>>>> c80c413 (Write tests for LM decoding) +======= +>>>>>>> e1ebd55 (Fix tests)