jupyterjazz commited on
Commit
76705e2
·
verified ·
1 Parent(s): 7bf3b86

refactor-remove-is-single (#10)

Browse files

- refactor: remove checking for single inputs (3dd1f9db83b070294f7fd184ba3bf2fb5dad46b5)

Files changed (1) hide show
  1. modeling_jina_embeddings_v4.py +2 -4
modeling_jina_embeddings_v4.py CHANGED
@@ -398,7 +398,6 @@ class JinaEmbeddingsV4Model(Qwen2_5_VLForConditionalGeneration):
398
  prefix=encode_kwargs.pop("prefix"),
399
  )
400
 
401
- is_single = len(texts) == 1
402
  embeddings = self._process_batches(
403
  data=texts,
404
  processor_fn=processor_fn,
@@ -408,7 +407,7 @@ class JinaEmbeddingsV4Model(Qwen2_5_VLForConditionalGeneration):
408
  **encode_kwargs,
409
  )
410
 
411
- return embeddings[0] if is_single else embeddings
412
 
413
  def encode_images(
414
  self,
@@ -439,7 +438,6 @@ class JinaEmbeddingsV4Model(Qwen2_5_VLForConditionalGeneration):
439
 
440
  encode_kwargs = self._validate_encoding_params(vector_type, truncate_dim)
441
 
442
- is_single = len(images) == 1
443
  embeddings = self._process_batches(
444
  data=images,
445
  processor_fn=self.processor.process_images,
@@ -452,7 +450,7 @@ class JinaEmbeddingsV4Model(Qwen2_5_VLForConditionalGeneration):
452
  if max_pixels:
453
  self.processor.image_processor.max_pixels = default_max_pixels
454
 
455
- return embeddings[0] if is_single else embeddings
456
 
457
  @classmethod
458
  def from_pretrained(
 
398
  prefix=encode_kwargs.pop("prefix"),
399
  )
400
 
 
401
  embeddings = self._process_batches(
402
  data=texts,
403
  processor_fn=processor_fn,
 
407
  **encode_kwargs,
408
  )
409
 
410
+ return embeddings
411
 
412
  def encode_images(
413
  self,
 
438
 
439
  encode_kwargs = self._validate_encoding_params(vector_type, truncate_dim)
440
 
 
441
  embeddings = self._process_batches(
442
  data=images,
443
  processor_fn=self.processor.process_images,
 
450
  if max_pixels:
451
  self.processor.image_processor.max_pixels = default_max_pixels
452
 
453
+ return embeddings
454
 
455
  @classmethod
456
  def from_pretrained(