Hi! I have a standardized service that I would li...
# ask-for-help
a
Hi! I have a standardized service that I would like to re-use. Is there a way to do this without recreating / inheriting from the base class with adding the decorator? Example: a
TokenizeService
that takes as input a path / key to a tokenizer. I would like my main service to depends on
TokenizeService("my_tokenizer_1")
and
TokenizeService("my_tokenizer_2")
Thanks for your help and for bentoml 🙂
c
a
Hi @Chaoyu thanks for your answer. I don't think it fits what I am looking for. I want something more like
Copy code
class MyMainService:
   tokenizer_a = bentoml.depends(TokenizeService, tokenizer_path="my_tokenizer_a")
   tokenizer_b = bentoml.depends(TokenizeService, tokenizer_path="my_tokenizer_b")
   model_a = bentoml.depends(MyModelService, model_path="model_a")
   model_b = bentoml.depends(MyModelService, model_path="model_b", gpu=2)
   model_c = bentoml.depends(MyModelService, model_path="model_c")

   @bentoml.api
   def predict():
       ...
I feel like this is an antipattern with the way bentoml currently works