Compare commits

..

No commits in common. "refs/deployment/triton" and "main" have entirely different histories.

3 changed files with 165 additions and 12 deletions

1
1/xgboost.json Normal file

@ -0,0 +1 @@
{"learner":{"attributes":{"scikit_learn":"{\"_estimator_type\": \"classifier\"}"},"feature_names":["age","income","city"],"feature_types":["int","int","c"],"gradient_booster":{"model":{"gbtree_model_param":{"num_parallel_tree":"1","num_trees":"5"},"iteration_indptr":[0,1,2,3,4,5],"tree_info":[0,0,0,0,0],"trees":[{"base_weights":[-5.4186042E-8],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0],"id":0,"left_children":[-1],"loss_changes":[0E0],"parents":[2147483647],"right_children":[-1],"split_conditions":[-1.6255813E-8],"split_indices":[0],"split_type":[0],"sum_hessian":[1.1999999E0],"tree_param":{"num_deleted":"0","num_feature":"3","num_nodes":"1","size_leaf_vector":"1"}},{"base_weights":[-5.4186042E-8],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0],"id":1,"left_children":[-1],"loss_changes":[0E0],"parents":[2147483647],"right_children":[-1],"split_conditions":[-1.6255813E-8],"split_indices":[0],"split_type":[0],"sum_hessian":[1.1999999E0],"tree_param":{"num_deleted":"0","num_feature":"3","num_nodes":"1","size_leaf_vector":"1"}},{"base_weights":[8.127906E-8],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0],"id":2,"left_children":[-1],"loss_changes":[0E0],"parents":[2147483647],"right_children":[-1],"split_conditions":[2.438372E-8],"split_indices":[0],"split_type":[0],"sum_hessian":[1.2E0],"tree_param":{"num_deleted":"0","num_feature":"3","num_nodes":"1","size_leaf_vector":"1"}},{"base_weights":[-5.4186042E-8],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0],"id":3,"left_children":[-1],"loss_changes":[0E0],"parents":[2147483647],"right_children":[-1],"split_conditions":[-1.6255813E-8],"split_indices":[0],"split_type":[0],"sum_hessian":[1.1999999E0],"tree_param":{"num_deleted":"0","num_feature":"3","num_nodes":"1","size_leaf_vector":"1"}},{"base_weights":[8.127906E-8],"categories":[],"categories_nodes":[],"categories_segments":[],"categories_sizes":[],"default_left":[0],"id":4,"left_children":[-1],"loss_changes":[0E0],"parents":[2147483647],"right_children":[-1],"split_conditions":[2.438372E-8],"split_indices":[0],"split_type":[0],"sum_hessian":[1.2E0],"tree_param":{"num_deleted":"0","num_feature":"3","num_nodes":"1","size_leaf_vector":"1"}}]},"name":"gbtree"},"learner_model_param":{"base_score":"6E-1","boost_from_average":"1","num_class":"0","num_feature":"3","num_target":"1"},"objective":{"name":"binary:logistic","reg_loss_param":{"scale_pos_weight":"1"}}},"version":[3,0,5]}

126
Untitled.ipynb Normal file

@ -0,0 +1,126 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "a914d431-18c5-4055-a09e-1262dfb48ff9",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-24T04:08:33.164002Z",
"iopub.status.busy": "2025-09-24T04:08:33.163761Z",
"iopub.status.idle": "2025-09-24T04:08:35.375599Z",
"shell.execute_reply": "2025-09-24T04:08:35.374666Z",
"shell.execute_reply.started": "2025-09-24T04:08:33.163978Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"모델 학습이 완료되었습니다.\n",
"X (피처 데이터):\n",
" age income city\n",
"0 25 50000 Seoul\n",
"1 34 75000 Busan\n",
"2 45 120000 Seoul\n",
"3 23 45000 Jeju\n",
"4 56 90000 Busan\n",
"\n",
"y (타겟 데이터):\n",
"[0 1 1 0 1]\n"
]
}
],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import xgboost as xgb\n",
"\n",
"# 모델 정의 (제공된 모델 파라미터 사용)\n",
"model = xgb.XGBClassifier(\n",
" device='cuda',\n",
" tree_method='hist',\n",
" enable_categorical=True,\n",
" eval_metric='aucpr',\n",
" objective='binary:logistic',\n",
" max_depth=3,\n",
" n_estimators=5\n",
")\n",
"\n",
"# 1. 샘플 데이터 X 생성\n",
"# 숫자형(수치형) 피처 'age'와 'income'\n",
"# 범주형 피처 'city'를 포함합니다.\n",
"# enable_categorical=True 설정에 맞춰 'city' 열을 'category' dtype으로 지정합니다.\n",
"data = {\n",
" 'age': [25, 34, 45, 23, 56],\n",
" 'income': [50000, 75000, 120000, 45000, 90000],\n",
" 'city': ['Seoul', 'Busan', 'Seoul', 'Jeju', 'Busan']\n",
"}\n",
"X = pd.DataFrame(data)\n",
"X['city'] = X['city'].astype('category')\n",
"\n",
"# 2. 샘플 타겟 데이터 y 생성\n",
"# 이진 분류를 위한 레이블 (0 또는 1)\n",
"y = np.array([0, 1, 1, 0, 1])\n",
"\n",
"# 3. 모델 학습\n",
"# model.fit(X, y)를 사용하여 모델에 데이터 주입\n",
"model.fit(X, y)\n",
"\n",
"print(\"모델 학습이 완료되었습니다.\")\n",
"print(\"X (피처 데이터):\")\n",
"print(X)\n",
"print(\"\\ny (타겟 데이터):\")\n",
"print(y)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "08df20fd-1f32-42e6-839b-1301df4d9bfe",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-24T04:08:37.983399Z",
"iopub.status.busy": "2025-09-24T04:08:37.982660Z",
"iopub.status.idle": "2025-09-24T04:08:38.002455Z",
"shell.execute_reply": "2025-09-24T04:08:38.000715Z",
"shell.execute_reply.started": "2025-09-24T04:08:37.983337Z"
}
},
"outputs": [],
"source": [
"model.save_model('xgboost.json')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d57d4529-1e88-4214-9efe-4633bd388f1a",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "torch2.8.0-py3.12-cuda12.8",
"language": "python",
"name": "torch2.8.0-py3.12-cuda12.8"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

@ -1,20 +1,46 @@
# Triton backend to use
name: "xgboost-triton-fil"
backend: "fil"
backend: "fil",
max_batch_size: 0
default_model_filename: "xgboost.json"
input [
input [
{
name: "input__0"
data_type: TYPE_FP32
dims: [ 3 ]
}
]
output [
]
instance_group [
{
kind: KIND_AUTO
count: 1
name: "output__0"
data_type: TYPE_FP32
dims: [ 1 ]
}
]
parameters {
key: "output_class"
value: {
string_value: "true"
}
}
parameters [
{
key: "model_type"
value: { string_value: "xgboost_json" }
},
{
key: "predict_proba"
value: { string_value: "false" }
},
{
key: "is_classifier"
value: { string_value: "true" }
},
{
key: "threshold"
value: { string_value: "0.5" }
}
]