ray-embedding 0.9.6__tar.gz → 0.9.8__tar.gz
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.
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/PKG-INFO +1 -1
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/ray_embedding/embedding_model.py +5 -3
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/ray_embedding.egg-info/PKG-INFO +1 -1
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/setup.cfg +1 -1
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/README.md +0 -0
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/pyproject.toml +0 -0
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/ray_embedding/__init__.py +0 -0
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/ray_embedding/deploy.py +0 -0
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/ray_embedding/dto.py +0 -0
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/ray_embedding.egg-info/SOURCES.txt +0 -0
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/ray_embedding.egg-info/dependency_links.txt +0 -0
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/ray_embedding.egg-info/top_level.txt +0 -0
- {ray_embedding-0.9.6 → ray_embedding-0.9.8}/test/test.py +0 -0
|
@@ -76,6 +76,8 @@ class EmbeddingModel:
|
|
|
76
76
|
|
|
77
77
|
@serve.batch(max_batch_size=8, batch_wait_timeout_s=0.25)
|
|
78
78
|
async def __create_embeddings_batch(self, requests_batch: List[EmbeddingRequest]) -> List[EmbeddingResponse]:
|
|
79
|
+
self_0 = self[0] if isinstance(self, list) else self
|
|
80
|
+
|
|
79
81
|
# Batch the text inputs
|
|
80
82
|
inputs = []
|
|
81
83
|
truncate_dims = []
|
|
@@ -83,12 +85,12 @@ class EmbeddingModel:
|
|
|
83
85
|
if isinstance(request.input, str):
|
|
84
86
|
request.input = [request.input]
|
|
85
87
|
inputs.extend(request.input)
|
|
86
|
-
truncate_dims.append(request.dimensions or
|
|
88
|
+
truncate_dims.append(request.dimensions or self_0.matryoshka_dim)
|
|
87
89
|
|
|
88
90
|
# Compute embeddings for the batch of text inputs
|
|
89
|
-
embeddings =
|
|
91
|
+
embeddings = self_0.embedding_model.encode(
|
|
90
92
|
inputs, convert_to_tensor=True, normalize_embeddings=True, show_progress_bar=False,
|
|
91
|
-
).to(
|
|
93
|
+
).to(self_0.torch_device)
|
|
92
94
|
|
|
93
95
|
# Truncate the embeddings; note that the truncate_dim can be different for each request
|
|
94
96
|
# so we need to this step one by one
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|