ray-embedding 0.9.5__py3-none-any.whl → 0.9.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ray-embedding might be problematic. Click here for more details.

@@ -59,8 +59,8 @@ class EmbeddingModel:
59
59
  async def reconfigure(self, user_config: Dict):
60
60
  assert "max_batch_size" in user_config and "batch_wait_timeout_s" in user_config, "Invalid user config"
61
61
  self.logger.info(f"Reconfiguring dynamic batching parameters: {user_config}")
62
- self.create_embeddings_batch.set_max_batch_size(user_config["max_batch_size"])
63
- self.create_embeddings_batch.set_batch_wait_timeout_s(user_config["batch_wait_timeout_s"])
62
+ self.__create_embeddings_batch.set_max_batch_size(user_config["max_batch_size"])
63
+ self.__create_embeddings_batch.set_batch_wait_timeout_s(user_config["batch_wait_timeout_s"])
64
64
 
65
65
  @web_api.post("/v1/embeddings", response_model=EmbeddingResponse)
66
66
  async def create_embeddings(self, request: EmbeddingRequest):
@@ -69,20 +69,22 @@ class EmbeddingModel:
69
69
  assert request.model == self.served_model_name, (
70
70
  f"Model '{request.model}' is not supported. Use '{self.served_model_name}' instead."
71
71
  )
72
- return await self.create_embeddings_batch(request)
72
+ request.dimensions = request.dimensions or self.matryoshka_dim
73
+ return await self.__create_embeddings_batch(request)
73
74
  except Exception as e:
74
75
  self.logger.error(e)
75
76
  raise HTTPException(status_code=500, detail=str(e))
76
77
 
77
78
  @serve.batch(max_batch_size=8, batch_wait_timeout_s=0.25)
78
- async def create_embeddings_batch(self, requests: List[EmbeddingRequest]) -> List[EmbeddingResponse]:
79
+ async def __create_embeddings_batch(self, requests_batch: List[EmbeddingRequest]) -> List[EmbeddingResponse]:
79
80
  # Batch the text inputs
80
- inputs = [], truncate_dims = []
81
- for request in requests:
81
+ inputs = []
82
+ truncate_dims = []
83
+ for request in requests_batch:
82
84
  if isinstance(request.input, str):
83
85
  request.input = [request.input]
84
86
  inputs.extend(request.input)
85
- truncate_dims.append(request.dimensions or self.matryoshka_dim)
87
+ truncate_dims.append(request.dimensions)
86
88
 
87
89
  # Compute embeddings for the batch of text inputs
88
90
  embeddings = self.embedding_model.encode(
@@ -93,7 +95,7 @@ class EmbeddingModel:
93
95
  # so we need to this step one by one
94
96
  results = []
95
97
  ix = 0
96
- for truncate_dim, request in zip(truncate_dims, requests):
98
+ for truncate_dim, request in zip(truncate_dims, requests_batch):
97
99
  num_inputs = len(request.input)
98
100
  batch_embeddings = embeddings[ix: ix + num_inputs]
99
101
  ix += num_inputs
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ray-embedding
3
- Version: 0.9.5
3
+ Version: 0.9.7
4
4
  Summary: Deploy SentenceTransformers embedding models to a ray cluster
5
5
  Author: Crispin Almodovar
6
6
  Author-email: crispin.almodovar@docorto.ai
@@ -0,0 +1,8 @@
1
+ ray_embedding/__init__.py,sha256=OYJT0rVaaGzY613JqgfktsCgroDnBkGOHxR2FE9UtRU,49
2
+ ray_embedding/deploy.py,sha256=YD_udSm13QbFPgSAkCrTQso15DmtIn0QEhErOFNg7jM,1841
3
+ ray_embedding/dto.py,sha256=e91ejZbM_NB9WTjF1YnfuV71cajYIh0vOX8oV_g2OwM,595
4
+ ray_embedding/embedding_model.py,sha256=jliy8iRGEbYBfhhnyopVq2fNj0naPsNpvzEaIcNYEe0,5194
5
+ ray_embedding-0.9.7.dist-info/METADATA,sha256=dxTq3Zc1IJ69LIGdHdnr6shquTGo_opXbpG_9Is_XWk,712
6
+ ray_embedding-0.9.7.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
7
+ ray_embedding-0.9.7.dist-info/top_level.txt,sha256=ziCblpJq1YsrryshFqxTRuRMgNuO1_tgvAAkGShATNA,14
8
+ ray_embedding-0.9.7.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- ray_embedding/__init__.py,sha256=OYJT0rVaaGzY613JqgfktsCgroDnBkGOHxR2FE9UtRU,49
2
- ray_embedding/deploy.py,sha256=YD_udSm13QbFPgSAkCrTQso15DmtIn0QEhErOFNg7jM,1841
3
- ray_embedding/dto.py,sha256=e91ejZbM_NB9WTjF1YnfuV71cajYIh0vOX8oV_g2OwM,595
4
- ray_embedding/embedding_model.py,sha256=xV-yK24okharTuSMJPCEe1hM29KdTu6Uozqu01bSulg,5107
5
- ray_embedding-0.9.5.dist-info/METADATA,sha256=pJtyTgr9BQMq4gF7yyOrgCUQsmjTU4sKtgBPaeTJKqk,712
6
- ray_embedding-0.9.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
7
- ray_embedding-0.9.5.dist-info/top_level.txt,sha256=ziCblpJq1YsrryshFqxTRuRMgNuO1_tgvAAkGShATNA,14
8
- ray_embedding-0.9.5.dist-info/RECORD,,