Skip to content

Commit

Permalink
fix: image size uneven across unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfeil committed Oct 16, 2024
1 parent 8c50da2 commit c263a4c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libs/infinity_emb/infinity_emb/transformer/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def encode_post(

def warmup(self, *, batch_size: int = 64, n_tokens=1) -> tuple[float, float, str]:
sample_text = ["warm " * n_tokens] * max(1, batch_size // 2)
sample_image = [Image.new("RGB", (100, 1000), (255, 255, 255))] * max(1, batch_size // 2) # type: ignore
sample_image = [Image.new("RGB", (128, 128), (255, 255, 255))] * max(1, batch_size // 2) # type: ignore
inp = [
# TODO: warmup for images
ImageInner(content=ImageSingle(image=img), future=None) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, *, engine_args: "EngineArgs"):
)
config = AutoConfig.from_pretrained(**base_config)
self.is_colipali = config.architectures[0] in IMAGE_COL_MODELS
self.mock_image = Image.new("RGB", (16, 16), color="black")
self.mock_image = Image.new("RGB", (128, 128), color="black")

extra_model_args = dict(**base_config)
extra_processor_args = dict(**base_config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def test_colpali(dtype, image_sample):
images = [
image,
image,
Image.new("RGB", (32, 32), color="white"),
Image.new("RGB", (16, 16), color="black"),
Image.new("RGB", (128, 128), color="white"),
Image.new("RGB", (128, 128), color="black"),
]
queries = [
"a photo of a cat",
Expand Down

0 comments on commit c263a4c

Please sign in to comment.