-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add no_model and optional search query feature
- Loading branch information
Showing
22 changed files
with
715 additions
and
550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from enum import Enum | ||
|
||
|
||
class ModelType(str, Enum): | ||
"""Enums for the different types of models that can be used for inference.""" | ||
OpenCLIP = "open_clip" | ||
CLIP = 'clip' | ||
SBERT = 'sbert' | ||
Test = 'test' | ||
SBERT_ONNX = 'sbert_onnx' | ||
CLIP_ONNX = 'clip_onnx' | ||
MultilingualClip = "multilingual_clip" | ||
FP16_CLIP = "fp16_clip" | ||
Random = 'random' | ||
HF_MODEL = 'hf' | ||
NO_MODEL= "no_model" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from marqo.s2_inference.errors import VectoriseError | ||
from marqo.s2_inference.sbert_utils import Model | ||
from marqo.s2_inference.models.model_type import ModelType | ||
|
||
|
||
class NO_MODEL(Model): | ||
def __init__(self, *args, **kwargs) -> None: | ||
super().__init__(*args, **kwargs) | ||
|
||
def load(self, *args, **kwargs) -> None: | ||
pass | ||
|
||
def encode(self, *args, **kwargs) -> None: | ||
raise VectoriseError(f"Cannot vectorise anything with '{ModelType.NO_MODEL}'. " | ||
f"This model is intended for adding documents and searching with custom vectors only. " | ||
f"If vectorisation is needed, please use a different model ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.