Skip to content

Commit

Permalink
add easter2 keras version
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikgill committed May 19, 2022
1 parent cb46777 commit 95783d8
Show file tree
Hide file tree
Showing 9 changed files with 1,358 additions and 0 deletions.
204 changes: 204 additions & 0 deletions notebooks/Testing.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "77c7178c-11ab-49c7-a06d-1155d1ea0930",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"os.chdir(\"../src\")\n",
"from predict import test_on_iam"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "13288874-b00c-4656-9edf-917c33c574e0",
"metadata": {},
"outputs": [],
"source": [
"checkpoint_path = \"../weights/saved_checkpoint.hdf5\""
]
},
{
"cell_type": "markdown",
"id": "334f0bb1-ab8e-4d16-b57f-4d7b620bde60",
"metadata": {},
"source": [
"## Check CER on validation set"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "513687b1-8482-4674-9ca3-d6815735b67e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"loading metdata...\n",
"loading checkpoint...\n",
"calculating results...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-04-11 14:56:53.657171: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:936] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
"2022-04-11 14:56:53.666807: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:936] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
"2022-04-11 14:56:53.667454: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:936] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
"2022-04-11 14:56:53.669102: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA\n",
"To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
"2022-04-11 14:56:53.669994: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:936] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
"2022-04-11 14:56:53.670727: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:936] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
"2022-04-11 14:56:53.671290: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:936] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
"2022-04-11 14:56:54.147843: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:936] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
"2022-04-11 14:56:54.148505: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:936] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
"2022-04-11 14:56:54.149171: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:936] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
"2022-04-11 14:56:54.149726: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 13823 MB memory: -> device: 0, name: Tesla T4, pci bus id: 0000:00:04.0, compute capability: 7.5\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Using Validation Partition\n",
"Number of Samples : 976\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 0/976 [00:00<?, ?it/s]2022-04-11 14:57:00.375571: I tensorflow/stream_executor/cuda/cuda_dnn.cc:368] Loaded cuDNN version 8200\n",
"100%|██████████| 976/976 [00:45<00:00, 21.62it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Character error rate is : 4.8644015333698425\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"test_on_iam(show=False, partition=\"validation\", checkpoint=checkpoint_path, uncased=True)"
]
},
{
"cell_type": "markdown",
"id": "7d532c9f-a402-4e97-aeb4-b0909e88e685",
"metadata": {},
"source": [
"## Check CER on Test Set"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "559f349c-bde9-4be6-b912-23332b464b46",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"loading metdata...\n",
"loading checkpoint...\n",
"calculating results...\n",
"Using Test Partition\n",
"Number of Samples : 2915\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 2915/2915 [02:08<00:00, 22.74it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Character error rate is : 7.70544392486075\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"test_on_iam(show=False, partition=\"test\", checkpoint=checkpoint_path, uncased=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "06f36502-1cf3-4e88-9f5c-b546fd6812f6",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "40e28a2d-e5b0-4770-81c5-95ae649eb874",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "0126ee3b-47a3-43d2-a1b8-a2efdf91532c",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"environment": {
"kernel": "python3",
"name": "tf2-gpu.2-8.m91",
"type": "gcloud",
"uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m91"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 95783d8

Please sign in to comment.