Skip to content

Commit

Permalink
chore(test): add multimodal embedding test model (#683)
Browse files Browse the repository at this point in the history
Because

- we are missing multimodal embedding test model

This commit

- add multimodal embedding test model
  • Loading branch information
heiruwu authored Sep 10, 2024
1 parent 6b925ab commit 7c5e8ef
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 8 deletions.
4 changes: 2 additions & 2 deletions assets/model-dummy-chat/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


@instill_deployment
class TextGenerationChat:
class Chat:
def __init__(self):
pass

Expand All @@ -33,4 +33,4 @@ async def __call__(self, request):
)


entrypoint = InstillDeployable(TextGenerationChat).get_deployment_handle()
entrypoint = InstillDeployable(Chat).get_deployment_handle()
4 changes: 2 additions & 2 deletions assets/model-dummy-completion/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


@instill_deployment
class TextGeneration:
class Completion:
def __init__(self):
pass

Expand All @@ -30,4 +30,4 @@ async def __call__(self, request):
)


entrypoint = InstillDeployable(TextGeneration).get_deployment_handle()
entrypoint = InstillDeployable(Completion).get_deployment_handle()
4 changes: 2 additions & 2 deletions assets/model-dummy-multimodal-chat/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


@instill_deployment
class TextGenerationChat:
class MultimodalChat:
def __init__(self):
pass

Expand All @@ -33,4 +33,4 @@ async def __call__(self, request):
)


entrypoint = InstillDeployable(TextGenerationChat).get_deployment_handle()
entrypoint = InstillDeployable(MultimodalChat).get_deployment_handle()
9 changes: 9 additions & 0 deletions assets/model-dummy-multimodal-embedding/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
Task: Embedding
Tags:
- Embedding
- Test
---

# Test repo
This is a dummy multi-modal embedding model for testing purpose
4 changes: 4 additions & 0 deletions assets/model-dummy-multimodal-embedding/instill.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build:
gpu: false
python_version: "3.11" # support only 3.11
python_packages:
34 changes: 34 additions & 0 deletions assets/model-dummy-multimodal-embedding/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import time
from instill.helpers.ray_config import instill_deployment, InstillDeployable
from instill.helpers import (
parse_task_embedding_to_multimodal_embedding_input,
construct_task_embedding_output,
)


@instill_deployment
class MultimodalEmbedding:
def __init__(self):
pass

async def __call__(self, request):

inputs = await parse_task_embedding_to_multimodal_embedding_input(request=request)

input_len = len(inputs)

indexes = [list(range(input_len))]
created = [[int(time.time())] for _ in range(input_len)]
embeddings = [
[[0.00001, -0.00001, 0.00002, 0.001230]] for _ in range(input_len)
]

return construct_task_embedding_output(
request=request,
indexes=indexes,
created_timestamps=created,
embeddings=embeddings,
)


entrypoint = InstillDeployable(MultimodalEmbedding).get_deployment_handle()
4 changes: 2 additions & 2 deletions assets/model-dummy-text-embedding/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


@instill_deployment
class TextToImage:
class TextEmbedding:
def __init__(self):
pass

Expand All @@ -31,4 +31,4 @@ async def __call__(self, request):
)


entrypoint = InstillDeployable(TextToImage).get_deployment_handle()
entrypoint = InstillDeployable(TextEmbedding).get_deployment_handle()

0 comments on commit 7c5e8ef

Please sign in to comment.