zerohertzLib.mlops.server ¶
Classes:
| Name | Description |
|---|---|
BaseTritonPythonModel | Triton Inference Server에서 Python backend 사용을 위한 class |
BaseTritonPythonModel ¶
Bases: ABC
Triton Inference Server에서 Python backend 사용을 위한 class
Note
Abstract Base Class: Model의 추론을 수행하는 abstract method _inference 정의 후 사용
Examples:
model.py:
class TritonPythonModel(zz.mlops.BaseTritonPythonModel):
def initialize(self, args: dict[str, str]) -> None:
super().initialize(args)
self.model = Model(cfg)
def _inference(input) -> tuple[Any]:
return self.model(input)
Normal Logs (Without Batching):
2025-09-25 16:06:51.904 | INFO | zerohertzLib.mlops.triton:initialize:* - Initialize: {
"name": "...",
"platform": "",
"backend": "python",
"runtime": "",
"version_policy": {
"latest": {
"num_versions": 1
}
},
"max_batch_size": 0,
...
2025-09-25 16:22:48.226 | INFO | zerohertzLib.mlops.triton:execute:* - Called
2025-09-25 16:22:48.234 | DEBUG | zerohertzLib.mlops.triton:_get_inputs:* - inputs: images=(2078, 1470, 3)
2025-09-25 16:22:48.234 | INFO | zerohertzLib.mlops.triton:execute:* - Inference start
2025-09-25 16:22:49.026 | INFO | zerohertzLib.mlops.triton:execute:* - Inference completed (0.79s)
2025-09-25 16:22:49.026 | DEBUG | zerohertzLib.mlops.triton:_set_outputs:* - outputs: boxes=(12, 4), scores=(12,), labels=(12,)
Normal Logs (With Batching):
2025-11-07 08:36:52.242 | INFO | zerohertzLib.mlops.triton:execute:* - Called
2025-11-07 08:36:52.276 | DEBUG | zerohertzLib.mlops.triton:_get_inputs:* - inputs: images=(5, 3000, 3000, 3)
2025-11-07 08:36:52.276 | INFO | zerohertzLib.mlops.triton:execute:* - Inference start
2025-11-07 08:36:54.091 | INFO | zerohertzLib.mlops.triton:execute:* - Inference completed (1.81s)
2025-11-07 08:36:54.092 | DEBUG | zerohertzLib.mlops.triton:_set_outputs:* - outputs (0 ~ 1): bboxes=(235, 4, 2), (293, 4, 2), texts=(235,), (293,), scores=(235,), (293,), batch_index=(235,), (293,)
2025-11-07 08:36:54.092 | DEBUG | zerohertzLib.mlops.triton:_set_outputs:* - outputs (2 ~ 4): bboxes=(293, 4, 2), (46, 4, 2), (235, 4, 2), texts=(293,), (46,), (235,), scores=(293,), (46,), (235,), batch_index=(293,), (46,), (235,)
Error Logs:
2025-09-25 16:26:32.004 | ERROR | zerohertzLib.mlops.triton:execute:* - zerohertzLib!
Traceback (most recent call last):
> File "/usr/local/lib/python3.10/dist-packages/zerohertzLib/mlops/triton.py", line 371, in execute
outputs = self._inference(**inputs)
| | -> {'images': array([[[ 38, 38, 38],
| | [ 37, 37, 37],
| | [ 37, 37, 37],
| | ...,
| | [255, 255, 255],
| | ...
| -> <function TritonPythonModel._inference at 0x7f106f48f400>
-> <1.model.TritonPythonModel object at 0x7f121fa1f010>
File "/models/docling_layout_old_static/1/model.py", line 34, in _inference
raise Exception("zerohertzLib!")
Exception: zerohertzLib!
Methods:
| Name | Description |
|---|---|
execute | Triton Inference Server 호출 시 수행되는 method |
finalize | Triton Inference Server 종료 시 수행되는 method |
initialize | Triton Inference Server 시작 시 수행되는 method |
_get_inputs ¶
Source code in zerohertzLib/mlops/server.py
_inference abstractmethod ¶
_set_outputs ¶
Source code in zerohertzLib/mlops/server.py
execute ¶
Triton Inference Server 호출 시 수행되는 method
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requests | list[Any] | Client에서 전송된 model inputs | required |
Returns:
| Type | Description |
|---|---|
list[Any] | Client에 응답할 model의 추론 결과 |
Source code in zerohertzLib/mlops/server.py
finalize ¶
initialize ¶
Triton Inference Server 시작 시 수행되는 method
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args | dict[str, str] |
| required |