Skip to content

Commit e1ad1aa

Browse files
authored
Merge branch 'main' into mwittwer/enable_pytorch2_batching
2 parents 19f8e22 + 8f90112 commit e1ad1aa

4 files changed

Lines changed: 47 additions & 68 deletions

File tree

build.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,10 +1167,10 @@ def create_dockerfile_linux(
11671167

11681168
df += f"""
11691169
WORKDIR /opt
1170-
COPY --chown=1000:1000 build/install tritonserver
1170+
COPY build/install tritonserver
11711171
11721172
WORKDIR /opt/tritonserver
1173-
COPY --chown=1000:1000 NVIDIA_Deep_Learning_Container_License.pdf .
1173+
COPY NVIDIA_Deep_Learning_Container_License.pdf .
11741174
RUN find /opt/tritonserver/python -maxdepth 1 -type f -name \\
11751175
"tritonserver-*.whl" | xargs -I {{}} pip install --upgrade {{}}[{FLAGS.triton_wheels_dependencies_group}] && \\
11761176
find /opt/tritonserver/python -maxdepth 1 -type f -name \\
@@ -1185,7 +1185,7 @@ def create_dockerfile_linux(
11851185
df += """
11861186
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true
11871187
LABEL com.amazonaws.sagemaker.capabilities.multi-models=true
1188-
COPY --chown=1000:1000 docker/sagemaker/serve /usr/bin/.
1188+
COPY docker/sagemaker/serve /usr/bin/.
11891189
"""
11901190
# This is required since libcublasLt.so is not present during the build
11911191
# stage of the PyTorch backend
@@ -1248,8 +1248,9 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach
12481248
ENV TRITON_SERVER_GPU_ENABLED {gpu_enabled}
12491249
12501250
# Create a user that can be used to run triton as
1251-
# non-root. Make sure that this user to given ID 1000. All server
1252-
# artifacts copied below are assign to this user.
1251+
# non-root. Make sure that this user is given ID 1000. Server
1252+
# artifacts copied below remain owned by root; the triton-server
1253+
# user reads and executes them via standard group/other permissions.
12531254
ENV TRITON_SERVER_USER=triton-server
12541255
RUN userdel tensorrt-server > /dev/null 2>&1 || true \\
12551256
&& userdel ubuntu > /dev/null 2>&1 || true \\
@@ -2115,8 +2116,8 @@ def cibase_build(
21152116

21162117

21172118
def finalize_build(cmake_script, install_dir, ci_dir):
2118-
cmake_script.cmd(f"chmod -R a+rw {install_dir}")
2119-
cmake_script.cmd(f"chmod -R a+rw {ci_dir}")
2119+
cmake_script.cmd(f"chmod -R u+rwX,go+rX,go-w {install_dir}")
2120+
cmake_script.cmd(f"chmod -R u+rwX,go+rX,go-w {ci_dir}")
21202121

21212122

21222123
def enable_all():

compose.py

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ def start_dockerfile(ddir, images, argmap, dockerfile_name, backends):
9898
# Copy over files
9999
df += """
100100
WORKDIR /opt/tritonserver
101-
COPY --chown=1000:1000 --from=full /opt/tritonserver/LICENSE .
102-
COPY --chown=1000:1000 --from=full /opt/tritonserver/TRITON_VERSION .
103-
COPY --chown=1000:1000 --from=full /opt/tritonserver/NVIDIA_Deep_Learning_Container_License.pdf .
104-
COPY --chown=1000:1000 --from=full /opt/tritonserver/bin bin/
105-
COPY --chown=1000:1000 --from=full /opt/tritonserver/lib lib/
106-
COPY --chown=1000:1000 --from=full /opt/tritonserver/include include/
101+
COPY --from=full /opt/tritonserver/LICENSE .
102+
COPY --from=full /opt/tritonserver/TRITON_VERSION .
103+
COPY --from=full /opt/tritonserver/NVIDIA_Deep_Learning_Container_License.pdf .
104+
COPY --from=full /opt/tritonserver/bin bin/
105+
COPY --from=full /opt/tritonserver/lib lib/
106+
COPY --from=full /opt/tritonserver/include include/
107107
"""
108108
with open(os.path.join(ddir, dockerfile_name), "w") as dfile:
109109
dfile.write(df)
@@ -112,47 +112,32 @@ def start_dockerfile(ddir, images, argmap, dockerfile_name, backends):
112112
def add_requested_backends(ddir, dockerfile_name, backends):
113113
df = "# Copying over backends \n"
114114
for backend in backends:
115-
df += """COPY --chown=1000:1000 --from=full /opt/tritonserver/backends/{} /opt/tritonserver/backends/{}
115+
df += """COPY --from=full /opt/tritonserver/backends/{} /opt/tritonserver/backends/{}
116116
""".format(
117117
backend, backend
118118
)
119-
if len(backends) > 0:
120-
df += """
121-
# Top-level /opt/tritonserver/backends not copied so need to explicitly set permissions here
122-
RUN chown triton-server:triton-server /opt/tritonserver/backends
123-
"""
124119
with open(os.path.join(ddir, dockerfile_name), "a") as dfile:
125120
dfile.write(df)
126121

127122

128123
def add_requested_repoagents(ddir, dockerfile_name, repoagents):
129124
df = "# Copying over repoagents \n"
130125
for ra in repoagents:
131-
df += """COPY --chown=1000:1000 --from=full /opt/tritonserver/repoagents/{} /opt/tritonserver/repoagents/{}
126+
df += """COPY --from=full /opt/tritonserver/repoagents/{} /opt/tritonserver/repoagents/{}
132127
""".format(
133128
ra, ra
134129
)
135-
if len(repoagents) > 0:
136-
df += """
137-
# Top-level /opt/tritonserver/repoagents not copied so need to explicitly set permissions here
138-
RUN chown triton-server:triton-server /opt/tritonserver/repoagents
139-
"""
140130
with open(os.path.join(ddir, dockerfile_name), "a") as dfile:
141131
dfile.write(df)
142132

143133

144134
def add_requested_caches(ddir, dockerfile_name, caches):
145135
df = "# Copying over caches \n"
146136
for cache in caches:
147-
df += """COPY --chown=1000:1000 --from=full /opt/tritonserver/caches/{} /opt/tritonserver/caches/{}
137+
df += """COPY --from=full /opt/tritonserver/caches/{} /opt/tritonserver/caches/{}
148138
""".format(
149139
cache, cache
150140
)
151-
if len(caches) > 0:
152-
df += """
153-
# Top-level /opt/tritonserver/caches not copied so need to explicitly set permissions here
154-
RUN chown triton-server:triton-server /opt/tritonserver/caches
155-
"""
156141
with open(os.path.join(ddir, dockerfile_name), "a") as dfile:
157142
dfile.write(df)
158143

@@ -163,7 +148,7 @@ def end_dockerfile(ddir, dockerfile_name, argmap):
163148
if argmap["SAGEMAKER_ENDPOINT"]:
164149
df += """
165150
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true
166-
COPY --chown=1000:1000 --from=full /usr/bin/serve /usr/bin/.
151+
COPY --from=full /usr/bin/serve /usr/bin/.
167152
"""
168153
with open(os.path.join(ddir, dockerfile_name), "a") as dfile:
169154
dfile.write(df)

python/openai/openai_frontend/engine/utils/tokenizer.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2024-2025, NVIDIA CORPORATION. All rights reserved.
1+
# Copyright (c) 2024-2026, NVIDIA CORPORATION. All rights reserved.
22
#
33
# Redistribution and use in source and binary forms, with or without
44
# modification, are permitted provided that the following conditions
@@ -47,7 +47,6 @@ def get_cached_tokenizer(
4747
function caches these properties for faster access."""
4848

4949
tokenizer_all_special_ids = set(tokenizer.all_special_ids)
50-
tokenizer_all_special_tokens_extended = tokenizer.all_special_tokens_extended
5150
tokenizer_all_special_tokens = set(tokenizer.all_special_tokens)
5251
tokenizer_len = len(tokenizer)
5352

@@ -60,10 +59,6 @@ def all_special_ids(self):
6059
def all_special_tokens(self):
6160
return tokenizer_all_special_tokens
6261

63-
@property
64-
def all_special_tokens_extended(self):
65-
return tokenizer_all_special_tokens_extended
66-
6762
def __len__(self):
6863
return tokenizer_len
6964

qa/L0_http/http_input_size_limit_test.py

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -499,53 +499,51 @@ def test_large_input_json(self):
499499
f"Expected shape {[1, shape_size]}, got {result['outputs'][0]['shape']}",
500500
)
501501

502-
def test_large_string_in_json(self):
503-
"""Test JSON request with large string input"""
504-
model = "simple_identity"
505-
506-
# Create a string that is larger (large payload about 2GB) than the default limit of 64MB
507-
# (2^31 + 64) elements * 1 bytes = 2GB + 64 bytes = 2,147,483,712 bytes
508-
large_string_size = 2 * GIB + 64
509-
large_string = "A" * large_string_size
510-
502+
def _build_payload_of_json_size(self, target_size):
503+
"""Build an inference request payload whose JSON serialization is exactly target_size bytes."""
511504
payload = {
512505
"inputs": [
513506
{
514507
"name": "INPUT0",
515508
"datatype": "BYTES",
516509
"shape": [1, 1],
517-
"data": [large_string],
510+
"data": [""],
518511
}
519512
]
520513
}
514+
overhead = len(json.dumps(payload))
515+
pad = target_size - overhead
516+
self.assertGreaterEqual(pad, 0, "target_size smaller than payload overhead")
517+
payload["inputs"][0]["data"] = ["A" * pad]
518+
self.assertEqual(len(json.dumps(payload)), target_size)
519+
return payload
521520

522-
headers = {"Content-Type": "application/json"}
523-
response = requests.post(
524-
self._get_infer_url(model), headers=headers, json=payload
525-
)
521+
def test_large_string_in_json(self):
522+
"""Verify the server's JSON size limit at the byte boundary."""
523+
model = "simple_identity"
526524

527-
# Should fail with 400 bad request
525+
payload_over = self._build_payload_of_json_size(DEFAULT_LIMIT_BYTES + 1)
526+
response = requests.post(self._get_infer_url(model), json=payload_over)
528527
self.assertEqual(
529528
400,
530529
response.status_code,
531-
"Expected error code for oversized JSON request, got: {}".format(
532-
response.status_code
530+
"Expected 400 for body of DEFAULT_LIMIT_BYTES + 1, got: {} ({!r})".format(
531+
response.status_code, response.content[:200]
533532
),
534533
)
535-
536-
# Verify error message
537534
error_msg = response.content.decode()
538-
self.assertIn(
539-
"request JSON size of ",
540-
error_msg,
541-
)
542-
self.assertIn(
543-
" bytes exceeds the maximum allowed input size of ",
544-
error_msg,
545-
)
546-
self.assertIn(
547-
"Use --http-max-input-size to increase the limit.",
548-
error_msg,
535+
self.assertIn("request JSON size of ", error_msg)
536+
self.assertIn(" bytes exceeds the maximum allowed input size of ", error_msg)
537+
self.assertIn("Use --http-max-input-size to increase the limit.", error_msg)
538+
539+
payload_at = self._build_payload_of_json_size(DEFAULT_LIMIT_BYTES)
540+
response = requests.post(self._get_infer_url(model), json=payload_at)
541+
self.assertEqual(
542+
200,
543+
response.status_code,
544+
"Expected 200 for body of exactly DEFAULT_LIMIT_BYTES, got: {} ({!r})".format(
545+
response.status_code, response.content[:200]
546+
),
549547
)
550548

551549
def _create_compressed_payload(self, target_size):

0 commit comments

Comments
 (0)