Skip to content

Commit 5bd5048

Browse files
authored
1 parent 6f9925b commit 5bd5048

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+86
-34
lines changed

examples/bls_decoupled/async_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@
5353
# output_data contains two times of the square value of the input value.
5454
output_data = response.as_numpy("SUM")
5555
print("==========model result==========")
56-
print("Two times the square value of {} is {}\n".format(input_data, output_data))
56+
print("Two times the square value of {} is {}\n".format(
57+
input_data, output_data))
5758

58-
if not np.allclose((2*input_data*input_data), output_data):
59+
if not np.allclose((2 * input_data * input_data), output_data):
5960
print(
6061
"BLS Decoupled Async example error: incorrect output value. Expected {}, got {}."
61-
.format((2*input_data*input_data), output_data))
62+
.format((2 * input_data * input_data), output_data))
6263
sys.exit(1)
6364

6465
print('PASS: BLS Decoupled Async')

examples/bls_decoupled/async_model.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ async def execute(self, requests):
126126
# Wait for all the inference requests to finish. The execution
127127
# of the Python script will be blocked until all the awaitables
128128
# are resolved.
129-
async_responses = await asyncio.gather(
130-
*inference_response_awaits)
129+
async_responses = await asyncio.gather(*inference_response_awaits)
131130

132131
# The variable that will store the sum of the responses.
133132
response_sum = np.array([0])

examples/bls_decoupled/sync_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ def execute(self, requests):
126126

127127
# Check for the last empty response.
128128
if len(infer_response.output_tensors()) > 0:
129-
response_sum += pb_utils.get_output_tensor_by_name(
130-
infer_response, "OUT").as_numpy()
129+
response_sum += pb_utils.get_output_tensor_by_name(
130+
infer_response, "OUT").as_numpy()
131131

132132
response = [
133133
pb_utils.InferenceResponse(

examples/custom_metrics/client.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@
3434
model_name = "custom_metrics"
3535
shape = [4]
3636

37+
3738
def get_metrics():
3839
metrics_url = "http://localhost:8002/metrics"
3940
r = requests.get(metrics_url)
4041
r.raise_for_status()
4142
return r.text
4243

44+
4345
with httpclient.InferenceServerClient("localhost:8000") as client:
4446
input0_data = np.random.rand(*shape).astype(np.float32)
4547
input1_data = np.random.rand(*shape).astype(np.float32)
@@ -78,13 +80,18 @@ def get_metrics():
7880
patterns = [
7981
'# HELP requests_process_latency_ns Cumulative time spent processing requests',
8082
'# TYPE requests_process_latency_ns counter',
81-
'requests_process_latency_ns{model="custom_metrics",version="1"}']
83+
'requests_process_latency_ns{model="custom_metrics",version="1"}'
84+
]
8285
for pattern in patterns:
8386
if pattern not in metrics:
84-
print("custom_metrics example error: missing pattern '{}' in metrics".format(pattern))
87+
print(
88+
"custom_metrics example error: missing pattern '{}' in metrics".
89+
format(pattern))
8590
sys.exit(1)
8691
else:
87-
print("custom_metrics example: found pattern '{}' in metrics".format(pattern))
92+
print(
93+
"custom_metrics example: found pattern '{}' in metrics".format(
94+
pattern))
8895

8996
print('PASS: custom_metrics')
9097
sys.exit(0)

examples/custom_metrics/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def initialize(self, args):
8080
self.metric_family = pb_utils.MetricFamily(
8181
name="requests_process_latency_ns",
8282
description="Cumulative time spent processing requests",
83-
kind=pb_utils.MetricFamily.COUNTER # or pb_utils.MetricFamily.GAUGE
83+
kind=pb_utils.MetricFamily.COUNTER # or pb_utils.MetricFamily.GAUGE
8484
)
8585

8686
# Create a Metric object under the MetricFamily object. The 'labels'

examples/instance_kind/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ def initialize(self, args):
4545
the default device of the framework.
4646
"""
4747
self.device = 'cuda' if args["model_instance_kind"] == "GPU" else 'cpu'
48-
# This example is configured to work with torch=1.13
48+
# This example is configured to work with torch=1.13
4949
# and torchvision=0.14. Thus, we need to provide a proper tag `0.14.1`
50-
# to make sure loaded Resnet50 is compatible with
50+
# to make sure loaded Resnet50 is compatible with
5151
# installed `torchvision`.
5252
# Refer to README for installation instructions.
5353
self.model = torch.hub.load("pytorch/vision:v0.14.1",

inferentia/scripts/gen_triton_model.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ def finalize(self):
606606

607607

608608
def get_triton_python_model_impl(using_tensorflow_model,
609-
disable_batch_requests_to_neuron, is_inf2=False):
609+
disable_batch_requests_to_neuron,
610+
is_inf2=False):
610611
triton_pmi = '''
611612
class TritonPythonModel:
612613
"""Your Python model must use the same class name. Every Python model
@@ -627,7 +628,9 @@ class TritonPythonModel:
627628
return triton_pmi
628629

629630

630-
def create_model_file(using_tensorflow_model, disable_batch_requests_to_neuron, is_inf2=False):
631+
def create_model_file(using_tensorflow_model,
632+
disable_batch_requests_to_neuron,
633+
is_inf2=False):
631634
triton_model = get_model_license()
632635
triton_model += '''
633636
import json
@@ -661,12 +664,14 @@ def create_model_file(using_tensorflow_model, disable_batch_requests_to_neuron,
661664

662665
if __name__ == '__main__':
663666
parser = argparse.ArgumentParser()
664-
parser.add_argument('--inf2',
665-
required=False,
666-
default=False,
667-
action='store_true',
668-
help="Specify whether the model should be generate for inf2 or inf1, default is inf1"
669-
)
667+
parser.add_argument(
668+
'--inf2',
669+
required=False,
670+
default=False,
671+
action='store_true',
672+
help=
673+
"Specify whether the model should be generate for inf2 or inf1, default is inf1"
674+
)
670675
parser.add_argument('--model_type',
671676
type=str,
672677
required=True,

src/gpu_buffers.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

2727
#include "gpu_buffers.h"
28+
2829
#include "pb_string.h"
2930

3031
namespace triton { namespace backend { namespace python {

src/infer_payload.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include <functional>
3030
#include <queue>
31+
3132
#include "infer_response.h"
3233
#include "pb_preferred_memory.h"
3334

src/infer_request.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include <future>
3030
#include <string>
31+
3132
#include "infer_response.h"
3233
#include "pb_preferred_memory.h"
3334
#include "pb_tensor.h"

0 commit comments

Comments
 (0)