{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "6bYaCABobL5q" }, "source": [ "##### Copyright 2018 The TensorFlow Authors." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "cellView": "form", "execution": { "iopub.execute_input": "2022-12-14T20:30:17.451687Z", "iopub.status.busy": "2022-12-14T20:30:17.451435Z", "iopub.status.idle": "2022-12-14T20:30:17.455268Z", "shell.execute_reply": "2022-12-14T20:30:17.454721Z" }, "id": "FlUw7tSKbtg4" }, "outputs": [], "source": [ "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n", "# you may not use this file except in compliance with the License.\n", "# You may obtain a copy of the License at\n", "#\n", "# https://www.apache.org/licenses/LICENSE-2.0\n", "#\n", "# Unless required by applicable law or agreed to in writing, software\n", "# distributed under the License is distributed on an \"AS IS\" BASIS,\n", "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", "# See the License for the specific language governing permissions and\n", "# limitations under the License." ] }, { "cell_type": "markdown", "metadata": { "id": "08OTcmxgqkc2" }, "source": [ "# TF 1.x 및 compat.v1 API 심볼 자동 재작성\n", "\n", "
![]() | \n",
" ![]() | \n",
" ![]() | \n",
" ![]() | \n",
"
\n", "tf_upgrade_v2 \\\n", " --intree my_project/ \\\n", " --outtree my_project_v2/ \\\n", " --reportfile report.txt\n", "\n", "\n", "기존 TensorFlow 1.x 파이썬 스크립트를 TensorFlow 2.x로 변환하여 업그레이드 프로세스를 가속합니다.\n", "\n", "변환 스크립트를 통해 많은 기계적 API 변환을 자동화할 수 있지만 많은 API는 자동으로 마이그레이션할 수 없습니다. 또한 코드가 TF2 동작 및 API와 완전히 호환되도록 만들 수도 없습니다. 따라서 이것은 마이그레이션 여정의 일부일 뿐입니다." ] }, { "cell_type": "markdown", "metadata": { "id": "gP9v2vgptdfi" }, "source": [ "## 호환성 모듈\n", "\n", "특정 API 기호는 단순히 문자열 교체만으로 업그레이드할 수 없습니다. 자동으로 업그레이드할 수 없는 항목은 `compat.v1` 모듈의 해당 위치에 매핑됩니다. 이 모듈은 `tf.foo`와 같은 TF 1.x 기호를 해당하는 `tf.compat.v1.foo` 참조로 교체합니다. `import tensorflow.compat.v1 as tf`를 통해 TF를 가져와서 이미 `compat.v1` API를 사용하고 있는 경우 `tf_upgrade_v2` 스크립트는 가능한 경우 이러한 사용법을 비호환 API로 변환하려고 시도합니다. `compat.v1` API는 TF2.x 동작과 일부 호환되지만 대부분은 호환되지 않습니다. 따라서 교체를 수동으로 교검사하고 가능한 한 빨리 `tf.compat.v1` 네임스페이스 대신 `tf.*` 네임스페이스의 새 API로 마이그레이션하는 것이 좋습니다.\n", "\n", "TensorFlow 2.x 모듈의 사용 중단(예: tf.flags 및 tf.contrib)으로, 일부 변경 사항은 compat.v1로 전환하여 해결할 수 없습니다. 이 코드를 업그레이드하려면 추가 라이브러리(예: absl.flags )를 사용하거나 tensorflow / addons의 패키지로 전환해야 합니다.\n" ] }, { "cell_type": "markdown", "metadata": { "id": "s78bbfjkXYb7" }, "source": [ "## 권장 업그레이드 프로세스\n", "\n", "이 가이드의 나머지 부분에서는 심볼 재작성 스크립트를 사용하는 방법을 보여줍니다. 이 스크립트는 사용하기 쉽지만 다음 프로세스의 일부로 스크립트를 사용하는 것이 좋습니다.\n", "\n", "1. <strong data-md-type=\"double_emphasis\">단위 테스트</strong>: 업그레이드 중인 코드에 적용 가능한 단위 테스트 도구 모음이 있는지 확인합니다. Python 코드와 같은 언어에서는 많은 종류의 실수가 보호되지 않습니다. TensorFlow 2.x와 호환되도록 모든 종속성이 업그레이드되었는지 확인합니다.\n", "\n", "2. TensorFlow 1.15 설치: TensorFlow를 최신 TensorFlow 1.x 버전(최소 1.15)으로 업그레이드하세요. 여기에는 `tf.compat.v2`의 최종 TensorFlow 2.0 API가 포함됩니다.\n", "\n", "3. 1.15로 테스트: 이 시점에서 단위 테스트를 통과했는지 확인합니다. 안전하게 시작하는 것이 중요하므로 업그레이드할 때 반복적으로 실행됩니다.\n", "\n", "4. 업그레이드 스크립트 실행: 테스트가 포함된 전체 소스 트리에서 tf_upgrade_v2를 실행합니다. 이렇게하면 코드가 TensorFlow 2.0에서 사용 가능한 기호만 사용하는 형식으로 업그레이드됩니다. 더 이상 사용되지 않는 기호는 tf.compat.v1으로 액세스됩니다. 이것들은 결국 수동적 인주의가 필요하지만, 즉시는 아닙니다.\n", "\n", "5. TensorFlow 1.15로 변환된 테스트 실행: 코드는 여전히 TensorFlow 1.15에서 제대로 실행되어야 합니다. 단위 테스트를 다시 실행하세요. 테스트에서 오류가 발생하면 업그레이드 스크립트에 버그가 있음을 의미합니다. 여기에서 공유해주세요.\n", "\n", "6. **업그레이드 보고서에 경고 및 오류가 있는지 확인**: 스크립트를 통해 다시 점검해야 할 변환이나 수행해야 하는 수동 작업을 설명하는 보고서 파일이 작성됩니다. 예를 들어, 나머지 contrib 인스턴스를 제거하려면 수동 조치가 필요합니다. [자세한 내용은 RFC](https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md)를 참조하세요.\n", "\n", "7. TensorFlow 2.x 설치: 이 시점에서는 기존 동작으로 실행하는 경우에도 TensorFlow 2.x 바이너리로 전환하는 것이 안전합니다.\n", "\n", "8. v1.disable_v2_behavior로 테스트: 테스트 기본 함수에서 v1.disable_v2_behavior()를 사용하여 테스트를 다시 실행하면 1.15에서 실행되는 것과 동일한 결과가 제공됩니다.\n", "\n", "9. **V2 동작 활성화**: 이제 테스트가 TF2 바이너리를 사용하여 작동하므로 이제 `tf.estimator`를 피하고 지원되는 TF2 동작만 사용하도록 코드 마이그레이션을 시작할 수 있습니다(TF2 동작 비활성화 없음). 자세한 내용은 마이그레이션 가이드를 참조하세요." ] }, { "cell_type": "markdown", "metadata": { "id": "6pwSAQEwvscP" }, "source": [ "## 심볼 재작성 tf_upgrade_v2 스크립트 사용\n" ] }, { "cell_type": "markdown", "metadata": { "id": "I9NCvDt5GwX4" }, "source": [ "### 설치하기\n", "\n", "시작하기 전에 TensorFlow 2.x가 설치되어 있는지 확인합니다." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2022-12-14T20:30:17.458533Z", "iopub.status.busy": "2022-12-14T20:30:17.458061Z", "iopub.status.idle": "2022-12-14T20:30:19.343347Z", "shell.execute_reply": "2022-12-14T20:30:19.342703Z" }, "id": "DWVYbvi1WCeY" }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2022-12-14 20:30:18.393166: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory\n", "2022-12-14 20:30:18.393261: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory\n", "2022-12-14 20:30:18.393270: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2.11.0\n" ] } ], "source": [ "import tensorflow as tf\n", "\n", "print(tf.__version__)" ] }, { "cell_type": "markdown", "metadata": { "id": "Ycy3B5PNGutU" }, "source": [ "몇 가지 코드를 테스트하기 위해 [tensorflow/models](https://github.com/tensorflow/models) git 리포지토리를 복제합니다." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2022-12-14T20:30:19.347004Z", "iopub.status.busy": "2022-12-14T20:30:19.346583Z", "iopub.status.idle": "2022-12-14T20:30:31.220607Z", "shell.execute_reply": "2022-12-14T20:30:31.219786Z" }, "id": "jyckoWyAZEhZ" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Cloning into 'models'...\r\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Enumerating objects: 2927, done.\u001b[K\r\n", "remote: Counting objects: 0% (1/2927)\u001b[K\r", "remote: Counting objects: 1% (30/2927)\u001b[K\r", "remote: Counting objects: 2% (59/2927)\u001b[K\r", "remote: Counting objects: 3% (88/2927)\u001b[K\r", "remote: Counting objects: 4% (118/2927)\u001b[K\r", "remote: Counting objects: 5% (147/2927)\u001b[K\r", "remote: Counting objects: 6% (176/2927)\u001b[K\r", "remote: Counting objects: 7% (205/2927)\u001b[K\r", "remote: Counting objects: 8% (235/2927)\u001b[K\r", "remote: Counting objects: 9% (264/2927)\u001b[K\r", "remote: Counting objects: 10% (293/2927)\u001b[K\r", "remote: Counting objects: 11% (322/2927)\u001b[K\r", "remote: Counting objects: 12% (352/2927)\u001b[K\r", "remote: Counting objects: 13% (381/2927)\u001b[K\r", "remote: Counting objects: 14% (410/2927)\u001b[K\r", "remote: Counting objects: 15% (440/2927)\u001b[K\r", "remote: Counting objects: 16% (469/2927)\u001b[K\r", "remote: Counting objects: 17% (498/2927)\u001b[K\r", "remote: Counting objects: 18% (527/2927)\u001b[K\r", "remote: Counting objects: 19% (557/2927)\u001b[K\r", "remote: Counting objects: 20% (586/2927)\u001b[K\r", "remote: Counting objects: 21% (615/2927)\u001b[K\r", "remote: Counting objects: 22% (644/2927)\u001b[K\r", "remote: Counting objects: 23% (674/2927)\u001b[K\r", "remote: Counting objects: 24% (703/2927)\u001b[K\r", "remote: Counting objects: 25% (732/2927)\u001b[K\r", "remote: Counting objects: 26% (762/2927)\u001b[K\r", "remote: Counting objects: 27% (791/2927)\u001b[K\r", "remote: Counting objects: 28% (820/2927)\u001b[K\r", "remote: Counting objects: 29% (849/2927)\u001b[K\r", "remote: Counting objects: 30% (879/2927)\u001b[K\r", "remote: Counting objects: 31% (908/2927)\u001b[K\r", "remote: Counting objects: 32% (937/2927)\u001b[K\r", "remote: Counting objects: 33% (966/2927)\u001b[K\r", "remote: Counting objects: 34% (996/2927)\u001b[K\r", "remote: Counting objects: 35% (1025/2927)\u001b[K\r", "remote: Counting objects: 36% (1054/2927)\u001b[K\r", "remote: Counting objects: 37% (1083/2927)\u001b[K\r", "remote: Counting objects: 38% (1113/2927)\u001b[K\r", "remote: Counting objects: 39% (1142/2927)\u001b[K\r", "remote: Counting objects: 40% (1171/2927)\u001b[K\r", "remote: Counting objects: 41% (1201/2927)\u001b[K\r", "remote: Counting objects: 42% (1230/2927)\u001b[K\r", "remote: Counting objects: 43% (1259/2927)\u001b[K\r", "remote: Counting objects: 44% (1288/2927)\u001b[K\r", "remote: Counting objects: 45% (1318/2927)\u001b[K\r", "remote: Counting objects: 46% (1347/2927)\u001b[K\r", "remote: Counting objects: 47% (1376/2927)\u001b[K\r", "remote: Counting objects: 48% (1405/2927)\u001b[K\r", "remote: Counting objects: 49% (1435/2927)\u001b[K\r", "remote: Counting objects: 50% (1464/2927)\u001b[K\r", "remote: Counting objects: 51% (1493/2927)\u001b[K\r", "remote: Counting objects: 52% (1523/2927)\u001b[K\r", "remote: Counting objects: 53% (1552/2927)\u001b[K\r", "remote: Counting objects: 54% (1581/2927)\u001b[K\r", "remote: Counting objects: 55% (1610/2927)\u001b[K\r", "remote: Counting objects: 56% (1640/2927)\u001b[K\r", "remote: Counting objects: 57% (1669/2927)\u001b[K\r", "remote: Counting objects: 58% (1698/2927)\u001b[K\r", "remote: Counting objects: 59% (1727/2927)\u001b[K\r", "remote: Counting objects: 60% (1757/2927)\u001b[K\r", "remote: Counting objects: 61% (1786/2927)\u001b[K\r", "remote: Counting objects: 62% (1815/2927)\u001b[K\r", "remote: Counting objects: 63% (1845/2927)\u001b[K\r", "remote: Counting objects: 64% (1874/2927)\u001b[K\r", "remote: Counting objects: 65% (1903/2927)\u001b[K\r", "remote: Counting objects: 66% (1932/2927)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Counting objects: 67% (1962/2927)\u001b[K\r", "remote: Counting objects: 68% (1991/2927)\u001b[K\r", "remote: Counting objects: 69% (2020/2927)\u001b[K\r", "remote: Counting objects: 70% (2049/2927)\u001b[K\r", "remote: Counting objects: 71% (2079/2927)\u001b[K\r", "remote: Counting objects: 72% (2108/2927)\u001b[K\r", "remote: Counting objects: 73% (2137/2927)\u001b[K\r", "remote: Counting objects: 74% (2166/2927)\u001b[K\r", "remote: Counting objects: 75% (2196/2927)\u001b[K\r", "remote: Counting objects: 76% (2225/2927)\u001b[K\r", "remote: Counting objects: 77% (2254/2927)\u001b[K\r", "remote: Counting objects: 78% (2284/2927)\u001b[K\r", "remote: Counting objects: 79% (2313/2927)\u001b[K\r", "remote: Counting objects: 80% (2342/2927)\u001b[K\r", "remote: Counting objects: 81% (2371/2927)\u001b[K\r", "remote: Counting objects: 82% (2401/2927)\u001b[K\r", "remote: Counting objects: 83% (2430/2927)\u001b[K\r", "remote: Counting objects: 84% (2459/2927)\u001b[K\r", "remote: Counting objects: 85% (2488/2927)\u001b[K\r", "remote: Counting objects: 86% (2518/2927)\u001b[K\r", "remote: Counting objects: 87% (2547/2927)\u001b[K\r", "remote: Counting objects: 88% (2576/2927)\u001b[K\r", "remote: Counting objects: 89% (2606/2927)\u001b[K\r", "remote: Counting objects: 90% (2635/2927)\u001b[K\r", "remote: Counting objects: 91% (2664/2927)\u001b[K\r", "remote: Counting objects: 92% (2693/2927)\u001b[K\r", "remote: Counting objects: 93% (2723/2927)\u001b[K\r", "remote: Counting objects: 94% (2752/2927)\u001b[K\r", "remote: Counting objects: 95% (2781/2927)\u001b[K\r", "remote: Counting objects: 96% (2810/2927)\u001b[K\r", "remote: Counting objects: 97% (2840/2927)\u001b[K\r", "remote: Counting objects: 98% (2869/2927)\u001b[K\r", "remote: Counting objects: 99% (2898/2927)\u001b[K\r", "remote: Counting objects: 100% (2927/2927)\u001b[K\r", "remote: Counting objects: 100% (2927/2927), done.\u001b[K\r\n", "remote: Compressing objects: 0% (1/2428)\u001b[K\r", "remote: Compressing objects: 1% (25/2428)\u001b[K\r", "remote: Compressing objects: 2% (49/2428)\u001b[K\r", "remote: Compressing objects: 3% (73/2428)\u001b[K\r", "remote: Compressing objects: 4% (98/2428)\u001b[K\r", "remote: Compressing objects: 5% (122/2428)\u001b[K\r", "remote: Compressing objects: 6% (146/2428)\u001b[K\r", "remote: Compressing objects: 7% (170/2428)\u001b[K\r", "remote: Compressing objects: 8% (195/2428)\u001b[K\r", "remote: Compressing objects: 9% (219/2428)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Compressing objects: 10% (243/2428)\u001b[K\r", "remote: Compressing objects: 11% (268/2428)\u001b[K\r", "remote: Compressing objects: 12% (292/2428)\u001b[K\r", "remote: Compressing objects: 13% (316/2428)\u001b[K\r", "remote: Compressing objects: 14% (340/2428)\u001b[K\r", "remote: Compressing objects: 15% (365/2428)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Compressing objects: 16% (389/2428)\u001b[K\r", "remote: Compressing objects: 17% (413/2428)\u001b[K\r", "remote: Compressing objects: 18% (438/2428)\u001b[K\r", "remote: Compressing objects: 19% (462/2428)\u001b[K\r", "remote: Compressing objects: 20% (486/2428)\u001b[K\r", "remote: Compressing objects: 21% (510/2428)\u001b[K\r", "remote: Compressing objects: 22% (535/2428)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Compressing objects: 23% (559/2428)\u001b[K\r", "remote: Compressing objects: 24% (583/2428)\u001b[K\r", "remote: Compressing objects: 25% (607/2428)\u001b[K\r", "remote: Compressing objects: 26% (632/2428)\u001b[K\r", "remote: Compressing objects: 27% (656/2428)\u001b[K\r", "remote: Compressing objects: 28% (680/2428)\u001b[K\r", "remote: Compressing objects: 29% (705/2428)\u001b[K\r", "remote: Compressing objects: 30% (729/2428)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Compressing objects: 31% (753/2428)\u001b[K\r", "remote: Compressing objects: 32% (777/2428)\u001b[K\r", "remote: Compressing objects: 33% (802/2428)\u001b[K\r", "remote: Compressing objects: 34% (826/2428)\u001b[K\r", "remote: Compressing objects: 35% (850/2428)\u001b[K\r", "remote: Compressing objects: 36% (875/2428)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Compressing objects: 37% (899/2428)\u001b[K\r", "remote: Compressing objects: 38% (923/2428)\u001b[K\r", "remote: Compressing objects: 39% (947/2428)\u001b[K\r", "remote: Compressing objects: 40% (972/2428)\u001b[K\r", "remote: Compressing objects: 41% (996/2428)\u001b[K\r", "remote: Compressing objects: 42% (1020/2428)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Compressing objects: 43% (1045/2428)\u001b[K\r", "remote: Compressing objects: 44% (1069/2428)\u001b[K\r", "remote: Compressing objects: 45% (1093/2428)\u001b[K\r", "remote: Compressing objects: 46% (1117/2428)\u001b[K\r", "remote: Compressing objects: 47% (1142/2428)\u001b[K\r", "remote: Compressing objects: 48% (1166/2428)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Compressing objects: 49% (1190/2428)\u001b[K\r", "remote: Compressing objects: 50% (1214/2428)\u001b[K\r", "remote: Compressing objects: 51% (1239/2428)\u001b[K\r", "remote: Compressing objects: 52% (1263/2428)\u001b[K\r", "remote: Compressing objects: 53% (1287/2428)\u001b[K\r", "remote: Compressing objects: 54% (1312/2428)\u001b[K\r", "remote: Compressing objects: 55% (1336/2428)\u001b[K\r", "remote: Compressing objects: 56% (1360/2428)\u001b[K\r", "remote: Compressing objects: 57% (1384/2428)\u001b[K\r", "remote: Compressing objects: 58% (1409/2428)\u001b[K\r", "remote: Compressing objects: 59% (1433/2428)\u001b[K\r", "remote: Compressing objects: 60% (1457/2428)\u001b[K\r", "remote: Compressing objects: 61% (1482/2428)\u001b[K\r", "remote: Compressing objects: 62% (1506/2428)\u001b[K\r", "remote: Compressing objects: 63% (1530/2428)\u001b[K\r", "remote: Compressing objects: 64% (1554/2428)\u001b[K\r", "remote: Compressing objects: 65% (1579/2428)\u001b[K\r", "remote: Compressing objects: 66% (1603/2428)\u001b[K\r", "remote: Compressing objects: 67% (1627/2428)\u001b[K\r", "remote: Compressing objects: 68% (1652/2428)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Compressing objects: 69% (1676/2428)\u001b[K\r", "remote: Compressing objects: 70% (1700/2428)\u001b[K\r", "remote: Compressing objects: 71% (1724/2428)\u001b[K\r", "remote: Compressing objects: 72% (1749/2428)\u001b[K\r", "remote: Compressing objects: 73% (1773/2428)\u001b[K\r", "remote: Compressing objects: 74% (1797/2428)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Compressing objects: 75% (1821/2428)\u001b[K\r", "remote: Compressing objects: 76% (1846/2428)\u001b[K\r", "remote: Compressing objects: 77% (1870/2428)\u001b[K\r", "remote: Compressing objects: 78% (1894/2428)\u001b[K\r", "remote: Compressing objects: 79% (1919/2428)\u001b[K\r", "remote: Compressing objects: 80% (1943/2428)\u001b[K\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "remote: Compressing objects: 81% (1967/2428)\u001b[K\r", "remote: Compressing objects: 82% (1991/2428)\u001b[K\r", "remote: Compressing objects: 83% (2016/2428)\u001b[K\r", "remote: Compressing objects: 84% (2040/2428)\u001b[K\r", "remote: Compressing objects: 85% (2064/2428)\u001b[K\r", "remote: Compressing objects: 86% (2089/2428)\u001b[K\r", "remote: Compressing objects: 87% (2113/2428)\u001b[K\r", "remote: Compressing objects: 88% (2137/2428)\u001b[K\r", "remote: Compressing objects: 89% (2161/2428)\u001b[K\r", "remote: Compressing objects: 90% (2186/2428)\u001b[K\r", "remote: Compressing objects: 91% (2210/2428)\u001b[K\r", "remote: Compressing objects: 92% (2234/2428)\u001b[K\r", "remote: Compressing objects: 93% (2259/2428)\u001b[K\r", "remote: Compressing objects: 94% (2283/2428)\u001b[K\r", "remote: Compressing objects: 95% (2307/2428)\u001b[K\r", "remote: Compressing objects: 96% (2331/2428)\u001b[K\r", "remote: Compressing objects: 97% (2356/2428)\u001b[K\r", "remote: Compressing objects: 98% (2380/2428)\u001b[K\r", "remote: Compressing objects: 99% (2404/2428)\u001b[K\r", "remote: Compressing objects: 100% (2428/2428)\u001b[K\r", "remote: Compressing objects: 100% (2428/2428), done.\u001b[K\r\n", "Receiving objects: 0% (1/2927)\r", "Receiving objects: 1% (30/2927)\r", "Receiving objects: 2% (59/2927)\r", "Receiving objects: 3% (88/2927)\r", "Receiving objects: 4% (118/2927)\r", "Receiving objects: 5% (147/2927)\r", "Receiving objects: 6% (176/2927)\r", "Receiving objects: 7% (205/2927)\r", "Receiving objects: 8% (235/2927)\r", "Receiving objects: 9% (264/2927)\r", "Receiving objects: 10% (293/2927)\r", "Receiving objects: 11% (322/2927)\r", "Receiving objects: 12% (352/2927)\r", "Receiving objects: 13% (381/2927)\r", "Receiving objects: 14% (410/2927)\r", "Receiving objects: 15% (440/2927)\r", "Receiving objects: 16% (469/2927)\r", "Receiving objects: 17% (498/2927)\r", "Receiving objects: 18% (527/2927)\r", "Receiving objects: 19% (557/2927)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 20% (586/2927)\r", "Receiving objects: 21% (615/2927)\r", "Receiving objects: 22% (644/2927)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 23% (674/2927)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 24% (703/2927)\r", "Receiving objects: 25% (732/2927)\r", "Receiving objects: 26% (762/2927)\r", "Receiving objects: 27% (791/2927)\r", "Receiving objects: 28% (820/2927)\r", "Receiving objects: 29% (849/2927)\r", "Receiving objects: 30% (879/2927)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 31% (908/2927)\r", "Receiving objects: 32% (937/2927)\r", "Receiving objects: 33% (966/2927)\r", "Receiving objects: 34% (996/2927)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 35% (1025/2927)\r", "Receiving objects: 36% (1054/2927)\r", "Receiving objects: 37% (1083/2927)\r", "Receiving objects: 38% (1113/2927)\r", "Receiving objects: 39% (1142/2927)\r", "Receiving objects: 40% (1171/2927)\r", "Receiving objects: 41% (1201/2927)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 41% (1222/2927), 68.66 MiB | 68.66 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 42% (1230/2927), 96.58 MiB | 64.38 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 43% (1259/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 44% (1288/2927), 96.58 MiB | 64.38 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 45% (1318/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 46% (1347/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 47% (1376/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 48% (1405/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 49% (1435/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 50% (1464/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 51% (1493/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 52% (1523/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 53% (1552/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 54% (1581/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 55% (1610/2927), 96.58 MiB | 64.38 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 56% (1640/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 57% (1669/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 58% (1698/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 59% (1727/2927), 96.58 MiB | 64.38 MiB/s\r", "Receiving objects: 60% (1757/2927), 96.58 MiB | 64.38 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 60% (1776/2927), 125.70 MiB | 62.85 MiB/s\r", "Receiving objects: 61% (1786/2927), 125.70 MiB | 62.85 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 62% (1815/2927), 125.70 MiB | 62.85 MiB/s\r", "Receiving objects: 63% (1845/2927), 125.70 MiB | 62.85 MiB/s\r", "Receiving objects: 64% (1874/2927), 125.70 MiB | 62.85 MiB/s\r", "Receiving objects: 65% (1903/2927), 125.70 MiB | 62.85 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 65% (1912/2927), 181.94 MiB | 60.65 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 66% (1932/2927), 210.18 MiB | 60.05 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 67% (1962/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 68% (1991/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 69% (2020/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 70% (2049/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 71% (2079/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 72% (2108/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 73% (2137/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 74% (2166/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 75% (2196/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 76% (2225/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 77% (2254/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 78% (2284/2927), 210.18 MiB | 60.05 MiB/s\r", "Receiving objects: 79% (2313/2927), 210.18 MiB | 60.05 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 80% (2342/2927), 210.18 MiB | 60.05 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 80% (2369/2927), 237.37 MiB | 59.34 MiB/s\r", "Receiving objects: 81% (2371/2927), 237.37 MiB | 59.34 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 82% (2401/2927), 258.93 MiB | 57.54 MiB/s\r", "Receiving objects: 83% (2430/2927), 258.93 MiB | 57.54 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 83% (2444/2927), 286.81 MiB | 56.83 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 84% (2459/2927), 286.81 MiB | 56.83 MiB/s\r", "Receiving objects: 85% (2488/2927), 286.81 MiB | 56.83 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 86% (2518/2927), 286.81 MiB | 56.83 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 87% (2547/2927), 313.21 MiB | 54.34 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 88% (2576/2927), 313.21 MiB | 54.34 MiB/s\r", "Receiving objects: 89% (2606/2927), 313.21 MiB | 54.34 MiB/s\r", "Receiving objects: 90% (2635/2927), 313.21 MiB | 54.34 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 90% (2643/2927), 340.07 MiB | 54.12 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 91% (2664/2927), 340.07 MiB | 54.12 MiB/s\r", "Receiving objects: 92% (2693/2927), 340.07 MiB | 54.12 MiB/s\r", "Receiving objects: 93% (2723/2927), 340.07 MiB | 54.12 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 94% (2752/2927), 340.07 MiB | 54.12 MiB/s\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Receiving objects: 95% (2781/2927), 340.07 MiB | 54.12 MiB/s\r", "Receiving objects: 96% (2810/2927), 340.07 MiB | 54.12 MiB/s\r", "Receiving objects: 97% (2840/2927), 340.07 MiB | 54.12 MiB/s\r", "Receiving objects: 98% (2869/2927), 340.07 MiB | 54.12 MiB/s\r", "remote: Total 2927 (delta 503), reused 2114 (delta 424), pack-reused 0\u001b[K\r\n", "Receiving objects: 99% (2898/2927), 340.07 MiB | 54.12 MiB/s\r", "Receiving objects: 100% (2927/2927), 340.07 MiB | 54.12 MiB/s\r", "Receiving objects: 100% (2927/2927), 369.04 MiB | 56.86 MiB/s, done.\r\n", "Resolving deltas: 0% (0/503)\r", "Resolving deltas: 1% (6/503)\r", "Resolving deltas: 2% (11/503)\r", "Resolving deltas: 3% (16/503)\r", "Resolving deltas: 4% (22/503)\r", "Resolving deltas: 5% (28/503)\r", "Resolving deltas: 6% (32/503)\r", "Resolving deltas: 7% (36/503)\r", "Resolving deltas: 8% (42/503)\r", "Resolving deltas: 9% (46/503)\r", "Resolving deltas: 10% (51/503)\r", "Resolving deltas: 11% (56/503)\r", "Resolving deltas: 12% (61/503)\r", "Resolving deltas: 13% (66/503)\r", "Resolving deltas: 14% (73/503)\r", "Resolving deltas: 15% (76/503)\r", "Resolving deltas: 16% (81/503)\r", "Resolving deltas: 17% (86/503)\r", "Resolving deltas: 18% (95/503)\r", "Resolving deltas: 19% (96/503)\r", "Resolving deltas: 20% (101/503)\r", "Resolving deltas: 21% (108/503)\r", "Resolving deltas: 22% (112/503)\r", "Resolving deltas: 23% (116/503)\r", "Resolving deltas: 24% (123/503)\r", "Resolving deltas: 25% (126/503)\r", "Resolving deltas: 26% (132/503)\r", "Resolving deltas: 27% (136/503)\r", "Resolving deltas: 28% (141/503)\r", "Resolving deltas: 29% (146/503)\r", "Resolving deltas: 30% (151/503)\r", "Resolving deltas: 31% (156/503)\r", "Resolving deltas: 32% (163/503)\r", "Resolving deltas: 33% (166/503)\r", "Resolving deltas: 34% (172/503)\r", "Resolving deltas: 35% (177/503)\r", "Resolving deltas: 36% (184/503)\r", "Resolving deltas: 37% (190/503)\r", "Resolving deltas: 40% (206/503)\r", "Resolving deltas: 42% (212/503)\r", "Resolving deltas: 43% (219/503)\r", "Resolving deltas: 44% (223/503)\r", "Resolving deltas: 45% (228/503)\r", "Resolving deltas: 46% (236/503)\r", "Resolving deltas: 47% (237/503)\r", "Resolving deltas: 48% (242/503)\r", "Resolving deltas: 49% (248/503)\r", "Resolving deltas: 50% (252/503)\r", "Resolving deltas: 51% (257/503)\r", "Resolving deltas: 52% (263/503)\r", "Resolving deltas: 53% (267/503)\r", "Resolving deltas: 54% (273/503)\r", "Resolving deltas: 56% (282/503)\r", "Resolving deltas: 57% (287/503)\r", "Resolving deltas: 58% (292/503)\r", "Resolving deltas: 59% (298/503)\r", "Resolving deltas: 60% (303/503)\r", "Resolving deltas: 61% (308/503)\r", "Resolving deltas: 62% (312/503)\r", "Resolving deltas: 63% (318/503)\r", "Resolving deltas: 64% (322/503)\r", "Resolving deltas: 65% (329/503)\r", "Resolving deltas: 66% (332/503)\r", "Resolving deltas: 67% (339/503)\r", "Resolving deltas: 68% (343/503)\r", "Resolving deltas: 69% (349/503)\r", "Resolving deltas: 70% (353/503)\r", "Resolving deltas: 71% (358/503)\r", "Resolving deltas: 72% (367/503)\r", "Resolving deltas: 73% (369/503)\r", "Resolving deltas: 74% (373/503)\r", "Resolving deltas: 75% (378/503)\r", "Resolving deltas: 76% (387/503)\r", "Resolving deltas: 77% (389/503)\r", "Resolving deltas: 78% (393/503)\r", "Resolving deltas: 79% (398/503)\r", "Resolving deltas: 80% (403/503)\r", "Resolving deltas: 81% (410/503)\r", "Resolving deltas: 82% (413/503)\r", "Resolving deltas: 83% (418/503)\r", "Resolving deltas: 84% (423/503)\r", "Resolving deltas: 85% (429/503)\r", "Resolving deltas: 86% (434/503)\r", "Resolving deltas: 87% (438/503)\r", "Resolving deltas: 88% (444/503)\r", "Resolving deltas: 89% (448/503)\r", "Resolving deltas: 90% (453/503)\r", "Resolving deltas: 91% (458/503)\r", "Resolving deltas: 92% (464/503)\r", "Resolving deltas: 93% (469/503)\r", "Resolving deltas: 94% (476/503)\r", "Resolving deltas: 95% (481/503)\r", "Resolving deltas: 96% (483/503)\r", "Resolving deltas: 97% (491/503)\r", "Resolving deltas: 98% (495/503)\r", "Resolving deltas: 99% (498/503)\r", "Resolving deltas: 100% (503/503)\r", "Resolving deltas: 100% (503/503), done.\r\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Updating files: 56% (1576/2768)\r", "Updating files: 57% (1578/2768)\r", "Updating files: 58% (1606/2768)\r", "Updating files: 59% (1634/2768)\r", "Updating files: 60% (1661/2768)\r", "Updating files: 61% (1689/2768)\r", "Updating files: 62% (1717/2768)\r", "Updating files: 63% (1744/2768)\r", "Updating files: 64% (1772/2768)\r", "Updating files: 65% (1800/2768)\r", "Updating files: 66% (1827/2768)\r", "Updating files: 67% (1855/2768)\r", "Updating files: 68% (1883/2768)\r", "Updating files: 69% (1910/2768)\r", "Updating files: 70% (1938/2768)\r", "Updating files: 71% (1966/2768)\r", "Updating files: 72% (1993/2768)\r", "Updating files: 73% (2021/2768)\r", "Updating files: 74% (2049/2768)\r", "Updating files: 75% (2076/2768)\r", "Updating files: 76% (2104/2768)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Updating files: 77% (2132/2768)\r", "Updating files: 78% (2160/2768)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Updating files: 79% (2187/2768)\r", "Updating files: 80% (2215/2768)\r", "Updating files: 81% (2243/2768)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Updating files: 81% (2248/2768)\r", "Updating files: 82% (2270/2768)\r", "Updating files: 83% (2298/2768)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Updating files: 84% (2326/2768)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Updating files: 85% (2353/2768)\r", "Updating files: 86% (2381/2768)\r", "Updating files: 87% (2409/2768)\r", "Updating files: 88% (2436/2768)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Updating files: 89% (2464/2768)\r", "Updating files: 90% (2492/2768)\r", "Updating files: 91% (2519/2768)\r", "Updating files: 92% (2547/2768)\r", "Updating files: 93% (2575/2768)\r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Updating files: 94% (2602/2768)\r", "Updating files: 95% (2630/2768)\r", "Updating files: 96% (2658/2768)\r", "Updating files: 97% (2685/2768)\r", "Updating files: 98% (2713/2768)\r", "Updating files: 99% (2741/2768)\r", "Updating files: 100% (2768/2768)\r", "Updating files: 100% (2768/2768), done.\r\n" ] } ], "source": [ "!git clone --branch r1.13.0 --depth 1 https://github.com/tensorflow/models" ] }, { "cell_type": "markdown", "metadata": { "id": "wfHOhbkgvrKr" }, "source": [ "### 도움말 읽기\n", "\n", "스크립트는 TensorFlow와 함께 설치해야 합니다. 기본 도움말은 다음과 같습니다." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2022-12-14T20:30:31.225061Z", "iopub.status.busy": "2022-12-14T20:30:31.224402Z", "iopub.status.idle": "2022-12-14T20:30:33.645667Z", "shell.execute_reply": "2022-12-14T20:30:33.644823Z" }, "id": "m2GF-tlntqTQ" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2022-12-14 20:30:32.304651: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory\r\n", "2022-12-14 20:30:32.304742: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory\r\n", "2022-12-14 20:30:32.304752: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.\r\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "usage: tf_upgrade_v2 [-h] [--infile INPUT_FILE] [--outfile OUTPUT_FILE]\r\n", " [--intree INPUT_TREE] [--outtree OUTPUT_TREE]\r\n", " [--copyotherfiles COPY_OTHER_FILES] [--inplace]\r\n", " [--no_import_rename] [--no_upgrade_compat_v1_import]\r\n", " [--reportfile REPORT_FILENAME] [--mode {DEFAULT,SAFETY}]\r\n", " [--print_all]\r\n", "\r\n", "Convert a TensorFlow Python file from 1.x to 2.0\r\n", "\r\n", "Simple usage:\r\n", " tf_upgrade_v2.py --infile foo.py --outfile bar.py\r\n", " tf_upgrade_v2.py --infile foo.ipynb --outfile bar.ipynb\r\n", " tf_upgrade_v2.py --intree ~/code/old --outtree ~/code/new\r\n", "\r\n", "optional arguments:\r\n", " -h, --help show this help message and exit\r\n", " --infile INPUT_FILE If converting a single file, the name of the file to\r\n", " convert\r\n", " --outfile OUTPUT_FILE\r\n", " If converting a single file, the output filename.\r\n", " --intree INPUT_TREE If converting a whole tree of files, the directory to\r\n", " read from (relative or absolute).\r\n", " --outtree OUTPUT_TREE\r\n", " If converting a whole tree of files, the output\r\n", " directory (relative or absolute).\r\n", " --copyotherfiles COPY_OTHER_FILES\r\n", " If converting a whole tree of files, whether to copy\r\n", " the other files.\r\n", " --inplace If converting a set of files, whether to allow the\r\n", " conversion to be performed on the input files.\r\n", " --no_import_rename Not to rename import to compat.v2 explicitly.\r\n", " --no_upgrade_compat_v1_import\r\n", " If specified, don't upgrade explicit imports of\r\n", " `tensorflow.compat.v1 as tf` to the v2 APIs.\r\n", " Otherwise, explicit imports of the form\r\n", " `tensorflow.compat.v1 as tf` will be upgraded.\r\n", " --reportfile REPORT_FILENAME\r\n", " The name of the file where the report log is\r\n", " stored.(default: report.txt)\r\n", " --mode {DEFAULT,SAFETY}\r\n", " Upgrade script mode. Supported modes: DEFAULT: Perform\r\n", " only straightforward conversions to upgrade to 2.0. In\r\n", " more difficult cases, switch to use compat.v1. SAFETY:\r\n", " Keep 1.* code intact and import compat.v1 module.\r\n", " --print_all Print full log to stdout instead of just printing\r\n", " errors\r\n" ] } ], "source": [ "!tf_upgrade_v2 -h" ] }, { "cell_type": "markdown", "metadata": { "id": "se9Leqjm1CZR" }, "source": [ "### TF1 코드 예" ] }, { "cell_type": "markdown", "metadata": { "id": "whD5i36s1SuM" }, "source": [ "간단한 TensorFlow 1.0 스크립트는 다음과 같습니다." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2022-12-14T20:30:33.650342Z", "iopub.status.busy": "2022-12-14T20:30:33.649751Z", "iopub.status.idle": "2022-12-14T20:30:33.776911Z", "shell.execute_reply": "2022-12-14T20:30:33.776158Z" }, "id": "mhGbYQ9HwbeU" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " # Calculate loss using mean squared error\r\n", " average_loss = tf.losses.mean_squared_error(labels, predictions)\r\n", "\r\n", " # Pre-made estimators use the total_loss instead of the average,\r\n", " # so report total_loss for compatibility.\r\n", " batch_size = tf.shape(labels)[0]\r\n", " total_loss = tf.to_float(batch_size) * average_loss\r\n", "\r\n", " if mode == tf.estimator.ModeKeys.TRAIN:\r\n", " optimizer = params.get(\"optimizer\", tf.train.AdamOptimizer)\r\n" ] } ], "source": [ "!head -n 65 models/samples/cookbook/regression/custom_regression.py | tail -n 10" ] }, { "cell_type": "markdown", "metadata": { "id": "UGO7xSyL89wX" }, "source": [ "TensorFlow 2.x가 설치되어 있으면 다음과 같이 실행되지 않습니다." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2022-12-14T20:30:33.780745Z", "iopub.status.busy": "2022-12-14T20:30:33.780207Z", "iopub.status.idle": "2022-12-14T20:30:36.178427Z", "shell.execute_reply": "2022-12-14T20:30:36.177540Z" }, "id": "TD7fFphX8_qE" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2022-12-14 20:30:34.855852: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory\r\n", "2022-12-14 20:30:34.855938: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory\r\n", "2022-12-14 20:30:34.855948: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.\r\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Traceback (most recent call last):\r\n", " File \"/tmpfs/src/temp/site/ko/guide/migrate/models/samples/cookbook/regression/custom_regression.py\", line 162, in