Skip to content

Commit

Permalink
update sim traffic endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
tottenjordan committed Sep 26, 2023
1 parent 3b1d633 commit 57c2dd3
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 82 deletions.
1 change: 1 addition & 0 deletions 00-env-setup.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@
"*-checkpoint.py*\n",
"*.ipynb_checkpoints\n",
"*.ipynb_checkpoints/*\n",
".tensorboard-*\n",
"*WIP*\n",
"*ARCHIVED*\n",
"# .gcloudignore\n",
Expand Down
143 changes: 61 additions & 82 deletions 06-deploy-query-tower-monitoring.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"metadata": {},
"outputs": [],
"source": [
"CREATE_NEW_ASSETS = False # True | False\n",
"CREATE_NEW_ASSETS = False # True | False\n",
"ENABLE_XAI_MONITORING = False # True | False"
]
},
Expand Down Expand Up @@ -185,7 +185,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 22,
"id": "18bc2342-4c0b-43e0-ac8a-da94d007342e",
"metadata": {},
"outputs": [],
Expand All @@ -194,6 +194,7 @@
"import sys\n",
"import time\n",
"import numpy as np\n",
"import pickle as pkl\n",
"\n",
"os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' \n",
"\n",
Expand Down Expand Up @@ -245,7 +246,7 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 7,
"id": "42779994-fa65-4469-9d3e-e2edf691fe51",
"metadata": {},
"outputs": [
Expand All @@ -265,7 +266,7 @@
},
{
"cell_type": "code",
"execution_count": 43,
"execution_count": 8,
"id": "17b220ea-8c86-4349-9d1f-efa83a8cfd15",
"metadata": {},
"outputs": [
Expand All @@ -287,7 +288,7 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": 9,
"id": "12da6c87-988d-47a6-8b87-0644edd5a5c3",
"metadata": {},
"outputs": [
Expand All @@ -297,7 +298,7 @@
"text": [
"display_name : query_model_tfrs_128dim_v1\n",
"\n",
"uploaded_query_model : <google.cloud.aiplatform.models.Model object at 0x7fe6bb5a2690> \n",
"uploaded_query_model : <google.cloud.aiplatform.models.Model object at 0x7f79c97eee10> \n",
"resource name: projects/934903580331/locations/us-central1/models/2404541769992634368\n"
]
}
Expand All @@ -322,7 +323,7 @@
},
{
"cell_type": "code",
"execution_count": 336,
"execution_count": 10,
"id": "b3be84c9-d6e4-4758-9848-52d80a9e9efd",
"metadata": {
"tags": []
Expand Down Expand Up @@ -350,7 +351,7 @@
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": 11,
"id": "e0af496a-7ebd-4cc9-ae1a-b29e205c15ae",
"metadata": {},
"outputs": [
Expand All @@ -360,7 +361,7 @@
"text": [
"display_name : endpoint_tfrs_128dim_v1\n",
"\n",
"endpoint : <google.cloud.aiplatform.models.Endpoint object at 0x7fe6bb38bed0> \n",
"endpoint : <google.cloud.aiplatform.models.Endpoint object at 0x7f79bb4abe90> \n",
"resource name: projects/934903580331/locations/us-central1/endpoints/7270536031831588864\n"
]
}
Expand Down Expand Up @@ -392,18 +393,18 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 15,
"id": "000fe6b3-095c-4473-971f-3e2d71e13f50",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"display_name : endpoint_tfrs_128dim_v1\n",
"display_name : query-tower-endpoint-v1\n",
"\n",
"deployed_query_model : <google.cloud.aiplatform.models.Endpoint object at 0x7fe6bb48eb10> \n",
"resource name: projects/934903580331/locations/us-central1/endpoints/7270536031831588864\n"
"deployed_query_model : <google.cloud.aiplatform.models.Endpoint object at 0x7f79c97ee310> \n",
"resource name: projects/934903580331/locations/us-central1/endpoints/7622942702673330176\n"
]
}
],
Expand All @@ -422,7 +423,7 @@
" )\n",
"\n",
"else:\n",
" deployed_query_model = vertex_ai.Endpoint('projects/934903580331/locations/us-central1/endpoints/7270536031831588864')\n",
" deployed_query_model = vertex_ai.Endpoint('projects/934903580331/locations/us-central1/endpoints/7622942702673330176')\n",
"\n",
"print(f\"display_name : {deployed_query_model.display_name}\\n\")\n",
"print(f\"deployed_query_model : {deployed_query_model}\")"
Expand All @@ -438,30 +439,10 @@
},
{
"cell_type": "code",
"execution_count": 56,
"execution_count": 16,
"id": "121573c3-a437-4856-8802-11769ecec489",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<google.cloud.aiplatform.models.Endpoint object at 0x7fe6bb1eecd0> \n",
" resource name: projects/934903580331/locations/us-central1/endpoints/7270536031831588864,\n",
" <google.cloud.aiplatform.models.Endpoint object at 0x7fe6bb205d10> \n",
" resource name: projects/934903580331/locations/us-central1/endpoints/1164499362047328256,\n",
" <google.cloud.aiplatform.models.Endpoint object at 0x7fe6bb1fc3d0> \n",
" resource name: projects/934903580331/locations/us-central1/endpoints/2398485659946844160,\n",
" <google.cloud.aiplatform.models.Endpoint object at 0x7fe6bb1d5cd0> \n",
" resource name: projects/934903580331/locations/us-central1/endpoints/9099841905474142208,\n",
" <google.cloud.aiplatform.models.Endpoint object at 0x7fe6bb199850> \n",
" resource name: projects/934903580331/locations/us-central1/endpoints/1785996110624456704]"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# list_of_model_endpoints = deployed_query_model.list()\n",
"# list_of_model_endpoints[:5]"
Expand All @@ -477,35 +458,10 @@
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": 17,
"id": "50c79c85-f933-406c-825b-cec39777af39",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[id: \"3605318418686803968\"\n",
" model: \"projects/934903580331/locations/us-central1/models/2404541769992634368\"\n",
" display_name: \"deployed_qmodel_tfrs_128dim_v1\"\n",
" create_time {\n",
" seconds: 1695143566\n",
" nanos: 585641000\n",
" }\n",
" dedicated_resources {\n",
" machine_spec {\n",
" machine_type: \"n1-standard-4\"\n",
" }\n",
" min_replica_count: 1\n",
" max_replica_count: 2\n",
" }\n",
" model_version_id: \"1\"]"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# list_of_model_endpoints = deployed_query_model.list_models()\n",
"# list_of_model_endpoints #[:5]"
Expand Down Expand Up @@ -1112,7 +1068,7 @@
},
{
"cell_type": "code",
"execution_count": 48,
"execution_count": 18,
"id": "19318841-f6e1-42d9-9210-148bc6b98932",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -1146,15 +1102,15 @@
},
{
"cell_type": "code",
"execution_count": 50,
"execution_count": 19,
"id": "d279b029-dd5e-428f-876a-5fa617a9fcae",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[-0.319549441, -0.736324608, -0.999139726, 0.936678231, 0.140084431, -0.413407475, 0.878894806, -0.970329106, -0.659263194, -1.60079765, 1.11298513, 0.534306586, 1.12248015, -0.79353, -0.221303761, 0.214388043, 0.851346672, -1.70991278, -0.428875, -0.796241462, -0.130663425, 0.679144442, 1.57031, -1.71820736, -0.0138283893, -0.696535349, 0.518329501, -1.51568925, -0.54820931, 0.00688769668, -1.16123128, 1.08391941, -0.113285184, 0.457706213, 0.0641227961, 0.416062444, -1.27625763, 0.214524657, -1.79184937, 0.368900865, -0.097617425, -2.05919147, -0.195343286, 0.136424914, -1.31718016, -0.237893417, 1.59560561, -0.966435671, 1.97090781, 0.787532568, -0.221562356, -0.302150905, 1.45196605, 0.0823364705, -1.3538276, 1.40799367, -1.17275703, 2.04082108, -0.43333602, 0.913677335, 0.126593262, -0.656877041, 0.239591926, 0.283293277, 0.875116467, -0.861238241, 0.537754834, 0.748203337, 0.236702815, -0.605949759, -0.857457638, -1.20023417, -1.0099895, -0.0130776241, -0.00597327948, -0.293667614, -0.201426148, 0.173060417, 1.38165593, 0.0985977352, 0.208134055, -0.716558337, 0.490972489, -0.158909678, 1.46330917, 0.303305387, 1.35440958, 0.503082812, 0.763622522, 0.78609848, -0.980907321, 1.18656552, -0.722483218, -0.131771222, 1.12935841, -0.390786767, -0.494330049, -1.45349109, -0.350742966, 0.60110724, 0.487943262, 0.336191267, -0.978412747, -0.0483992472, -0.642347634, 2.32962751, 0.705823898, -0.438072264, -0.999286592, -1.35016441, 0.641670406, 0.318202496, 1.40196693, 1.52482724, 1.30487597, 0.57906872, -1.29293466, 0.380096912, -0.184833914, -2.22611952, -0.370139569, -0.29136616, 0.132395029, -1.49185872, 0.849699259, 1.29289389, 1.93756354, -0.0493374951]\n"
"[-1.19653273, -0.334559262, 0.0810001567, 0.493252, -0.160756573, 1.31879628, -1.39625704, 0.58631593, 0.817179263, 0.112577811, -2.640836, 1.14207935, 1.19983459, 0.237981498, 0.263604015, -0.570031762, -0.00874393526, -0.97826761, -0.774345636, -0.487044483, -0.461612493, 0.646577716, 1.2363373, -0.208847284, 0.0831734315, -1.67527008, 1.90116453, 0.482158244, 0.815588176, -0.17341572, -0.961700797, -0.64995718, -0.714651644, 0.491276503, -1.60751081, -0.169386595, 0.859483838, 1.11577523, 0.0723268613, 1.66885364, -1.38753307, 0.0597520955, 1.12370121, -0.538888931, -0.14825964, -0.371995538, 0.996796489, 0.496251285, -2.74364448, 1.41605437, -0.692977905, -0.379781693, -1.47451448, -0.77251333, 0.502322853, 1.52816653, 0.738132596, 2.72255349, 0.559346855, -2.50046325, -0.88221395, -0.242334023, 1.6774596, -0.668324947, -0.696153104, -0.243123859, 1.15069735, 2.32172489, 0.475567073, -0.996623933, -1.63570368, 0.556305885, 0.0126396995, 0.749343514, 1.10898, 0.614645839, -0.21073547, 0.54395479, 0.202814668, 0.0523695126, -0.88011992, 0.00579532702, -0.229624048, -0.338394374, 0.43990916, 0.779108524, -0.682462573, 0.345542669, 0.958746374, -0.698016644, -1.35358107, 1.22808468, -1.23964667, -1.09018505, -1.11755335, 0.340544254, 1.93542278, 2.13677955, -0.536869109, 0.773239, -0.806171179, 1.07895923, -0.847685277, 0.397387683, -0.1660593, 1.22591412, 0.00258986093, -0.0916697234, -2.24293494, 1.27113521, -0.491369426, -0.782439351, 0.470075876, -1.46270025, -0.512221158, -0.374952614, 0.239989579, 0.952725172, -1.56143165, 1.58141768, -1.20620728, -0.373179853, -0.207473084, -1.76514602, 1.1276499, -0.0149420993, 0.382134199, 0.0106226364]\n"
]
}
],
Expand All @@ -1179,7 +1135,7 @@
},
{
"cell_type": "code",
"execution_count": 91,
"execution_count": 32,
"id": "9b63e4dc-5796-4692-8654-366a1d3e962f",
"metadata": {},
"outputs": [
Expand All @@ -1203,7 +1159,7 @@
},
{
"cell_type": "code",
"execution_count": 92,
"execution_count": 33,
"id": "9e69b724-110e-47f4-a161-3ffeac3d6820",
"metadata": {
"tags": []
Expand All @@ -1223,7 +1179,7 @@
},
{
"cell_type": "code",
"execution_count": 93,
"execution_count": 34,
"id": "e3337331-5dda-459b-a788-78ea5632dc94",
"metadata": {
"tags": []
Expand All @@ -1235,7 +1191,7 @@
"2600"
]
},
"execution_count": 93,
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -1432,23 +1388,31 @@
},
{
"cell_type": "code",
"execution_count": 95,
"id": "230b7816-94ba-432f-a54d-d246d5315bdb",
"execution_count": 35,
"id": "7a59f282-7b36-4741-b3a4-7aa08441a209",
"metadata": {},
"outputs": [],
"source": [
"import pickle as pkl\n",
"\n",
"LOCAL_INSTANCE_FILE = 'test_instance_list.pkl'\n",
"\n",
"LOCAL_INSTANCE_FILE = 'test_instance_list.pkl'"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "230b7816-94ba-432f-a54d-d246d5315bdb",
"metadata": {},
"outputs": [],
"source": [
"filehandler = open(LOCAL_INSTANCE_FILE, 'wb')\n",
"pkl.dump(list_of_dicts, filehandler)\n",
"filehandler.close()"
]
},
{
"cell_type": "code",
"execution_count": 96,
"execution_count": 37,
"id": "1d65169c-a9ae-4537-b6ee-38c4cdddc568",
"metadata": {},
"outputs": [],
Expand All @@ -1460,7 +1424,7 @@
},
{
"cell_type": "code",
"execution_count": 99,
"execution_count": 38,
"id": "3a54b6c2-2a68-4e7e-b4fc-5bef6903c871",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -1500,7 +1464,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 39,
"id": "703c3579-dcc0-4884-9370-cadbada868f8",
"metadata": {},
"outputs": [],
Expand All @@ -1511,10 +1475,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 40,
"id": "08ee60e2-6574-4835-a197-0718574d3e92",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"mean_durations : 16084755.0\n",
"std_durations : 15129075.0\n",
"mean_num_songs : 68.29652404785156\n",
"std_num_songs : 63.434242248535156\n",
"mean_num_artists : 32.46001052856445\n",
"std_num_artists : 27.37798309326172\n",
"mean_num_albums : 42.67263412475586\n",
"std_num_albums : 35.765804290771484\n"
]
}
],
"source": [
"if GENERATE_NEW_STATS:\n",
" \n",
Expand Down Expand Up @@ -1585,7 +1564,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 41,
"id": "7cf6da2a-f183-4e4e-83d8-193fff2b3d31",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -1633,7 +1612,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 44,
"id": "b9d5326c-fc06-49cc-a7f9-546f878a4f72",
"metadata": {},
"outputs": [],
Expand All @@ -1643,7 +1622,7 @@
" instances=LIST_OF_INSTANCES,\n",
" skew_feat_stat=SKEW_FEATURES,\n",
" start=2, \n",
" end=6\n",
" end=8\n",
")"
]
},
Expand Down

0 comments on commit 57c2dd3

Please sign in to comment.