Repository: bentoml/BentoML

Issue:
bug:   _TritonRunner.__attrs_init__() missing 1 required positional argument: 'embedded'
### Describe the bug

This bug is very simple and easy to fix.

When I build a model that uses triton runner I get an error:

```shell
  File "C:\Users\user\PycharmProjects\bentoml_models\models\resnet50\service.py", line 12, in <module>
    triton_runner = bentoml.triton.Runner(
  File "C:\Users\user\PycharmProjects\bentoml_models\.venv\lib\site-packages\bentoml\triton.py", line 147, in __init__
    self.__attrs_init__(
TypeError: _TritonRunner.__attrs_init__() missing 1 required positional argument: 'embedded'
```

And this is really missing at `bentoml/triton.py:147`. After I added `embedded` argument to the method:

```python
self.__attrs_init__(
    name=name,
    models=None,
    resource_config=None,
    runnable_class=self.__class__,
    repository_path=model_repository,
    tritonserver_type=tritonserver_type,
    cli_args=cli_args,
    embedded=False
)
```

everything works as expected 🎉 

### To reproduce

Add triton runner to the service

```python
triton_runner = bentoml.triton.Runner(
    name="triton_runner",
    model_repository="./model_repository",
)
```

Then try to build the model

```shell
bentoml build
```

The error should appear

```shell
TypeError: _TritonRunner.__attrs_init__() missing 1 required positional argument: 'embedded'
```

### Expected behavior

Obviously, the model and bento should be built.

### Environment

platform: Windows 11
python: 3.10
bentoml: 1.0.20


Discussion:
**UPD.** BUT when we containerize application, it creates its own image with newly installed packages. So, even if we can build and containerize a bento, we cannot actually run it.

**UPD 2.** BentoML `1.0.19` works fine. This is `1.0.20`'s bug

Resolving patch:
diff --git a/src/bentoml/_internal/runner/runner.py b/src/bentoml/_internal/runner/runner.py
--- a/src/bentoml/_internal/runner/runner.py
+++ b/src/bentoml/_internal/runner/runner.py
@@ -97,7 +97,12 @@ def init_local(self, quiet: bool = False) -> None:
         """
 
     @abstractmethod
-    def init_client(self):
+    def init_client(
+        self,
+        handle_class: type[RunnerHandle] | None = None,
+        *args: t.Any,
+        **kwargs: t.Any,
+    ):
         """
         Initialize client for a remote runner instance. To be used within API server instance.
         """
@@ -132,7 +137,7 @@ def __getattr__(self, item: str) -> t.Any:
     _runner_handle: RunnerHandle = attr.field(init=False, factory=DummyRunnerHandle)
 
     def _set_handle(
-        self, handle_class: type[RunnerHandle], *args: P.args, **kwargs: P.kwargs
+        self, handle_class: type[RunnerHandle], *args: t.Any, **kwargs: t.Any
     ) -> None:
         if not isinstance(self._runner_handle, DummyRunnerHandle):
             raise StateException("Runner already initialized")
@@ -309,8 +314,8 @@ def init_local(self, quiet: bool = False) -> None:
     def init_client(
         self,
         handle_class: type[RunnerHandle] | None = None,
-        *args: P.args,
-        **kwargs: P.kwargs,
+        *args: t.Any,
+        **kwargs: t.Any,
     ):
         if handle_class is None:
             from .runner_handle.remote import RemoteRunnerClient
diff --git a/src/bentoml/triton.py b/src/bentoml/triton.py
--- a/src/bentoml/triton.py
+++ b/src/bentoml/triton.py
@@ -7,7 +7,6 @@
 from simple_di import inject as _inject
 from simple_di import Provide as _Provide
 
-from .exceptions import StateException as _StateException
 from ._internal.utils import LazyLoader as _LazyLoader
 from ._internal.utils import cached_property as _cached_property
 from ._internal.configuration import get_debug_mode as _get_debug_mode
@@ -90,12 +89,6 @@ class _TritonRunner(_AbstractRunner):
 
     _runner_handle: RunnerHandle = attr.field(init=False, factory=_DummyRunnerHandle)
 
-    def _init(self, handle_class: t.Type[RunnerHandle]) -> None:
-        if not isinstance(self._runner_handle, _DummyRunnerHandle):
-            raise _StateException("Runner already initialized")
-
-        _object_setattr(self, "_runner_handle", handle_class(self))
-
     @_inject
     async def runner_handle_is_ready(
         self,
@@ -152,6 +145,7 @@ def __init__(
             repository_path=model_repository,
             tritonserver_type=tritonserver_type,
             cli_args=cli_args,
+            embedded=False,  # NOTE: TritonRunner shouldn't be used as embedded.
         )
 
     @_cached_property
@@ -174,10 +168,18 @@ def init_local(self, quiet: bool = False) -> None:
             "TritonRunner '%s' will not be available for development mode.", self.name
         )
 
-    def init_client(self):
+    def init_client(
+        self,
+        handle_class: type[RunnerHandle] | None = None,
+        *args: t.Any,
+        **kwargs: t.Any,
+    ):
         from ._internal.runner.runner_handle.remote import TritonRunnerHandle
 
-        self._init(TritonRunnerHandle)
+        if handle_class is None:
+            handle_class = TritonRunnerHandle
+
+        super().init_client(handle_class=handle_class, *args, **kwargs)
 
     def destroy(self):
         _object_setattr(self, "_runner_handle", _DummyRunnerHandle())


Test patch: