<jupyter_start><jupyter_text>TensorRT Example  PrerequisitesThis notebooks needs to be run in the `tempo-examples` conda environment defined below. Create from project root folder:```bashconda env create --name tempo-examples --file conda/tempo-examples.yaml```<jupyter_code>import os
from tempo.utils import logger
import logging
import numpy as np
from src.data import Cifar10

logger.setLevel(logging.ERROR)
logging.basicConfig(level=logging.ERROR)
ARTIFACTS_FOLDER = os.getcwd()+"/artifacts"
data = Cifar10()<jupyter_output>(50000, 32, 32, 3) (50000, 1) (10000, 32, 32, 3) (10000, 1)<jupyter_text>Create Tempo Artifacts<jupyter_code>from tempo.serve.metadata import ModelFramework
from tempo.serve.model import Model

trt_model = Model(
    name="cifar10",
    platform=ModelFramework.TensorRT,
    local_folder=f"{ARTIFACTS_FOLDER}/tensorrt",
    uri="gs://seldon-models/triton/tf_cifar10",
    description="A TensorRT CIFAR10 Model",
    )<jupyter_output><empty_output><jupyter_text>Test Locally on Docker<jupyter_code>from tempo.serve.loader import download
download(trt_model)
from tempo import deploy_local
remote_model = deploy_local(trt_model)
from src.utils import show_image
show_image(data.X_test[0:1])
remote_model.predict(input_1=data.X_test[0:1])
remote_model.undeploy()<jupyter_output><empty_output><jupyter_text>Production Option  Prerequisites Create a Kind Kubernetes cluster with Minio and Seldon Core installed using Ansible as described [here](https://tempo.readthedocs.io/en/latest/overview/quickstart.htmlkubernetes-cluster-with-seldon-core).<jupyter_code>!kubectl apply -f k8s/rbac -n production
from tempo.examples.minio import create_minio_rclone
import os
create_minio_rclone(os.getcwd()+"/rclone.conf")
from tempo.serve.loader import upload
upload(trt_model)
from tempo.serve.metadata import SeldonCoreOptions
runtime_options = SeldonCoreOptions(**{
        "remote_options": {
            "namespace": "production",
            "authSecretName": "minio-secret"
        }
    })
from tempo import deploy_remote
remote_model = deploy_remote(trt_model, options=runtime_options)
from src.utils import show_image
show_image(data.X_test[0:1])
remote_model.predict(input_1=data.X_test[0:1])<jupyter_output><empty_output><jupyter_text>Illustrate use of Deployed Model by Remote Client<jupyter_code>from tempo.seldon.k8s import SeldonKubernetesRuntime
k8s_runtime = SeldonKubernetesRuntime(runtime_options.remote_options)
models = k8s_runtime.list_models(namespace="production")
print("Name\tDescription")
for model in models:
    details = model.get_tempo().model_spec.model_details
    print(f"{details.name}\t{details.description}")
from src.utils import show_image
show_image(data.X_test[0:1])
models[0].predict(input_1=data.X_test[0:1])
remote_model.undeploy()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10574875798438609, 'fraction_numerical': 0.0220014194464159, 'mean_word_length': 6.808864265927978, 'pattern_counts': {'":': 3, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '213523', 'license': 'Apache-2.0', 'n_tokens_mistral': 997, 'n_tokens_neox': 938, 'n_words': 186, 'path': 'docs/examples/incubating/tensorrt/tensorrt.ipynb', 'repo_name': 'outerbounds/tempo', 'size': '2818'}