[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
Этот коммит содержится в:
pre-commit-ci[bot] 2023-03-27 13:27:11 +00:00
родитель e889fb95f7
Коммит fc04ee12d8

Просмотреть файл

@ -370,7 +370,8 @@ sorted_clip_vitl14_336 = [
[6, 5, 4, 10, 2, 3, 0, 1, 11, 7, 9, 8], [6, 5, 4, 10, 2, 3, 0, 1, 11, 7, 9, 8],
] ]
itm_scores_for_blib_base = [0.09277121722698212, itm_scores_for_blib_base = [
0.09277121722698212,
0.020782141014933586, 0.020782141014933586,
0.020832309499382973, 0.020832309499382973,
0.004225197248160839, 0.004225197248160839,
@ -381,7 +382,8 @@ itm_scores_for_blib_base = [0.09277121722698212,
1.9936736862291582e-05, 1.9936736862291582e-05,
4.0083985368255526e-05, 4.0083985368255526e-05,
0.0006117734010331333, 0.0006117734010331333,
4.1486648115096614e-05] 4.1486648115096614e-05,
]
@pytest.mark.parametrize( @pytest.mark.parametrize(
@ -627,9 +629,12 @@ def test_parsing_images(
del model, vis_processor, txt_processor del model, vis_processor, txt_processor
cuda.empty_cache() cuda.empty_cache()
if (pre_model == "blip"): if pre_model == "blip":
for itm_model in ["blip_base", "blip_large", "blip2_coco"]: for itm_model in ["blip_base", "blip_large", "blip2_coco"]:
itm_scores, image_gradcam_with_itm = ms.MultimodalSearch.image_text_match_reordering( (
itm_scores,
image_gradcam_with_itm,
) = ms.MultimodalSearch.image_text_match_reordering(
testdict, testdict,
search_query2, search_query2,
itm_model, itm_model,
@ -638,15 +643,12 @@ def test_parsing_images(
batch_size=1, batch_size=1,
need_grad_cam=True, need_grad_cam=True,
) )
for i,itm in zip(range(len(itm_scores_for_blib_base)), itm_scores_for_blib_base): for i, itm in zip(
range(len(itm_scores_for_blib_base)), itm_scores_for_blib_base
):
assert ( assert (
math.isclose(itm_scores[0].tolist()[i], itm, rel_tol = 100*related_error) is True math.isclose(
itm_scores[0].tolist()[i], itm, rel_tol=100 * related_error
)
is True
) )