|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "code",
|
5 |
| - "execution_count": 2, |
| 5 | + "execution_count": 1, |
6 | 6 | "metadata": {},
|
7 | 7 | "outputs": [
|
8 | 8 | {
|
9 | 9 | "name": "stderr",
|
10 | 10 | "output_type": "stream",
|
11 | 11 | "text": [
|
12 |
| - "2024-12-02 10:50:03.729385: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX_VNNI FMA\n", |
| 12 | + "2024-12-02 12:11:43.237267: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX_VNNI FMA\n", |
13 | 13 | "To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
|
14 |
| - "2024-12-02 10:50:03.793060: I tensorflow/core/util/port.cc:104] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n", |
15 |
| - "2024-12-02 10:50:03.794942: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory\n", |
16 |
| - "2024-12-02 10:50:03.794954: I tensorflow/compiler/xla/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.\n", |
17 |
| - "2024-12-02 10:50:06.943195: 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", |
18 |
| - "2024-12-02 10:50:06.943319: 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", |
19 |
| - "2024-12-02 10:50:06.943333: 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" |
| 14 | + "2024-12-02 12:11:43.289566: I tensorflow/core/util/port.cc:104] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n", |
| 15 | + "2024-12-02 12:11:43.291412: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory\n", |
| 16 | + "2024-12-02 12:11:43.291421: I tensorflow/compiler/xla/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.\n", |
| 17 | + "2024-12-02 12:11:43.592090: 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", |
| 18 | + "2024-12-02 12:11:43.592117: 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", |
| 19 | + "2024-12-02 12:11:43.592120: 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" |
20 | 20 | ]
|
21 | 21 | }
|
22 | 22 | ],
|
|
56 | 56 | },
|
57 | 57 | {
|
58 | 58 | "cell_type": "code",
|
59 |
| - "execution_count": 3, |
| 59 | + "execution_count": 2, |
60 | 60 | "metadata": {},
|
61 | 61 | "outputs": [],
|
62 | 62 | "source": [
|
|
69 | 69 | },
|
70 | 70 | {
|
71 | 71 | "cell_type": "code",
|
72 |
| - "execution_count": 4, |
| 72 | + "execution_count": 3, |
73 | 73 | "metadata": {},
|
74 | 74 | "outputs": [],
|
75 | 75 | "source": [
|
|
94 | 94 | },
|
95 | 95 | {
|
96 | 96 | "cell_type": "code",
|
97 |
| - "execution_count": 5, |
| 97 | + "execution_count": 4, |
98 | 98 | "metadata": {},
|
99 | 99 | "outputs": [],
|
100 | 100 | "source": [
|
|
128 | 128 | },
|
129 | 129 | {
|
130 | 130 | "cell_type": "code",
|
131 |
| - "execution_count": 6, |
| 131 | + "execution_count": 5, |
132 | 132 | "metadata": {},
|
133 | 133 | "outputs": [
|
134 | 134 | {
|
|
144 | 144 | "name": "stderr",
|
145 | 145 | "output_type": "stream",
|
146 | 146 | "text": [
|
147 |
| - "2024-12-02 10:51:09.801613: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory\n", |
148 |
| - "2024-12-02 10:51:09.801630: W tensorflow/compiler/xla/stream_executor/cuda/cuda_driver.cc:265] failed call to cuInit: UNKNOWN ERROR (303)\n", |
149 |
| - "2024-12-02 10:51:09.801640: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (correlator7.fnal.gov): /proc/driver/nvidia/version does not exist\n", |
150 |
| - "2024-12-02 10:51:09.801767: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX_VNNI FMA\n", |
| 147 | + "2024-12-02 12:12:42.530268: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory\n", |
| 148 | + "2024-12-02 12:12:42.530285: W tensorflow/compiler/xla/stream_executor/cuda/cuda_driver.cc:265] failed call to cuInit: UNKNOWN ERROR (303)\n", |
| 149 | + "2024-12-02 12:12:42.530294: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (correlator7.fnal.gov): /proc/driver/nvidia/version does not exist\n", |
| 150 | + "2024-12-02 12:12:42.530419: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX_VNNI FMA\n", |
151 | 151 | "To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n"
|
152 | 152 | ]
|
153 | 153 | },
|
|
206 | 206 | },
|
207 | 207 | {
|
208 | 208 | "cell_type": "code",
|
209 |
| - "execution_count": 7, |
| 209 | + "execution_count": 6, |
210 | 210 | "metadata": {},
|
211 | 211 | "outputs": [],
|
212 | 212 | "source": [
|
|
230 | 230 | "cell_type": "code",
|
231 | 231 | "execution_count": 8,
|
232 | 232 | "metadata": {},
|
233 |
| - "outputs": [ |
234 |
| - { |
235 |
| - "name": "stdout", |
236 |
| - "output_type": "stream", |
237 |
| - "text": [ |
238 |
| - "Epoch 1/50\n", |
239 |
| - "3340/3340 [==============================] - 9s 2ms/step - loss: 0.1959 - accuracy: 0.9558 - val_loss: 0.1810 - val_accuracy: 0.9581\n", |
240 |
| - "Epoch 2/50\n", |
241 |
| - "3340/3340 [==============================] - 10s 3ms/step - loss: 0.1802 - accuracy: 0.9592 - val_loss: 0.1770 - val_accuracy: 0.9583\n", |
242 |
| - "Epoch 3/50\n", |
243 |
| - "3340/3340 [==============================] - 3s 800us/step - loss: 0.1787 - accuracy: 0.9595 - val_loss: 0.1783 - val_accuracy: 0.9584\n", |
244 |
| - "Epoch 4/50\n", |
245 |
| - "3340/3340 [==============================] - 8s 2ms/step - loss: 0.1782 - accuracy: 0.9598 - val_loss: 0.1776 - val_accuracy: 0.9585\n", |
246 |
| - "Epoch 5/50\n", |
247 |
| - "3340/3340 [==============================] - 9s 3ms/step - loss: 0.1792 - accuracy: 0.9593 - val_loss: 0.1770 - val_accuracy: 0.9583\n", |
248 |
| - "Epoch 6/50\n", |
249 |
| - "3340/3340 [==============================] - 6s 2ms/step - loss: 0.1791 - accuracy: 0.9593 - val_loss: 0.1796 - val_accuracy: 0.9582\n", |
250 |
| - "Epoch 7/50\n", |
251 |
| - "3340/3340 [==============================] - 6s 2ms/step - loss: 0.1784 - accuracy: 0.9598 - val_loss: 0.1783 - val_accuracy: 0.9588\n", |
252 |
| - "Epoch 8/50\n", |
253 |
| - "3340/3340 [==============================] - 2s 671us/step - loss: 0.1779 - accuracy: 0.9597 - val_loss: 0.1783 - val_accuracy: 0.9584\n", |
254 |
| - "Epoch 9/50\n", |
255 |
| - "3340/3340 [==============================] - 6s 2ms/step - loss: 0.1779 - accuracy: 0.9601 - val_loss: 0.1783 - val_accuracy: 0.9586\n", |
256 |
| - "Epoch 10/50\n", |
257 |
| - "3340/3340 [==============================] - 11s 3ms/step - loss: 0.1778 - accuracy: 0.9599 - val_loss: 0.1777 - val_accuracy: 0.9587\n", |
258 |
| - "Epoch 11/50\n", |
259 |
| - "3340/3340 [==============================] - 8s 2ms/step - loss: 0.1778 - accuracy: 0.9599 - val_loss: 0.1775 - val_accuracy: 0.9584\n", |
260 |
| - "Epoch 12/50\n", |
261 |
| - "3340/3340 [==============================] - 11s 3ms/step - loss: 0.1779 - accuracy: 0.9599 - val_loss: 0.1781 - val_accuracy: 0.9583\n", |
262 |
| - "Epoch 13/50\n", |
263 |
| - "3340/3340 [==============================] - 11s 3ms/step - loss: 0.1779 - accuracy: 0.9599 - val_loss: 0.1779 - val_accuracy: 0.9584\n", |
264 |
| - "Epoch 14/50\n", |
265 |
| - "3340/3340 [==============================] - 6s 2ms/step - loss: 0.1779 - accuracy: 0.9599 - val_loss: 0.1775 - val_accuracy: 0.9586\n", |
266 |
| - "Epoch 15/50\n", |
267 |
| - "3340/3340 [==============================] - 8s 2ms/step - loss: 0.1778 - accuracy: 0.9600 - val_loss: 0.1772 - val_accuracy: 0.9585\n" |
268 |
| - ] |
269 |
| - } |
270 |
| - ], |
| 233 | + "outputs": [], |
271 | 234 | "source": [
|
272 |
| - "train = True\n", |
| 235 | + "train = False\n", |
273 | 236 | "\n",
|
274 | 237 | "if train: \n",
|
275 | 238 | " opt = Adam(learning_rate=init_learning_rate)\n",
|
|
312 | 275 | },
|
313 | 276 | {
|
314 | 277 | "cell_type": "code",
|
315 |
| - "execution_count": 28, |
| 278 | + "execution_count": 10, |
316 | 279 | "metadata": {},
|
317 | 280 | "outputs": [
|
318 | 281 | {
|
319 | 282 | "name": "stdout",
|
320 | 283 | "output_type": "stream",
|
321 | 284 | "text": [
|
322 |
| - "1563/1563 [==============================] - 1s 484us/step\n", |
323 |
| - "1563/1563 [==============================] - 1s 359us/step\n", |
324 |
| - "3125/3125 [==============================] - 1s 391us/step\n", |
| 285 | + "1563/1563 [==============================] - 1s 406us/step\n", |
| 286 | + "1563/1563 [==============================] - 1s 389us/step\n", |
| 287 | + "3125/3125 [==============================] - 1s 385us/step\n", |
325 | 288 | "\n",
|
326 | 289 | "===================================\n",
|
327 | 290 | " Accuracy 0.95999\n",
|
328 |
| - " Fidelity 0.979995\n" |
| 291 | + " Fidelity 0.9599899999999999\n" |
329 | 292 | ]
|
330 | 293 | }
|
331 | 294 | ],
|
|
359 | 322 | "\n",
|
360 | 323 | "# compute fidelity \n",
|
361 | 324 | "test_fidelity = 0.5*(e_accuracy + g_accuracy)\n",
|
| 325 | + "test_fidelity = test_fidelity*2-1\n", |
362 | 326 | "test_fidelity = 1/2 + (0.5*test_fidelity)\n",
|
363 | 327 | "\n",
|
364 | 328 | "y_pred = model.predict(X_test)\n",
|
|
368 | 332 | "print(' Accuracy', test_acc)\n",
|
369 | 333 | "print(' Fidelity', test_fidelity)"
|
370 | 334 | ]
|
| 335 | + }, |
| 336 | + { |
| 337 | + "cell_type": "code", |
| 338 | + "execution_count": null, |
| 339 | + "metadata": {}, |
| 340 | + "outputs": [], |
| 341 | + "source": [] |
371 | 342 | }
|
372 | 343 | ],
|
373 | 344 | "metadata": {
|
|
0 commit comments