Posted by Jonathan Dekhtiar (NVIDIA), Bixia Zheng (Google), Shashank Verma (NVIDIA), Chetan Tekur (NVIDIA)
that leverages inference optimization on NVIDIA GPUs within the TensorFlow ecosystem. It provides a simple API that delivers substantial performance gains on NVIDIA GPUs with minimal effort. The integration allows for leveraging of the optimizations that are possible in TensorRT while providing a fallback to native TensorFlow when it encounters segments of the model that are not supported by TensorRT.
In our previous is enabled, in the first step, the trained model is parsed in order to partition the graph into
Workflow
In this section, we will take a look at the typical TF-TRT workflow using an example.
| format contains all the information required to share or deploy a trained model. In native TensorFlow, the workflow typically involves loading the saved model and running inference using TensorFlow runtime. In TF-TRT, there are a few additional steps involved, including applying TensorRT optimizations to the TensorRT supported subgraphs of the model, and optionally pre-building the TensorRT engines. First, we create an object to hold the conversion parameters, including a precision mode. The precision mode is used to indicate the minimum precision (for example FP32, FP16 or INT8) that TF-TRT can use to implement the TensorFlow operations. Then we create a converter object which takes the conversion parameters and input from a saved model. Note that in TensorFlow 2.x, TF-TRT only supports models saved in the TensorFlow SavedModel format. Next, when we call the converter convert() method, TF-TRT will convert the graph by replacing TensorRT compatible portions of the graph with TRTEngineOps. For better performance at runtime, the converter method. The code corresponding to the workflow steps mentioned in this section are shown in the codeblock below: PYTHON As can be seen from the code example above, the build() method requires an input function corresponding to the shape of the input data. An example of an input function is shown below: PYTHON Support for INT8Compared to FP32 and FP16, INT8 requires additional calibration data to determine the best quantization thresholds. When the precision mode in the conversion parameter is INT8, we need to provide an input function to the convert() method call. This input function is similar to the input function provided to the build() method. In addition, the calibration data generated by the input function passed to the convert() method should generate data that are statistically similar to the actual data seen during inference. PYTHON Example: ResNet-50The rest of this blog will show the workflow of taking a TensorFlow 2.x ResNet-50 model, training it, saving it, optimizing it with TF-TRT and finally deploying it for inference. We will also compare inference throughputs using TensorFlow native vs TF-TRT in three precision modes, FP32, FP16, and INT8. Prerequisites for the example :
Training ResNet-50 using the TensorFlow 2.x container:First, the latest release of the ResNet-50 model needs to be downloaded from the TensorFlow github repository: PYTHON As noted in the earlier section, for this example we will be using the latest TensorFlow container available in the Docker repository. The user does not need any additional installation steps as TensorRT integration is already included in the container. The steps to pull the container and launch it are as follows: PYTHON From inside the container, we can then verify that we have access to the relevant files and the Nvidia GPU we would like to target: PYTHON We can now start training ResNet-50. To avoid spending hours training a deep learning model, this article will use the smaller MNIST dataset. However, the workflow will not change with a more state-of-the-art dataset like ImageNet. PYTHON Obtaining a SavedModel to be used by TF-TRTAfter training, Google’s ResNet-50 code exports the model in the SavedModel format at the following path: checkpoints/saved_model/. The following sample SavedModel has been properly saved, we can proceed with loading it with TF-TRT for inference. InferenceResNet-50 Inference using TF-TRTIn this section, we will go over the steps for deploying the saved ResNet-50 model on the NVIDIA GPU using TF-TRT. As previously described, we first convert a SavedModel into a TF-TRT model using the convert method and then load the model. PYTHON For simplicity, we will use a script to perform inference ( and put it in the working directory “/workspace/” of the same docker container as before. After this, we can execute the script: PYTHON Similarly, we can run inference for INT8, and FP32 PYTHON Inference using native TensorFlow (GPU) FP32You can also run the unmodified SavedModel without any TF-TRT acceleration. PYTHON This run was executed with a NVIDIA T4 GPU. The same workflow will work on any NVIDIA GPU. Comparing Native Tensorflow 2.x performance vs TF-TRT for InferenceMaking minimal code changes to take advantage of TF-TRT can result in a significant performance boost. For example, using the inference script in this blog, with a batch-size of 512 on an NVIDIA T4 GPU, we observe almost 2x speedup with TF-TRT FP16, and a 2.4x speedup with TF-TRT INT8 over native TensorFlow. The amount of speedup obtained may differ depending on various factors like the model used, the batch size, the size and format of images in the dataset, and any CPU bottlenecks. In conclusion, in this blog we show the acceleration provided by TF-TRT. Additionally, with TF-TRT we can use the full TensorFlow Python API and interactive environments like Jupyter Notebooks or Google Colab. Supported OperatorsThe TF-TRT user guide lists . Vollständiger Original-Bericht Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf blog.tensorflow.org. Wie bewertest du diesen Beitrag? 1 Klick Feedback Teilen mit Netzwerk & Team: Hat Ihnen dieser Tipp / Anleitung geholfen? Community-Analysen & Experten-Meinungen 0Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog. Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf „ Eigene Analyse verfassen“! Community Pulse: Relevanz-Einschätzung 1 Klick Experten-Votum 🔴 Akute Relevanz 0% 🟡 In Evaluierung 0% 🟢 Keine Auswirkung 0% Spannende Innovation 0% Verwandte Story-Cluster & Quellen (Vektor-KI) Tipp: Mit Pfeiltasten [ ← ] und [ → ] blättern
Ähnliche Beiträge
🔍 Verwandte News
Auch interessante Nachrichten Leveraging TensorFlow-TensorRT integration for Low latency InferenceThematisch verwandte Begriffe: Leveraging, TensorFlowTensorRT, integration, latency · 6 Treffer 🔧 AI Nachrichten MacDailyNews Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies 🔧 AI Nachrichten The Mac Observer GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
Laden...
Videos werden geladen ...
Laden...
Beiträge werden geladen ...
Laden...
Videos werden geladen ...
Laden...
Beiträge werden geladen ...
Laden...
Videos werden geladen ...
Laden...
Beiträge werden geladen ...
Laden...
Videos werden geladen ...
Laden...
Beiträge werden geladen ...
Laden...
Videos werden geladen ... 🔖 Gespeicherte Artikel
📂
Keine gespeicherten Artikel vorhanden.
📂 News
⏱️ 3 Min
vor 10 Min
Artikeldaten werden geladen...
tsecurity.de AppOffline-Lesen, Eilmeldungen & 0ms Ladezeit
Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.
Nächster Beitrag
🤖
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster:
Security Explorer
👥 Match:
lädt…
📡 Aktivitäten deiner Analystenlädt…
💡 Neues Thema oder Eilmeldung einreichenReiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung. 🔥 Heiß diskutierte Einreichungen |
SOCIAL SHARE CARD GENERATOR