Skip to content

Commit ab21c2b

Browse files
committed
parse inference_kwargs from environment variables
1 parent 1a9acf5 commit ab21c2b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/autogluon/cloud/scripts/sagemaker_scripts/tabular_serve.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# flake8: noqa
22
import base64
33
import hashlib
4+
import json
5+
import logging
46
import os
57
import pickle
8+
import sys
69
from io import BytesIO, StringIO
710

811
import pandas as pd
@@ -39,7 +42,10 @@ def model_fn(model_dir):
3942

4043

4144
def transform_fn(model, request_body, input_content_type, output_content_type="application/json"):
42-
inference_kwargs = {}
45+
inference_kwargs = os.environ.get("inference_kwargs", {})
46+
if inference_kwargs:
47+
inference_kwargs = json.loads(inference_kwargs)
48+
4349
if input_content_type == "application/x-parquet":
4450
buf = BytesIO(request_body)
4551
data = pd.read_parquet(buf)

0 commit comments

Comments
 (0)