Skip to content

Commit

Permalink
bump: version to 0.0.64
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfeil committed Oct 16, 2024
1 parent c263a4c commit a7d5ac3
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docs/assets/openapi.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def sync_detailed(
\"model\": \"openai/clip-vit-base-patch32\",
\"encoding_format\": \"base64\",
\"input\": [
http://images.cocodataset.org/val2017/000000039769.jpg\",
\"http://images.cocodataset.org/val2017/000000039769.jpg\",
# can also be base64 encoded
],
# set extra modality to image to process as image
Expand Down Expand Up @@ -132,7 +132,7 @@ def url_to_base64(url, modality = \"image\"):
client.embeddings.create(
model=\"laion/larger_clap_general\",
input=[url_to_base64(url, \"audio\")],
encoding_format= \"base64\",
encoding_format=\"float\",
extra_body={
\"modality\": \"audio\"
}
Expand All @@ -141,7 +141,7 @@ def url_to_base64(url, modality = \"image\"):
client.embeddings.create(
model=\"laion/larger_clap_general\",
input=[\"the sound of a beep\", \"the sound of a cat\"],
encoding_format= \"base64\",
encoding_format=\"base64\", # base64: optional high performance setting
extra_body={
\"modality\": \"text\"
}
Expand Down Expand Up @@ -200,7 +200,7 @@ def sync(
\"model\": \"openai/clip-vit-base-patch32\",
\"encoding_format\": \"base64\",
\"input\": [
http://images.cocodataset.org/val2017/000000039769.jpg\",
\"http://images.cocodataset.org/val2017/000000039769.jpg\",
# can also be base64 encoded
],
# set extra modality to image to process as image
Expand Down Expand Up @@ -242,7 +242,7 @@ def url_to_base64(url, modality = \"image\"):
client.embeddings.create(
model=\"laion/larger_clap_general\",
input=[url_to_base64(url, \"audio\")],
encoding_format= \"base64\",
encoding_format=\"float\",
extra_body={
\"modality\": \"audio\"
}
Expand All @@ -251,7 +251,7 @@ def url_to_base64(url, modality = \"image\"):
client.embeddings.create(
model=\"laion/larger_clap_general\",
input=[\"the sound of a beep\", \"the sound of a cat\"],
encoding_format= \"base64\",
encoding_format=\"base64\", # base64: optional high performance setting
extra_body={
\"modality\": \"text\"
}
Expand Down Expand Up @@ -305,7 +305,7 @@ async def asyncio_detailed(
\"model\": \"openai/clip-vit-base-patch32\",
\"encoding_format\": \"base64\",
\"input\": [
http://images.cocodataset.org/val2017/000000039769.jpg\",
\"http://images.cocodataset.org/val2017/000000039769.jpg\",
# can also be base64 encoded
],
# set extra modality to image to process as image
Expand Down Expand Up @@ -347,7 +347,7 @@ def url_to_base64(url, modality = \"image\"):
client.embeddings.create(
model=\"laion/larger_clap_general\",
input=[url_to_base64(url, \"audio\")],
encoding_format= \"base64\",
encoding_format=\"float\",
extra_body={
\"modality\": \"audio\"
}
Expand All @@ -356,7 +356,7 @@ def url_to_base64(url, modality = \"image\"):
client.embeddings.create(
model=\"laion/larger_clap_general\",
input=[\"the sound of a beep\", \"the sound of a cat\"],
encoding_format= \"base64\",
encoding_format=\"base64\", # base64: optional high performance setting
extra_body={
\"modality\": \"text\"
}
Expand Down Expand Up @@ -413,7 +413,7 @@ async def asyncio(
\"model\": \"openai/clip-vit-base-patch32\",
\"encoding_format\": \"base64\",
\"input\": [
http://images.cocodataset.org/val2017/000000039769.jpg\",
\"http://images.cocodataset.org/val2017/000000039769.jpg\",
# can also be base64 encoded
],
# set extra modality to image to process as image
Expand Down Expand Up @@ -455,7 +455,7 @@ def url_to_base64(url, modality = \"image\"):
client.embeddings.create(
model=\"laion/larger_clap_general\",
input=[url_to_base64(url, \"audio\")],
encoding_format= \"base64\",
encoding_format=\"float\",
extra_body={
\"modality\": \"audio\"
}
Expand All @@ -464,7 +464,7 @@ def url_to_base64(url, modality = \"image\"):
client.embeddings.create(
model=\"laion/larger_clap_general\",
input=[\"the sound of a beep\", \"the sound of a cat\"],
encoding_format= \"base64\",
encoding_format=\"base64\", # base64: optional high performance setting
extra_body={
\"modality\": \"text\"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,31 @@
class EmbeddingObject:
"""
Attributes:
embedding (Union[File, List[float]]):
embedding (Union[File, List[List[float]], List[float]]):
index (int):
object_ (Union[Unset, EmbeddingObjectObject]): Default: EmbeddingObjectObject.EMBEDDING.
"""

embedding: Union[File, List[float]]
embedding: Union[File, List[List[float]], List[float]]
index: int
object_: Union[Unset, EmbeddingObjectObject] = EmbeddingObjectObject.EMBEDDING
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> Dict[str, Any]:
embedding: Union[FileJsonType, List[float]]
embedding: Union[FileJsonType, List[List[float]], List[float]]
if isinstance(self.embedding, list):
embedding = self.embedding

else:
elif isinstance(self.embedding, File):
embedding = self.embedding.to_tuple()

else:
embedding = []
for embedding_type_2_item_data in self.embedding:
embedding_type_2_item = embedding_type_2_item_data

embedding.append(embedding_type_2_item)

index = self.index

object_: Union[Unset, str] = UNSET
Expand All @@ -55,7 +62,7 @@ def to_dict(self) -> Dict[str, Any]:
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()

def _parse_embedding(data: object) -> Union[File, List[float]]:
def _parse_embedding(data: object) -> Union[File, List[List[float]], List[float]]:
try:
if not isinstance(data, list):
raise TypeError()
Expand All @@ -64,11 +71,24 @@ def _parse_embedding(data: object) -> Union[File, List[float]]:
return embedding_type_0
except: # noqa: E722
pass
if not isinstance(data, bytes):
try:
if not isinstance(data, bytes):
raise TypeError()
embedding_type_1 = File(payload=BytesIO(data))

return embedding_type_1
except: # noqa: E722
pass
if not isinstance(data, list):
raise TypeError()
embedding_type_1 = File(payload=BytesIO(data))
embedding_type_2 = []
_embedding_type_2 = data
for embedding_type_2_item_data in _embedding_type_2:
embedding_type_2_item = cast(List[float], embedding_type_2_item_data)

embedding_type_2.append(embedding_type_2_item)

return embedding_type_1
return embedding_type_2

embedding = _parse_embedding(d.pop("embedding"))

Expand Down
2 changes: 1 addition & 1 deletion libs/client_infinity/infinity_client/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "infinity_client"
version = "0.0.63"
version = "0.0.65"
description = "A client library for accessing ♾️ Infinity - Embedding Inference Server"
authors = []
readme = "README.md"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# 1. Guide: pip install jinja2 jinja2-cli
nvidia:
# 2 .command: jinja2 Dockerfile.jinja2 docker.template.yaml --format=yaml -s nvidia > Dockerfile.nvidia_auto
# 2 .command: jinja2 Dockerfile.jinja2 Docker.template.yaml --format=yaml -s nvidia > Dockerfile.nvidia_auto
base_image: 'nvidia/cuda:12.1.1-base-ubuntu22.04'
main_install: poetry install --no-interaction --no-ansi --no-root --extras "${EXTRAS}" --without lint,test
pyproject_sed: "true"

cpu:
# 2. command: jinja2 Dockerfile.jinja2 docker.template.yaml --format=yaml -s cpu > Dockerfile.cpu_auto
# 2. command: jinja2 Dockerfile.jinja2 Docker.template.yaml --format=yaml -s cpu > Dockerfile.cpu_auto
base_image: 'ubuntu:22.04'
main_install: poetry install --no-interaction --no-ansi --no-root --extras "${EXTRAS}" --without lint,test
pyproject_sed: sed -i 's|"pypi"|"pytorch_cpu"|' pyproject.toml && rm poetry.lock

amd:
# 2 . command: jinja2 Dockerfile.jinja2 docker.template.yaml --format=yaml -s amd > Dockerfile.amd_auto
# 2 . command: jinja2 Dockerfile.jinja2 Docker.template.yaml --format=yaml -s amd > Dockerfile.amd_auto
base_image: 'rocm/pytorch:rocm6.2.3_ubuntu22.04_py3.10_pytorch_release_2.3.0'
main_install: poetry install --no-interaction --no-ansi --no-root --extras "${EXTRAS}" --without lint,test
pyproject_sed: sed -i 's|"pypi"|"pytorch_rocm"|' pyproject.toml && sed -i 's|torch = "2.4.1"|#|' pyproject.toml && rm poetry.lock
Expand Down
6 changes: 3 additions & 3 deletions libs/infinity_emb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ format format_diff:
[ "$(PYTHON_FILES)" = "" ] || poetry run ruff --select I --fix $(PYTHON_FILES)

template_docker:
jinja2 Dockerfile.jinja2 docker.template.yaml --format=yaml -s amd > Dockerfile.amd_auto
jinja2 Dockerfile.jinja2 docker.template.yaml --format=yaml -s cpu > Dockerfile.cpu_auto
jinja2 Dockerfile.jinja2 docker.template.yaml --format=yaml -s nvidia > Dockerfile.nvidia_auto
jinja2 Dockerfile.jinja2 Docker.template.yaml --format=yaml -s amd > Dockerfile.amd_auto
jinja2 Dockerfile.jinja2 Docker.template.yaml --format=yaml -s cpu > Dockerfile.cpu_auto
jinja2 Dockerfile.jinja2 Docker.template.yaml --format=yaml -s nvidia > Dockerfile.nvidia_auto

poetry_check:
poetry check
Expand Down
2 changes: 1 addition & 1 deletion libs/infinity_emb/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[tool.poetry]
name = "infinity_emb"
version = "0.0.64"
version = "0.0.65"
description = "Infinity is a high-throughput, low-latency REST API for serving text-embeddings, reranking models and clip."
authors = ["michaelfeil <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit a7d5ac3

Please sign in to comment.