chore: only add bentomodel branch during generated service with

OpenLLM

Signed-off-by: aarnphm-ec2-dev <29749331+aarnphm@users.noreply.github.com>
This commit is contained in:
aarnphm-ec2-dev
2023-09-05 01:08:23 +00:00
parent 3818bfefaf
commit f43c721579
2 changed files with 34 additions and 4 deletions

View File

@@ -892,10 +892,13 @@ class LLM(LLMInterface[M, T], ReprMixin):
'''
models = models if models is not None else []
try:
models.append(self._bentomodel)
except bentoml.exceptions.NotFound as err:
raise RuntimeError(f'Failed to locate {self._bentomodel}:{err}') from None
if os.environ.get('BENTO_PATH') is None:
# Hmm we should only add this if it is not in the container environment
# BentoML sets BENTO_PATH so we can use this as switch logic here.
try:
models.append(self._bentomodel)
except bentoml.exceptions.NotFound as err:
raise RuntimeError(f'Failed to locate {self._bentomodel}:{err}') from None
generate_sig = ModelSignature.from_dict(ModelSignatureDict(batchable=False))
embeddings_sig = ModelSignature.from_dict(ModelSignatureDict(batchable=True, batch_dim=0))