Compare commits
7 Commits
refs/deplo
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a91c637c60 | |||
| a3dab09801 | |||
| 203891813b | |||
| ddb8145bd1 | |||
| 941523384f | |||
| 6f5c252f55 | |||
| b19c4d2940 |
19
1/model.py
19
1/model.py
@ -2,6 +2,7 @@ import triton_python_backend_utils as pb_utils
|
|||||||
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
|
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
class TritonPythonModel:
|
class TritonPythonModel:
|
||||||
def initialize(self, args):
|
def initialize(self, args):
|
||||||
@ -12,9 +13,27 @@ class TritonPythonModel:
|
|||||||
"""
|
"""
|
||||||
self.logger = pb_utils.Logger
|
self.logger = pb_utils.Logger
|
||||||
|
|
||||||
|
current_file_path = os.path.abspath(__file__)
|
||||||
|
self.logger.log_info(f"current_file_path: {current_file_path}")
|
||||||
|
|
||||||
|
|
||||||
self.model_name = args["model_name"]
|
self.model_name = args["model_name"]
|
||||||
model_repository = args["model_repository"]
|
model_repository = args["model_repository"]
|
||||||
model_path = f"{model_repository}/{self.model_name}"
|
model_path = f"{model_repository}/{self.model_name}"
|
||||||
|
#model_path = "/cheetah/input/model/gemma-3-1b-it/gemma-3-1b-it"
|
||||||
|
|
||||||
|
input_model_path = model_path
|
||||||
|
|
||||||
|
if os.path.exists(input_model_path):
|
||||||
|
file_list = os.listdir(input_model_path)
|
||||||
|
self.logger.log_info(f"'{input_model_path}' 디렉토리의 파일 목록:")
|
||||||
|
for file_name in file_list:
|
||||||
|
self.logger.log_info(file_name)
|
||||||
|
else:
|
||||||
|
self.logger.log_info(f"'{input_model_path}' 디렉토리가 존재하지 않습니다.")
|
||||||
|
|
||||||
|
self.logger.log_info(f"model_repository: {model_repository}")
|
||||||
|
self.logger.log_info(f"model_path: {model_path}")
|
||||||
|
|
||||||
self.model_config = json.loads(args["model_config"])
|
self.model_config = json.loads(args["model_config"])
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
|
# Triton backend to use
|
||||||
name: "gemma-3-1b-it"
|
name: "gemma-3-1b-it"
|
||||||
max_batch_size: 0
|
|
||||||
backend: "python"
|
backend: "python"
|
||||||
|
max_batch_size: 0
|
||||||
|
|
||||||
# Triton should expect as input a single string
|
# Triton should expect as input a single string
|
||||||
# input of variable length named 'text_input'
|
# input of variable length named 'text_input'
|
||||||
@ -71,6 +72,7 @@ output [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
parameters: [
|
parameters: [
|
||||||
{
|
{
|
||||||
key: "enable_inference_trace",
|
key: "enable_inference_trace",
|
||||||
@ -84,3 +86,4 @@ instance_group [
|
|||||||
count: 1
|
count: 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
test.txt
|
test.txt
|
||||||
test.txt
|
test.txt
|
||||||
test.txt
|
test.txt
|
||||||
|
test.txt
|
||||||
|
test.txt
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user