Compare commits
No commits in common. "main" and "refs/deployment/triton" have entirely different histories.
main
...
refs/deplo
@ -1,2 +0,0 @@
|
||||
(main) README.md
|
||||
Hello World!
|
||||
38
1/model.py
Normal file
38
1/model.py
Normal file
@ -0,0 +1,38 @@
|
||||
import triton_python_backend_utils as pb_utils
|
||||
import numpy as np
|
||||
import json
|
||||
import random
|
||||
import string
|
||||
|
||||
class TritonPythonModel:
|
||||
def initialize(self, args):
|
||||
self.logger = pb_utils.Logger
|
||||
self.logger.log_info(f"'{args["model_name"]}' 모델 초기화 완료")
|
||||
|
||||
def execute(self, requests):
|
||||
responses = []
|
||||
|
||||
for request in requests:
|
||||
input_tensor = pb_utils.get_input_tensor_by_name(request, "INPUT")
|
||||
|
||||
input_data = input_tensor.as_numpy()[0].decode("utf-8")
|
||||
self.logger.log_info(f"INPUT: {input_data}")
|
||||
|
||||
random_string = ''.join(
|
||||
random.choice(string.ascii_letters + string.digits) for _ in range(10)
|
||||
)
|
||||
self.logger.log_info(f"OUTPUT: {random_string}")
|
||||
|
||||
output_tensor = pb_utils.Tensor(
|
||||
"OUTPUT",
|
||||
np.array([random_string.encode("utf-8")], dtype=np.object_)
|
||||
)
|
||||
|
||||
responses.append(pb_utils.InferenceResponse(
|
||||
output_tensors=[output_tensor]
|
||||
))
|
||||
|
||||
return responses
|
||||
|
||||
def finalize(self):
|
||||
pass
|
||||
@ -1,2 +0,0 @@
|
||||
(main) README.md
|
||||
Hello World!
|
||||
35
config.pbtxt
Normal file
35
config.pbtxt
Normal file
@ -0,0 +1,35 @@
|
||||
# Triton Backend for Python.
|
||||
backend: "python"
|
||||
max_batch_size: 0
|
||||
|
||||
input [
|
||||
{
|
||||
name: "INPUT"
|
||||
data_type: TYPE_STRING
|
||||
dims: [ -1 ]
|
||||
}
|
||||
]
|
||||
|
||||
output [
|
||||
{
|
||||
name: "OUTPUT"
|
||||
data_type: TYPE_STRING
|
||||
dims: [ -1 ]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
parameters: [
|
||||
{
|
||||
key: "model_path",
|
||||
value: {string_value: "/cheetah/input/model/groupuser/random-string-generator"}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
instance_group [
|
||||
{
|
||||
kind: KIND_AUTO
|
||||
count: 1
|
||||
}
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user