{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Serve a TensorFlow lite model" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "ename": "ValueError", "evalue": "Cannot set tensor: Got tensor of type FLOAT32 but expected type UINT8 for input 88, name: input ", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0minput_shape\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0minput_details\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'shape'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0minput_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrandom\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrandom_sample\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_shape\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfloat32\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 18\u001b[0;31m \u001b[0minterpreter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_tensor\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_details\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'index'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 19\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0minterpreter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minvoke\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/envs/python3/lib/python3.6/site-packages/tensorflow_core/lite/python/interpreter.py\u001b[0m in \u001b[0;36mset_tensor\u001b[0;34m(self, tensor_index, value)\u001b[0m\n\u001b[1;32m 344\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mIf\u001b[0m \u001b[0mthe\u001b[0m \u001b[0minterpreter\u001b[0m \u001b[0mcould\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mset\u001b[0m \u001b[0mthe\u001b[0m \u001b[0mtensor\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 345\u001b[0m \"\"\"\n\u001b[0;32m--> 346\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_interpreter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSetTensor\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtensor_index\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 347\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 348\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mresize_tensor_input\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput_index\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtensor_size\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/envs/python3/lib/python3.6/site-packages/tensorflow_core/lite/python/interpreter_wrapper/tensorflow_wrap_interpreter_wrapper.py\u001b[0m in \u001b[0;36mSetTensor\u001b[0;34m(self, i, value)\u001b[0m\n\u001b[1;32m 134\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 135\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mSetTensor\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 136\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0m_tensorflow_wrap_interpreter_wrapper\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mInterpreterWrapper_SetTensor\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 137\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 138\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mGetTensor\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mValueError\u001b[0m: Cannot set tensor: Got tensor of type FLOAT32 but expected type UINT8 for input 88, name: input " ] } ], "source": [ "import tensorflow\n", "import tensorflow_hub as hub\n", "\n", "import numpy as np\n", "import tensorflow as tf\n", "\n", "# Load TFLite model and allocate tensors.\n", "interpreter = tf.lite.Interpreter(model_path=\"mobilenet_v1_1.0_224_quant.tflite\")\n", "interpreter.allocate_tensors()\n", "\n", "# Get input and output tensors.\n", "input_details = interpreter.get_input_details()\n", "output_details = interpreter.get_output_details()\n", "\n", "# Test model on random input data.\n", "input_shape = input_details[0]['shape']\n", "input_data = np.array(np.random.random_sample(input_shape), dtype=np.float32)\n", "interpreter.set_tensor(input_details[0]['index'], input_data)\n", "\n", "interpreter.invoke()\n", "\n", "# The function `get_tensor()` returns a copy of the tensor data.\n", "# Use `tensor()` in order to get a pointer to the tensor.\n", "output_data = interpreter.get_tensor(output_details[0]['index'])\n", "print(output_data)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "tf.Tensor(\n", "[[-3.13301645e-02 -6.33863360e-02 -1.60749946e-02 -1.03489561e-02\n", " -4.65009995e-02 3.72315571e-02 5.91584947e-03 7.17439875e-02\n", " 1.66644827e-02 6.09076358e-02 6.65525720e-02 2.37051025e-02\n", " 5.76475868e-04 5.68432137e-02 2.41616759e-02 -5.33628371e-03\n", " 4.70477156e-02 1.92157198e-02 7.68255442e-02 5.66959940e-03\n", " -7.52822161e-02 -1.71372388e-02 -7.50271082e-02 7.63734803e-02\n", " -5.43796048e-02 -1.38910150e-03 -1.83018427e-02 -4.67203930e-02\n", " -4.72413860e-02 2.70678177e-02 3.23334038e-02 5.53706214e-02\n", " 3.37095372e-02 -1.37066245e-02 5.52706001e-03 -8.22692588e-02\n", " 1.41951097e-02 6.82791322e-02 1.83205083e-02 -2.14787442e-02\n", " 4.14966866e-02 -2.02740021e-02 -6.01055054e-03 2.44824495e-02\n", " -8.84009004e-02 -2.56653987e-02 -3.83261517e-02 -5.61062619e-02\n", " 4.68128063e-02 3.20312604e-02 7.72727579e-02 -8.25007185e-02\n", " 5.45060262e-03 5.79300802e-03 -3.86942066e-02 2.90922675e-04\n", " 6.13495857e-02 7.35033751e-02 5.46342283e-02 -8.05496648e-02\n", " 5.35428897e-02 3.44783720e-03 -7.85728171e-02 5.34521826e-02\n", " 8.73037353e-02 1.23112544e-03 -8.20093509e-03 1.44535163e-02\n", " 6.14188276e-02 -4.28334698e-02 2.92080287e-02 -4.68553007e-02\n", " -2.70758886e-02 7.40266815e-02 6.70765564e-02 1.87661052e-02\n", " -3.86825278e-02 -2.34875605e-02 -4.38267514e-02 6.27523586e-02\n", " -1.73126515e-02 4.98919412e-02 1.09579805e-02 -8.15963894e-02\n", " 2.38989927e-02 -6.54082522e-02 -2.58479826e-02 -5.22258542e-02\n", " -4.84863818e-02 4.31569628e-02 6.72898963e-02 2.31305696e-02\n", " 5.20541817e-02 -5.21256477e-02 6.36779051e-03 7.44135752e-02\n", " -7.95416534e-02 -2.00179648e-02 2.47181393e-02 -4.37121578e-02\n", " 2.08969377e-02 1.19799329e-02 -3.45776565e-02 -6.13230048e-03\n", " 4.65956219e-02 -4.34438474e-02 6.17472902e-02 -5.21821529e-03\n", " -4.79349457e-02 5.06721959e-02 -9.20500886e-03 4.71058376e-02\n", " -5.66148125e-02 4.51188423e-02 -5.57957441e-02 -9.08904150e-03\n", " -6.79878592e-02 -1.88620128e-02 5.88840358e-02 -8.36783424e-02\n", " 1.95173789e-02 6.67160824e-02 7.82750025e-02 -3.69588993e-02\n", " -1.96004361e-02 -6.95250407e-02 -3.49981636e-02 1.13692125e-02\n", " -4.19136547e-02 -6.92959428e-02 -5.11442646e-02 4.75727171e-02\n", " 1.38094118e-02 -3.58937383e-02 -4.53339852e-02 4.90999296e-02\n", " 7.65214348e-03 4.42539006e-02 -3.17132771e-02 5.78769036e-02\n", " -1.63773578e-02 -3.37255970e-02 6.44775853e-02 6.61125854e-02\n", " -3.70152555e-02 -5.42326085e-02 4.24833894e-02 8.84425547e-03\n", " -2.08036415e-02 1.64996143e-02 -2.55472548e-02 -3.84371094e-02\n", " -3.20672393e-02 8.24253932e-02 4.62947264e-02 -5.70620038e-02\n", " -3.84052172e-02 -7.29329512e-02 -7.19060898e-02 -1.02489088e-02\n", " -7.31536224e-02 -6.16597496e-02 -2.76509672e-02 4.88674119e-02\n", " -1.52220130e-02 7.06749186e-02 -2.95240544e-02 -5.26605640e-03\n", " -4.11287230e-03 7.20385164e-02 1.20935263e-02 5.28789312e-02\n", " -1.22481892e-02 2.54231934e-02 -5.43016158e-02 3.50195915e-02\n", " 2.48567313e-02 -1.93587895e-02 -2.10639182e-02 -5.86417504e-02\n", " 3.65971029e-02 1.72752626e-02 -3.79895382e-02 6.68370724e-02\n", " 8.46686512e-02 -6.39075264e-02 3.17608118e-02 -2.77337767e-02\n", " 1.05815483e-02 1.42895002e-02 1.85914394e-02 6.69751316e-02\n", " -8.13821534e-05 -6.62900135e-02 3.96365952e-03 2.08039675e-02\n", " -6.34737452e-03 2.14386713e-02 4.14965115e-02 -2.86411680e-02\n", " -6.65885955e-02 4.13037688e-02 -3.84432008e-03 2.05361601e-02\n", " -3.12528536e-02 4.50379848e-02 -5.17904311e-02 8.36497173e-02\n", " -3.80006395e-02 5.33687733e-02 -1.64968893e-02 3.80555205e-02\n", " -4.72438298e-02 -1.34932995e-02 -1.41179375e-02 3.19528463e-03\n", " 3.63842696e-02 -6.77829899e-04 -4.21210565e-02 4.38499749e-02\n", " 9.30380728e-03 1.15923630e-02 2.54048295e-02 2.78169755e-02\n", " -7.77126327e-02 -3.68639939e-02 3.35772638e-03 -5.78949861e-02\n", " 5.50084598e-02 -3.28178704e-02 5.17519750e-02 -7.88210183e-02\n", " 3.57907377e-02 -3.47562227e-03 3.01846699e-03 -1.44698527e-02\n", " -9.58367344e-03 -2.59675886e-02 4.63937689e-03 -4.87497495e-03\n", " 1.93122271e-02 -3.58890556e-02 1.77989863e-02 -4.85916436e-02\n", " 8.71910676e-02 -2.15161722e-02 5.90394763e-03 7.92559013e-02\n", " 1.41315078e-02 3.87712903e-02 7.65481126e-03 -3.60453390e-02\n", " 4.37388476e-03 1.51604051e-02 5.62450150e-03 -8.52851272e-02\n", " -2.61311326e-02 -5.81582710e-02 -5.54456795e-03 6.19949074e-03\n", " -3.11981291e-02 1.08516421e-02 3.74276601e-02 6.74831569e-02\n", " -1.57226138e-02 5.10395616e-02 4.34736498e-02 4.29932028e-02\n", " -5.33096716e-02 3.09144370e-02 -8.02334771e-02 5.15466444e-02\n", " 4.61746901e-02 -2.43724207e-03 2.65198145e-02 -5.22638336e-02\n", " 6.04240969e-02 -4.47861291e-02 -1.26276072e-02 1.14327297e-02\n", " 1.73428524e-02 3.39712687e-02 -5.34942653e-03 -4.86748107e-02\n", " -6.17273478e-03 -4.18533459e-02 5.36488602e-03 8.42037499e-02\n", " -2.71706283e-02 -3.35896611e-02 -5.78816682e-02 -4.87505570e-02\n", " 7.26495385e-02 3.50276530e-02 -2.56651957e-02 -6.70652613e-02\n", " -2.07644477e-02 -6.70070276e-02 -8.66074115e-02 3.25111225e-02\n", " 3.14202905e-03 -2.87721474e-02 -2.15108786e-02 2.74478924e-02\n", " -6.87164664e-02 -7.64934048e-02 2.34854985e-02 -6.36558682e-02\n", " 1.87310986e-02 4.04215157e-02 -1.19592203e-02 1.77535787e-02\n", " 1.31974341e-02 -9.16593615e-03 6.04362823e-02 -1.44064482e-02\n", " 3.47853415e-02 3.38571519e-02 -3.98615599e-02 8.97265039e-03\n", " -6.45776698e-03 -2.56911665e-02 6.59708083e-02 -1.37568964e-02\n", " 4.02431190e-02 -6.13798499e-02 5.70648499e-02 5.49096540e-02\n", " 8.05772562e-03 2.29710191e-02 -1.08025866e-02 -2.89227292e-02\n", " -1.05494009e-02 -4.09307852e-02 7.02908412e-02 1.64377615e-02\n", " -3.89027186e-02 6.80670813e-02 1.46287158e-02 6.33633807e-02\n", " -3.27639431e-02 1.97251514e-02 -2.29335427e-02 -2.17504483e-02\n", " -1.81018524e-02 5.36712408e-02 3.20828222e-02 3.57352272e-02\n", " 3.85185517e-02 1.22873709e-02 -5.02095819e-02 1.23217516e-02\n", " 7.44705796e-02 -3.69071364e-02 3.25549096e-02 3.76807377e-02\n", " -8.43520686e-02 3.29607911e-03 4.39674370e-02 -1.29077565e-02\n", " 4.00089175e-02 -1.41499992e-02 1.79536305e-02 -2.68085133e-02\n", " -1.84716005e-02 4.16087620e-02 2.01059151e-02 4.86185849e-02\n", " -1.37069048e-02 -5.26558757e-02 -8.33578184e-02 3.30089889e-02\n", " 1.46462442e-02 3.60581577e-02 2.42502410e-02 -2.35559139e-02\n", " -3.56079899e-02 -1.25541165e-03 -6.96230903e-02 -5.29469773e-02\n", " 8.02406818e-02 -5.25651611e-02 4.11139354e-02 4.41374108e-02\n", " 2.88852267e-02 7.02109467e-03 -5.93215749e-02 2.48978671e-04\n", " 3.97137851e-02 4.63661999e-02 4.38603200e-03 -5.88026308e-02\n", " -6.34619966e-02 2.12462083e-03 3.09538562e-02 -6.52166978e-02\n", " -3.43779549e-02 -8.33043307e-02 -5.30393906e-02 -1.98524054e-02\n", " 5.12011200e-02 2.00837068e-02 1.37549676e-02 3.28655168e-02\n", " -1.34206004e-03 -2.25029793e-02 -2.97671687e-02 -2.63523497e-02\n", " 1.71083845e-02 1.60456803e-02 -2.53799953e-03 6.89256489e-02\n", " 5.61695658e-02 -1.92123801e-02 4.10799682e-02 -6.30269274e-02\n", " -4.09668684e-02 -1.67022576e-03 1.68590229e-02 -4.80919071e-02\n", " -3.55237722e-02 4.06544395e-02 -6.65626600e-02 -6.40559644e-02\n", " 9.22950357e-03 8.04488882e-02 3.71556240e-03 -2.32309457e-02\n", " -2.08565686e-02 4.04575057e-02 1.60849765e-02 -6.14605844e-02\n", " -3.13462354e-02 5.90515397e-02 -9.26037040e-03 3.80131751e-02\n", " 3.00444718e-02 6.72333241e-02 -4.14813384e-02 -6.92562312e-02\n", " -1.30925339e-03 -5.08814119e-02 -2.47172937e-02 -1.94040686e-02\n", " 5.97840138e-02 -5.04643545e-02 6.34735972e-02 -5.50590456e-02\n", " -4.67547551e-02 3.23520899e-02 -4.68073227e-02 1.59298144e-02\n", " -2.69725043e-02 -8.69766250e-02 6.32599136e-03 -5.54120988e-02\n", " 4.12455909e-02 4.83802557e-02 2.65815351e-02 3.62915583e-02\n", " -2.16245241e-02 -3.54820932e-03 -3.27411331e-02 -2.30929465e-03\n", " -3.96014452e-02 -1.38966190e-02 2.98647135e-02 2.28335932e-02\n", " 7.58050010e-02 5.11650108e-02 1.59735307e-02 -3.30084376e-03\n", " 8.86857286e-02 -4.29574363e-02 -6.25700280e-02 7.07593337e-02\n", " -1.10051688e-02 -8.50277767e-03 7.52350911e-02 -5.34759164e-02\n", " -7.44972229e-02 4.90328297e-02 -5.80680892e-02 5.80848381e-02\n", " -5.06133437e-02 1.94768626e-02 -6.68443665e-02 -3.70255113e-02\n", " -3.69391441e-02 -3.46592702e-02 -6.94742277e-02 4.04122937e-03\n", " -8.31850804e-03 -1.70822609e-02 -4.69766296e-02 4.08090577e-02\n", " 4.46462305e-03 -4.80488390e-02 -7.96829313e-02 7.77665749e-02\n", " 1.00038489e-02 -3.96856964e-02 -1.95958558e-02 5.73430322e-02\n", " 5.59322275e-02 1.71267316e-02 7.34722018e-02 -7.85523579e-02\n", " 6.48888871e-02 -3.24277915e-02 -4.57573757e-02 5.37045449e-02]], shape=(1, 512), dtype=float32)\n" ] } ], "source": [ "embeddings = embed([inputs])\n", "print(embeddings)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Step 1 : Write a model transform script\n", "\n", "#### Make sure you have a ...\n", "\n", "- \"load_model\" function\n", " - input args are model path\n", " - returns loaded model object\n", " - model name is the same as what you saved the model file as (see above step)\n", "

\n", "- \"predict\" function\n", " - input args are the loaded model object and a payload\n", " - returns the result of model.predict\n", " - make sure you format it as a single (or multiple) string return inside a list for real time (for mini batch)\n", " - from a client, a list or string or np.array that is sent for prediction is interpreted as bytes. Do what you have to for converting back to list or string or np.array\n", " - return the error for debugging\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Writing modelscript_tensorflow.py\n" ] } ], "source": [ "%%writefile modelscript_tensorflow.py\n", "import tensorflow as tf\n", "import numpy as np\n", "import tensorflow_hub as hub\n", "import json\n", "\n", "#Return loaded model\n", "def load_model(modelpath):\n", " model = hub.load(\"https://tfhub.dev/google/universal-sentence-encoder/4\") \n", " return model\n", "\n", "# return prediction based on loaded model (from the step above) and an input payload\n", "def predict(model, payload):\n", " try:\n", " if(type(payload) == str):\n", " data = [payload]\n", " else:\n", " data = [payload.decode()]# For Multi model endpoints -> [payload[0]['body'].decode()]\n", " \n", " out = np.asarray(model(data)).tolist()\n", " except Exception as e:\n", " out = str(e)\n", " return [json.dumps({'output':[out],'tfeager': tf.executing_eagerly()})]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Does this work locally? (not \"_in a container locally_\", but _actually_ in local)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "from modelscript_tensorflow import *\n", "model = load_model('./') # path doesn't matter here since we're loading the model directly in the script" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['{\"output\": [[[-0.0313301682472229, -0.06338633596897125, -0.016074996441602707, -0.010348955169320107, -0.04650101065635681, 0.03723156452178955, 0.005915849469602108, 0.07174398750066757, 0.01666448265314102, 0.06090763583779335, 0.06655257940292358, 0.023705095052719116, 0.0005764864035882056, 0.05684320256114006, 0.024161681532859802, -0.005336277186870575, 0.04704771563410759, 0.019215719774365425, 0.07682554423809052, 0.0056695942766964436, -0.07528221607208252, -0.01713723875582218, -0.07502710819244385, 0.07637347280979156, -0.05437960475683212, -0.0013891014968976378, -0.018301840871572495, -0.04672039672732353, -0.04724138602614403, 0.027067814022302628, 0.03233340382575989, 0.055370621383190155, 0.033709533512592316, -0.013706627301871777, 0.005527065135538578, -0.08226925879716873, 0.014195104129612446, 0.06827913224697113, 0.01832052320241928, -0.021478744223713875, 0.041496675461530685, -0.020274000242352486, -0.006010554730892181, 0.024482453241944313, -0.08840090036392212, -0.025665394961833954, -0.03832615166902542, -0.056106261909008026, 0.04681280627846718, 0.032031260430812836, 0.07727275788784027, -0.08250071853399277, 0.0054506054148077965, 0.005793008022010326, -0.03869419917464256, 0.00029091740725561976, 0.061349593102931976, 0.07350337505340576, 0.054634228348731995, -0.08054967224597931, 0.053542882204055786, 0.003447842551395297, -0.07857280969619751, 0.053452182561159134, 0.08730373531579971, 0.001231127418577671, -0.008200937882065773, 0.014453508891165257, 0.06141882762312889, -0.042833469808101654, 0.029208028689026833, -0.04685530066490173, -0.027075886726379395, 0.0740266814827919, 0.06707655638456345, 0.018766095861792564, -0.03868252784013748, -0.02348756417632103, -0.04382675141096115, 0.06275235861539841, -0.01731264963746071, 0.04989193379878998, 0.010957982391119003, -0.08159638941287994, 0.023898988962173462, -0.06540823727846146, -0.025847988203167915, -0.052225854247808456, -0.0484863743185997, 0.04315696656703949, 0.06728990375995636, 0.023130569607019424, 0.052054181694984436, -0.052125636488199234, 0.006367790512740612, 0.07441357523202896, -0.0795416459441185, -0.0200179610401392, 0.024718139320611954, -0.043712154030799866, 0.020896941423416138, 0.011979934759438038, -0.034577660262584686, -0.0061323028057813644, 0.04659562185406685, -0.04344384744763374, 0.061747290194034576, -0.00521821528673172, -0.04793495684862137, 0.050672195851802826, -0.009205011650919914, 0.04710583761334419, -0.05661482363939285, 0.04511884227395058, -0.05579574406147003, -0.009089037775993347, -0.06798786669969559, -0.018862012773752213, 0.05888403579592705, -0.08367834240198135, 0.019517384469509125, 0.06671607494354248, 0.07827500253915787, -0.03695889934897423, -0.01960042677819729, -0.06952504068613052, -0.03499816730618477, 0.011369218118488789, -0.041913654655218124, -0.06929594278335571, -0.05114426463842392, 0.04757271707057953, 0.013809415511786938, -0.035893745720386505, -0.04533398523926735, 0.04909992963075638, 0.00765214441344142, 0.04425390064716339, -0.031713277101516724, 0.05787690356373787, -0.01637735590338707, -0.033725593239068985, 0.0644775778055191, 0.06611258536577225, -0.03701524809002876, -0.05423259735107422, 0.042483389377593994, 0.00884424801915884, -0.02080364152789116, 0.016499614343047142, -0.025547251105308533, -0.03843710198998451, -0.03206724300980568, 0.08242539316415787, 0.046294745057821274, -0.05706200748682022, -0.03840521723031998, -0.07293294370174408, -0.07190608978271484, -0.010248919948935509, -0.07315362989902496, -0.06165974959731102, -0.027650967240333557, 0.04886741191148758, -0.015222018584609032, 0.07067491859197617, -0.029524054378271103, -0.0052660563960671425, -0.004112876486033201, 0.07203851640224457, 0.012093531899154186, 0.05287892743945122, -0.012248187325894833, 0.025423185899853706, -0.05430162325501442, 0.035019587725400925, 0.024856725707650185, -0.019358795136213303, -0.021063916385173798, -0.05864175036549568, 0.036597102880477905, 0.017275260761380196, -0.0379895344376564, 0.06683705747127533, 0.08466865122318268, -0.06390751898288727, 0.0317608118057251, -0.027733782306313515, 0.010581542737782001, 0.014289495535194874, 0.018591446802020073, 0.06697513163089752, -8.138347038766369e-05, -0.06629001349210739, 0.003963664639741182, 0.020803963765501976, -0.006347373127937317, 0.021438665688037872, 0.04149651154875755, -0.028641166165471077, -0.06658858805894852, 0.041303761303424835, -0.0038443359080702066, 0.020536160096526146, -0.03125285729765892, 0.04503798484802246, -0.05179043114185333, 0.08364971727132797, -0.03800063207745552, 0.05336877331137657, -0.016496894881129265, 0.03805552050471306, -0.04724382981657982, -0.013493301346898079, -0.014117940329015255, 0.0031952871941030025, 0.036384277045726776, -0.0006778272800147533, -0.04212105646729469, 0.04384997859597206, 0.009303807280957699, 0.011592370457947254, 0.025404835119843483, 0.027816975489258766, -0.07771263271570206, -0.036863990128040314, 0.0033577263820916414, -0.0578949861228466, 0.05500845983624458, -0.03281787782907486, 0.05175197497010231, -0.07882101833820343, 0.03579074144363403, -0.0034756141249090433, 0.0030184669885784388, -0.014469851739704609, -0.009583679027855396, -0.025967592373490334, 0.004639379680156708, -0.004874974489212036, 0.01931222900748253, -0.03588905930519104, 0.017798984423279762, -0.04859164357185364, 0.08719106763601303, -0.021516170352697372, 0.005903955549001694, 0.07925590127706528, 0.014131511561572552, 0.038771290332078934, 0.007654822897166014, -0.03604533150792122, 0.004373879637569189, 0.015160406939685345, 0.005624501500278711, -0.08528512716293335, -0.02613113261759281, -0.0581582710146904, -0.00554456003010273, 0.006199486553668976, -0.031198125332593918, 0.010851642116904259, 0.03742766007781029, 0.06748315691947937, -0.015722621232271194, 0.05103956162929535, 0.04347364604473114, 0.042993202805519104, -0.05330967158079147, 0.030914437025785446, -0.08023347705602646, 0.051546644419431686, 0.04617468640208244, -0.0024372313637286425, 0.026519812643527985, -0.052263833582401276, 0.06042409688234329, -0.044786129146814346, -0.0126276183873415, 0.011432732455432415, 0.017342854291200638, 0.03397126868367195, -0.005349428858608007, -0.048674821853637695, -0.006172739434987307, -0.041853342205286026, 0.00536488089710474, 0.08420374989509583, -0.027170628309249878, -0.03358965367078781, -0.0578816682100296, -0.048750560730695724, 0.07264953851699829, 0.035027652978897095, -0.025665195658802986, -0.06706525385379791, -0.02076444961130619, -0.06700702756643295, -0.08660741150379181, 0.03251112252473831, 0.0031420192681252956, -0.028772158548235893, -0.021510878577828407, 0.0274478942155838, -0.06871646642684937, -0.07649340480566025, 0.02348550222814083, -0.06365586817264557, 0.018731094896793365, 0.040421511977910995, -0.011959213763475418, 0.01775357685983181, 0.013197427615523338, -0.009165938943624496, 0.06043628230690956, -0.01440644171088934, 0.03478533774614334, 0.03385715186595917, -0.03986155241727829, 0.008972647599875927, -0.006457769311964512, -0.025691166520118713, 0.06597080826759338, -0.013756894506514072, 0.04024311900138855, -0.061379849910736084, 0.05706484988331795, 0.05490965396165848, 0.008057708851993084, 0.0229710191488266, -0.010802586562931538, -0.02892272174358368, -0.010549390688538551, -0.04093078151345253, 0.07029084116220474, 0.01643776334822178, -0.03890271857380867, 0.06806708127260208, 0.014628713019192219, 0.06336338073015213, -0.03276394307613373, 0.019725145772099495, -0.022933535277843475, -0.021750446408987045, -0.01810184121131897, 0.05367124080657959, 0.032082825899124146, 0.035735227167606354, 0.03851856663823128, 0.01228737086057663, -0.05020958185195923, 0.01232176460325718, 0.07447057962417603, -0.0369071364402771, 0.03255491331219673, 0.0376807376742363, -0.08435206860303879, 0.0032960816752165556, 0.04396742954850197, -0.012907756492495537, 0.04000891372561455, -0.014149999246001244, 0.01795363985002041, -0.026808518916368484, -0.018471598625183105, 0.04160876199603081, 0.020105911418795586, 0.048618584871292114, -0.013706902042031288, -0.05265587568283081, -0.08335781842470169, 0.033008988946676254, 0.014646245166659355, 0.03605815768241882, 0.02425023727118969, -0.023555906489491463, -0.03560798615217209, -0.0012554168934002519, -0.06962309777736664, -0.05294697731733322, 0.08024068176746368, -0.052565161138772964, 0.04111392796039581, 0.04413742199540138, 0.02888522483408451, 0.00702109606936574, -0.0593215636909008, 0.0002489773614797741, 0.039713792502880096, 0.04636619985103607, 0.004386032000184059, -0.05880263075232506, -0.06346199661493301, 0.0021246366668492556, 0.030953863635659218, -0.06521669775247574, -0.03437794744968414, -0.08330433070659637, -0.053039390593767166, -0.019852405413985252, 0.05120110884308815, 0.020083695650100708, 0.013754967600107193, 0.03286551311612129, -0.0013420653995126486, -0.022502988576889038, -0.02976716309785843, -0.026352345943450928, 0.017108382657170296, 0.01604568026959896, -0.0025380002334713936, 0.0689256489276886, 0.056169576942920685, -0.019212380051612854, 0.041079968214035034, -0.06302692741155624, -0.04096687212586403, -0.0016702257562428713, 0.016859019175171852, -0.04809190705418587, -0.03552377596497536, 0.040654439479112625, -0.06656266003847122, -0.06405594944953918, 0.009229504503309727, 0.08044888824224472, 0.003715564962476492, -0.023230956867337227, -0.02085656113922596, 0.040457502007484436, 0.016084983944892883, -0.06146058440208435, -0.03134623542428017, 0.05905153974890709, -0.00926036573946476, 0.03801318258047104, 0.03004448115825653, 0.06723333150148392, -0.04148133844137192, -0.06925623118877411, -0.0013092507142573595, -0.050881411880254745, -0.024717293679714203, -0.019404076039791107, 0.05978401377797127, -0.05046434700489044, 0.06347359716892242, -0.0550590455532074, -0.046754755079746246, 0.032352086156606674, -0.04680732265114784, 0.015929818153381348, -0.026972513645887375, -0.08697662502527237, 0.006325991824269295, -0.05541209876537323, 0.04124559089541435, 0.048380255699157715, 0.02658153511583805, 0.03629155829548836, -0.021624526008963585, -0.003548209322616458, -0.032741133123636246, -0.002309299074113369, -0.03960144519805908, -0.013896613381803036, 0.029864713549613953, 0.02283358946442604, 0.07580500096082687, 0.051165010780096054, 0.015973538160324097, -0.003300843760371208, 0.08868572860956192, -0.04295744746923447, -0.06257002800703049, 0.07075933367013931, -0.011005168780684471, -0.0085027776658535, 0.07523509114980698, -0.053475916385650635, -0.07449722290039062, 0.04903282970190048, -0.05806809663772583, 0.05808483809232712, -0.05061332881450653, 0.019476862624287605, -0.06684436649084091, -0.037025511264801025, -0.036939144134521484, -0.03465927019715309, -0.0694742277264595, 0.004041229374706745, -0.00831849966198206, -0.017082255333662033, -0.046976618468761444, 0.040809061378240585, 0.0044646295718848705, -0.04804883897304535, -0.07968293130397797, 0.07776657491922379, 0.010003844276070595, -0.0396856963634491, -0.019595857709646225, 0.05734303221106529, 0.05593222752213478, 0.01712672784924507, 0.07347219437360764, -0.07855235785245895, 0.06488889455795288, -0.03242779150605202, -0.04575737565755844, 0.05370454490184784]]], \"tfeager\": true}']" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "predict(model,inputs)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### ok great! Now let's install ezsmdeploy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "_[To Do]_: currently local; replace with pip version!" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting ezsmdeploy\n", " Using cached ezsmdeploy-0.1.5-py3-none-any.whl (22 kB)\n", "Requirement already satisfied: sagemaker>=1.55.3 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from ezsmdeploy) (1.55.4)\n", "Requirement already satisfied: locustio==0.14.5 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from ezsmdeploy) (0.14.5)\n", "Requirement already satisfied: yaspin==0.16.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from ezsmdeploy) (0.16.0)\n", "Requirement already satisfied: shortuuid==1.0.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from ezsmdeploy) (1.0.1)\n", "Requirement already satisfied: boto3>=1.10.44 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from sagemaker>=1.55.3->ezsmdeploy) (1.12.42)\n", "Requirement already satisfied: smdebug-rulesconfig==0.1.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from sagemaker>=1.55.3->ezsmdeploy) (0.1.2)\n", "Requirement already satisfied: protobuf3-to-dict>=0.1.5 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from sagemaker>=1.55.3->ezsmdeploy) (0.1.5)\n", "Requirement already satisfied: importlib-metadata>=1.4.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from sagemaker>=1.55.3->ezsmdeploy) (1.5.0)\n", "Requirement already satisfied: numpy>=1.9.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from sagemaker>=1.55.3->ezsmdeploy) (1.18.2)\n", "Requirement already satisfied: scipy>=0.19.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from sagemaker>=1.55.3->ezsmdeploy) (1.4.1)\n", "Requirement already satisfied: protobuf>=3.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from sagemaker>=1.55.3->ezsmdeploy) (3.11.3)\n", "Requirement already satisfied: packaging>=20.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from sagemaker>=1.55.3->ezsmdeploy) (20.1)\n", "Requirement already satisfied: msgpack>=0.6.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from locustio==0.14.5->ezsmdeploy) (1.0.0)\n", "Requirement already satisfied: requests>=2.9.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from locustio==0.14.5->ezsmdeploy) (2.23.0)\n", "Requirement already satisfied: gevent==1.5a3 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from locustio==0.14.5->ezsmdeploy) (1.5a3)\n", "Requirement already satisfied: ConfigArgParse>=1.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from locustio==0.14.5->ezsmdeploy) (1.2.1)\n", "Requirement already satisfied: psutil>=5.6.7 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from locustio==0.14.5->ezsmdeploy) (5.7.0)\n", "Requirement already satisfied: geventhttpclient-wheels==1.3.1.dev2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from locustio==0.14.5->ezsmdeploy) (1.3.1.dev2)\n", "Requirement already satisfied: flask>=0.10.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from locustio==0.14.5->ezsmdeploy) (1.0.2)\n", "Requirement already satisfied: pyzmq>=16.0.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from locustio==0.14.5->ezsmdeploy) (19.0.0)\n", "Requirement already satisfied: botocore<1.16.0,>=1.15.42 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from boto3>=1.10.44->sagemaker>=1.55.3->ezsmdeploy) (1.15.42)\n", "Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from boto3>=1.10.44->sagemaker>=1.55.3->ezsmdeploy) (0.9.4)\n", "Requirement already satisfied: s3transfer<0.4.0,>=0.3.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from boto3>=1.10.44->sagemaker>=1.55.3->ezsmdeploy) (0.3.3)\n", "Requirement already satisfied: six in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from protobuf3-to-dict>=0.1.5->sagemaker>=1.55.3->ezsmdeploy) (1.14.0)\n", "Requirement already satisfied: zipp>=0.5 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from importlib-metadata>=1.4.0->sagemaker>=1.55.3->ezsmdeploy) (3.0.0)\n", "Requirement already satisfied: setuptools in /home/ec2-user/.local/lib/python3.6/site-packages (from protobuf>=3.1->sagemaker>=1.55.3->ezsmdeploy) (46.1.3)\n", "Requirement already satisfied: pyparsing>=2.0.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from packaging>=20.0->sagemaker>=1.55.3->ezsmdeploy) (2.2.0)\n", "Requirement already satisfied: chardet<4,>=3.0.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from requests>=2.9.1->locustio==0.14.5->ezsmdeploy) (3.0.4)\n", "Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from requests>=2.9.1->locustio==0.14.5->ezsmdeploy) (1.23)\n", "Requirement already satisfied: idna<3,>=2.5 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from requests>=2.9.1->locustio==0.14.5->ezsmdeploy) (2.6)\n", "Requirement already satisfied: certifi>=2017.4.17 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from requests>=2.9.1->locustio==0.14.5->ezsmdeploy) (2019.11.28)\n", "Requirement already satisfied: greenlet>=0.4.14; platform_python_implementation == \"CPython\" in /home/ec2-user/.local/lib/python3.6/site-packages (from gevent==1.5a3->locustio==0.14.5->ezsmdeploy) (0.4.15)\n", "Requirement already satisfied: Werkzeug>=0.14 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from flask>=0.10.1->locustio==0.14.5->ezsmdeploy) (0.14.1)\n", "Requirement already satisfied: click>=5.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from flask>=0.10.1->locustio==0.14.5->ezsmdeploy) (6.7)\n", "Requirement already satisfied: Jinja2>=2.10 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from flask>=0.10.1->locustio==0.14.5->ezsmdeploy) (2.10)\n", "Requirement already satisfied: itsdangerous>=0.24 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from flask>=0.10.1->locustio==0.14.5->ezsmdeploy) (0.24)\n", "Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from botocore<1.16.0,>=1.15.42->boto3>=1.10.44->sagemaker>=1.55.3->ezsmdeploy) (2.8.0)\n", "Requirement already satisfied: docutils<0.16,>=0.10 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from botocore<1.16.0,>=1.15.42->boto3>=1.10.44->sagemaker>=1.55.3->ezsmdeploy) (0.14)\n", "Requirement already satisfied: MarkupSafe>=0.23 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from Jinja2>=2.10->flask>=0.10.1->locustio==0.14.5->ezsmdeploy) (1.0)\n", "Installing collected packages: ezsmdeploy\n", "Successfully installed ezsmdeploy-0.1.5\n" ] } ], "source": [ "!pip install ezsmdeploy" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "import ezsmdeploy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### If you have been running other inference containers in local mode, stop existing containers to avoid conflict" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "!docker container stop $(docker container ls -aq) >/dev/null" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Deploy locally" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Large models take longer to download and deploy (check TF hub source code to check. Also, keep in mind that hub models are downloaded in each worker; TF hub will recognize that all workers are set to download the same model and will not repeat the download; it will instead give you a _already being downloaded by \"worker id\"_. Since it takes longer to deploy, initial health pings may also fail. But make sure you see a \"Deployed!\" and make predictions before proceeding. " ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[K0:00:00.003290 | No model was passed. Assuming you are downloading a model in the script or in the container\n", "\u001b[K0:00:00.108036 | uploaded model tarball(s) ; check returned modelpath\n", "\u001b[K0:00:00.108894 | added requirements file\n", "\u001b[K0:00:00.110766 | added source file\n", "\u001b[K0:00:00.112247 | added Dockerfile\n", "\u001b[K0:00:00.114261 | added model_handler and docker utils\n", "\u001b[K0:00:00.114350 | building docker container\n", "\u001b[K0:02:40.172127 | built docker container\n", "\u001b[K0:02:40.286748 | created model(s). Now deploying on local_gpu\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K" ] }, { "name": "stderr", "output_type": "stream", "text": [ "WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',)': /ping\n", "WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',)': /ping\n", "WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',)': /ping\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[32m∙∙∙\u001b[0m \u001b[KAttaching to tmpfd5boyt9_algo-1-qmeju_1\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m Starting the inference server with 32 workers.\n", "\u001b[32m∙●∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [9] [INFO] Starting gunicorn 20.0.4\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [9] [INFO] Listening at: unix:/tmp/gunicorn.sock (9)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [9] [INFO] Using worker: gevent\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [13] [INFO] Booting worker with pid: 13\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [14] [INFO] Booting worker with pid: 14\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [15] [INFO] Booting worker with pid: 15\n", "\u001b[32m∙∙●\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [16] [INFO] Booting worker with pid: 16\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [17] [INFO] Booting worker with pid: 17\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [19] [INFO] Booting worker with pid: 19\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [21] [INFO] Booting worker with pid: 21\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [53] [INFO] Booting worker with pid: 53\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [86] [INFO] Booting worker with pid: 86\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [118] [INFO] Booting worker with pid: 118\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [121] [INFO] Booting worker with pid: 121\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:07 +0000] [120] [INFO] Booting worker with pid: 120\n", "\u001b[32m●∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [186] [INFO] Booting worker with pid: 186\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [188] [INFO] Booting worker with pid: 188\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [221] [INFO] Booting worker with pid: 221\n", "\u001b[32m∙●∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [222] [INFO] Booting worker with pid: 222\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [285] [INFO] Booting worker with pid: 285\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [286] [INFO] Booting worker with pid: 286\n", "\u001b[32m∙∙●\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [287] [INFO] Booting worker with pid: 287\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [288] [INFO] Booting worker with pid: 288\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [291] [INFO] Booting worker with pid: 291\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [356] [INFO] Booting worker with pid: 356\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [408] [INFO] Booting worker with pid: 408\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [423] [INFO] Booting worker with pid: 423\n", "\u001b[32m●∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [487] [INFO] Booting worker with pid: 487\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [520] [INFO] Booting worker with pid: 520\n", "\u001b[32m∙●∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [583] [INFO] Booting worker with pid: 583\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [584] [INFO] Booting worker with pid: 584\n", "\u001b[32m∙∙●\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [587] [INFO] Booting worker with pid: 587\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [586] [INFO] Booting worker with pid: 586\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:08 +0000] [621] [INFO] Booting worker with pid: 621\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:26:09 +0000] [653] [INFO] Booting worker with pid: 653\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:27:15 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:17)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020/04/23 23:27:15 [error] 10#10: *1 upstream prematurely closed connection while reading response header from upstream, client: 172.27.0.1, server: , request: \"GET /ping HTTP/1.1\", upstream: \"http://unix:/tmp/gunicorn.sock:/ping\", host: \"localhost:8080\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:27:15 +0000] \"GET /ping HTTP/1.1\" 502 182 \"-\" \"-\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:27:15 +0000] [17] [INFO] Worker exiting (pid: 17)\n", "\u001b[32m∙●∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:27:15 +0000] [1070] [INFO] Booting worker with pid: 1070\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:28:25 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:1070)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020/04/23 23:28:25 [error] 10#10: *3 upstream prematurely closed connection while reading response header from upstream, client: 172.27.0.1, server: , request: \"GET /ping HTTP/1.1\", upstream: \"http://unix:/tmp/gunicorn.sock:/ping\", host: \"localhost:8080\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:28:25 +0000] \"GET /ping HTTP/1.1\" 502 182 \"-\" \"-\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:28:25 +0000] [1070] [INFO] Worker exiting (pid: 1070)\n", "\u001b[32m∙●∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:28:26 +0000] [1104] [INFO] Booting worker with pid: 1104\n", "\u001b[32m∙∙●\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:29:34 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:1104)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020/04/23 23:29:34 [error] 10#10: *5 upstream prematurely closed connection while reading response header from upstream, client: 172.27.0.1, server: , request: \"GET /ping HTTP/1.1\", upstream: \"http://unix:/tmp/gunicorn.sock:/ping\", host: \"localhost:8080\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:29:34 +0000] \"GET /ping HTTP/1.1\" 502 182 \"-\" \"-\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:29:34 +0000] [1104] [INFO] Worker exiting (pid: 1104)\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:29:34 +0000] [1138] [INFO] Booting worker with pid: 1138\n", "\u001b[32m●∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:30:42 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:584)\n", "\u001b[32m∙●∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020/04/23 23:30:42 [error] 10#10: *7 upstream prematurely closed connection while reading response header from upstream, client: 172.27.0.1, server: , request: \"GET /ping HTTP/1.1\", upstream: \"http://unix:/tmp/gunicorn.sock:/ping\", host: \"localhost:8080\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:30:42 +0000] \"GET /ping HTTP/1.1\" 502 182 \"-\" \"-\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:30:42 +0000] [584] [INFO] Worker exiting (pid: 584)\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:30:42 +0000] [1172] [INFO] Booting worker with pid: 1172\n", "\u001b[32m●∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:31:51 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:1138)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020/04/23 23:31:51 [error] 10#10: *9 upstream prematurely closed connection while reading response header from upstream, client: 172.27.0.1, server: , request: \"GET /ping HTTP/1.1\", upstream: \"http://unix:/tmp/gunicorn.sock:/ping\", host: \"localhost:8080\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:31:51 +0000] \"GET /ping HTTP/1.1\" 502 182 \"-\" \"-\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:31:51 +0000] [1138] [INFO] Worker exiting (pid: 1138)\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:31:51 +0000] [1206] [INFO] Booting worker with pid: 1206\n", "\u001b[32m●∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:32:59 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:1206)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020/04/23 23:32:59 [error] 10#10: *11 upstream prematurely closed connection while reading response header from upstream, client: 172.27.0.1, server: , request: \"GET /ping HTTP/1.1\", upstream: \"http://unix:/tmp/gunicorn.sock:/ping\", host: \"localhost:8080\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:32:59 +0000] \"GET /ping HTTP/1.1\" 502 182 \"-\" \"-\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:32:59 +0000] [1206] [INFO] Worker exiting (pid: 1206)\n", "\u001b[32m∙∙●\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:33:00 +0000] [1240] [INFO] Booting worker with pid: 1240\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:34:08 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:1172)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020/04/23 23:34:08 [error] 10#10: *13 upstream prematurely closed connection while reading response header from upstream, client: 172.27.0.1, server: , request: \"GET /ping HTTP/1.1\", upstream: \"http://unix:/tmp/gunicorn.sock:/ping\", host: \"localhost:8080\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:34:08 +0000] \"GET /ping HTTP/1.1\" 502 182 \"-\" \"-\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:34:08 +0000] [1172] [INFO] Worker exiting (pid: 1172)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[32m∙●∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:34:08 +0000] [1274] [INFO] Booting worker with pid: 1274\n", "\u001b[32m∙●∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:35:24 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:583)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020/04/23 23:35:24 [error] 10#10: *15 upstream prematurely closed connection while reading response header from upstream, client: 172.27.0.1, server: , request: \"GET /ping HTTP/1.1\", upstream: \"http://unix:/tmp/gunicorn.sock:/ping\", host: \"localhost:8080\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:35:24 +0000] \"GET /ping HTTP/1.1\" 502 182 \"-\" \"-\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:35:24 +0000] [583] [INFO] Worker exiting (pid: 583)\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:35:25 +0000] [1308] [INFO] Booting worker with pid: 1308\n", "\u001b[32m●∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:36:33 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:1274)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020/04/23 23:36:33 [error] 10#10: *17 upstream prematurely closed connection while reading response header from upstream, client: 172.27.0.1, server: , request: \"GET /ping HTTP/1.1\", upstream: \"http://unix:/tmp/gunicorn.sock:/ping\", host: \"localhost:8080\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:36:33 +0000] \"GET /ping HTTP/1.1\" 502 182 \"-\" \"-\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:36:33 +0000] [1274] [INFO] Worker exiting (pid: 1274)\n", "\u001b[32m∙∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:36:33 +0000] [1342] [INFO] Booting worker with pid: 1342\n", "\u001b[32m●∙∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:37:41 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:1308)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020/04/23 23:37:41 [error] 10#10: *19 upstream prematurely closed connection while reading response header from upstream, client: 172.27.0.1, server: , request: \"GET /ping HTTP/1.1\", upstream: \"http://unix:/tmp/gunicorn.sock:/ping\", host: \"localhost:8080\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:37:41 +0000] \"GET /ping HTTP/1.1\" 502 182 \"-\" \"-\"\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:37:41 +0000] [1308] [INFO] Worker exiting (pid: 1308)\n", "\u001b[32m∙∙●\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:37:42 +0000] [1376] [INFO] Booting worker with pid: 1376\n", "\u001b[32m∙●∙\u001b[0m \u001b[K\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:39:05.520632: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:39:05.520674: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:39:05.520720: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:163] no NVIDIA GPU device is present: /dev/nvidia0 does not exist\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:39:05.520932: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:39:05.548447: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2300055000 Hz\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:39:05.550187: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x98f4a00 executing computations on platform Host. Devices:\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:39:05.550253: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): Host, Default Version\n", "\u001b[32m●∙∙\u001b[0m \u001b[K!\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:39:11 +0000] \"GET /ping HTTP/1.1\" 200 1 \"-\" \"-\"\n", "\u001b[K0:15:46.254845 | deployed model\n", "\u001b[K\u001b[32m0:15:46.255531 | Done! ✔\u001b[0m \n" ] } ], "source": [ "ez = ezsmdeploy.Deploy(model = None, #Since we are loading a model from TF hub\n", " script = 'modelscript_tensorflow.py',\n", " requirements = ['numpy','tensorflow-gpu==2.0.0','tensorflow_hub'], #or pass in the path to requirements.txt\n", " instance_type = 'local_gpu', #... if you intend to deploy on GPU with the flask-ngnix stack\n", " wait = True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Test containerized version locally" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Since you are downloading this model from a hub, the first time you invoke it will be slow, so invoke again to get an inference without all of the container logs. Prediction will especially be slow if your model is still downloading!" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[36malgo-1-qmeju_1 |\u001b[0m received input data\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m b'The quick brown fox jumps over the lazy dog.'\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:41:23.248410: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:41:23.248450: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:41:23.248487: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:163] no NVIDIA GPU device is present: /dev/nvidia0 does not exist\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:41:23.248690: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:41:23.276428: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2300055000 Hz\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:41:23.278241: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x98bd320 executing computations on platform Host. Devices:\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 2020-04-23 23:41:23.278271: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): Host, Default Version\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m predictions from model\n" ] }, { "data": { "text/plain": [ "'{\"tfeager\": true, \"output\": [[[-0.031330183148384094, -0.06338634341955185, -0.016074996441602707, -0.010348981246352196, -0.046500977128744125, 0.03723153844475746, 0.005915854126214981, 0.07174400240182877, 0.016664467751979828, 0.060907647013664246, 0.06655259430408478, 0.023705121129751205, 0.0005764692323282361, 0.05684323608875275, 0.024161657318472862, -0.00533629534766078, 0.04704771935939789, 0.019215712323784828, 0.07682554423809052, 0.005669617559760809, -0.07528220862150192, -0.017137235030531883, -0.07502710819244385, 0.07637348026037216, -0.054379601031541824, -0.0013890593545511365, -0.018301844596862793, -0.04672040790319443, -0.047241389751434326, 0.02706781215965748, 0.03233340010046959, 0.055370621383190155, 0.03370954468846321, -0.013706635683774948, 0.005527033936232328, -0.08226925879716873, 0.01419509295374155, 0.06827915459871292, 0.018320485949516296, -0.021478744223713875, 0.041496679186820984, -0.020274005830287933, -0.006010557524859905, 0.02448243275284767, -0.08840089291334152, -0.0256654042750597, -0.03832615166902542, -0.05610627308487892, 0.046812787652015686, 0.032031238079071045, 0.07727275788784027, -0.08250072598457336, 0.005450617987662554, 0.005793000105768442, -0.03869419917464256, 0.0002909306494984776, 0.06134960427880287, 0.07350336760282516, 0.05463423207402229, -0.08054965734481812, 0.05354289710521698, 0.003447831841185689, -0.0785728171467781, 0.05345219001173973, 0.08730373531579971, 0.001231119385920465, -0.008200918324291706, 0.014453515410423279, 0.06141883134841919, -0.04283349588513374, 0.02920800819993019, -0.046855274587869644, -0.027075883001089096, 0.0740266889333725, 0.06707657128572464, 0.018766090273857117, -0.038682546466588974, -0.023487549275159836, -0.04382677376270294, 0.0627523735165596, -0.01731267012655735, 0.04989194497466087, 0.010957980528473854, -0.08159638196229935, 0.023899002000689507, -0.06540824472904205, -0.025847991928458214, -0.05222587287425995, -0.048486385494470596, 0.043156981468200684, 0.06728990375995636, 0.023130573332309723, 0.05205420032143593, -0.05212564021348953, 0.006367790047079325, 0.07441359758377075, -0.0795416533946991, -0.02001795917749405, 0.024718133732676506, -0.04371218755841255, 0.02089691534638405, 0.011979945003986359, -0.03457764536142349, -0.006132300011813641, 0.04659564420580864, -0.04344385117292404, 0.06174729764461517, -0.005218201782554388, -0.047934964299201965, 0.05067220702767372, -0.009205029346048832, 0.04710583761334419, -0.056614797562360764, 0.04511883482336998, -0.05579575151205063, -0.009089075960218906, -0.06798787415027618, -0.01886197179555893, 0.058884043246507645, -0.08367834985256195, 0.019517384469509125, 0.06671608984470367, 0.07827500253915787, -0.03695891052484512, -0.019600417464971542, -0.06952506303787231, -0.03499816730618477, 0.011369210667908192, -0.04191366955637932, -0.06929595023393631, -0.05114427208900452, 0.04757271707057953, 0.013809421099722385, -0.035893745720386505, -0.04533398896455765, 0.04909994453191757, 0.007652154192328453, 0.044253893196582794, -0.03171328455209732, 0.057876914739608765, -0.01637735776603222, -0.03372560068964958, 0.0644775852560997, 0.06611259281635284, -0.037015244364738464, -0.05423258990049362, 0.04248342663049698, 0.008844238705933094, -0.020803630352020264, 0.016499601304531097, -0.025547238066792488, -0.038437116891145706, -0.032067250460386276, 0.08242538571357727, 0.04629473760724068, -0.05706200748682022, -0.038405194878578186, -0.07293297350406647, -0.07190611213445663, -0.010248933918774128, -0.07315361499786377, -0.061659760773181915, -0.02765096351504326, 0.048867423087358475, -0.015222039073705673, 0.07067492604255676, -0.02952404133975506, -0.005266036372631788, -0.00411289231851697, 0.07203853130340576, 0.012093514204025269, 0.05287892743945122, -0.012248169630765915, 0.02542322501540184, -0.054301608353853226, 0.03501955792307854, 0.024856742471456528, -0.019358817487955093, -0.02106393128633499, -0.05864177644252777, 0.0365971177816391, 0.017275260761380196, -0.03798952326178551, 0.06683705747127533, 0.08466865122318268, -0.06390753388404846, 0.03176082670688629, -0.02773377113044262, 0.010581550188362598, 0.014289459213614464, 0.018591416999697685, 0.06697511672973633, -8.135570533340797e-05, -0.06629001349210739, 0.00396365812048316, 0.02080395817756653, -0.0063473740592598915, 0.021438710391521454, 0.04149652644991875, -0.028641177341341972, -0.06658860296010971, 0.04130375757813454, -0.003844296094030142, 0.020536167547106743, -0.03125283122062683, 0.045037999749183655, -0.051790423691272736, 0.08364971727132797, -0.03800063952803612, 0.053368791937828064, -0.016496896743774414, 0.038055550307035446, -0.04724383354187012, -0.013493286445736885, -0.014117934741079807, 0.003195306984707713, 0.03638426959514618, -0.0006778377573937178, -0.0421210452914238, 0.04385000094771385, 0.009303811006247997, 0.011592378839850426, 0.025404850021004677, 0.027816958725452423, -0.07771264016628265, -0.036864023655653, 0.0033576868008822203, -0.0578950010240078, 0.05500846356153488, -0.03281790018081665, 0.05175198242068291, -0.07882102578878403, 0.035790733993053436, -0.0034756511449813843, 0.0030184390489012003, -0.014469866640865803, -0.009583667851984501, -0.025967570021748543, 0.0046393731608986855, -0.004874974489212036, 0.01931224763393402, -0.03588906675577164, 0.017798995599150658, -0.04859163612127304, 0.08719106763601303, -0.02151617221534252, 0.0059039699845016, 0.07925589382648468, 0.014131531119346619, 0.038771308958530426, 0.007654789835214615, -0.03604533150792122, 0.00437383446842432, 0.015160423703491688, 0.00562448613345623, -0.08528512716293335, -0.02613111212849617, -0.058158282190561295, -0.005544557236135006, 0.006199504714459181, -0.031198129057884216, 0.010851625353097916, 0.03742764890193939, 0.06748316437005997, -0.01572263054549694, 0.05103956535458565, 0.043473631143569946, 0.0429932177066803, -0.053309693932533264, 0.03091443143785, -0.08023348450660706, 0.05154663696885109, 0.04617471992969513, -0.002437247196212411, 0.02651979960501194, -0.05226387083530426, 0.06042409688234329, -0.04478614032268524, -0.01262760628014803, 0.011432714760303497, 0.017342867329716682, 0.03397129103541374, -0.005349427927285433, -0.0486748181283474, -0.006172748748213053, -0.041853342205286026, 0.0053648566827178, 0.08420374989509583, -0.027170618996024132, -0.03358965367078781, -0.0578816719353199, -0.04875055328011513, 0.0726495310664177, 0.03502766042947769, -0.02566519007086754, -0.06706526130437851, -0.0207644272595644, -0.06700704246759415, -0.08660740405321121, 0.03251113370060921, 0.003142010187730193, -0.02877213805913925, -0.021510861814022064, 0.027447886765003204, -0.06871646642684937, -0.07649340480566025, 0.023485517129302025, -0.06365587562322617, 0.018731098622083664, 0.04042151942849159, -0.011959227733314037, 0.017753582447767258, 0.013197426684200764, -0.009165935218334198, 0.060436274856328964, -0.014406451024115086, 0.034785330295562744, 0.03385714814066887, -0.03986155241727829, 0.008972647599875927, -0.006457790266722441, -0.025691131129860878, 0.06597081571817398, -0.013756905682384968, 0.04024309292435646, -0.061379846185445786, 0.05706486105918884, 0.05490966513752937, 0.008057709783315659, 0.022971007972955704, -0.01080258097499609, -0.028922738507390022, -0.010549401864409447, -0.04093077778816223, 0.07029084861278534, 0.016437748447060585, -0.038902707397937775, 0.06806709617376328, 0.01462871115654707, 0.06336338818073273, -0.03276393935084343, 0.01972515694797039, -0.02293352223932743, -0.021750446408987045, -0.018101854249835014, 0.053671251982450485, 0.03208281844854355, 0.035735223442316055, 0.03851852938532829, 0.01228740718215704, -0.05020959675312042, 0.012321753427386284, 0.07447058707475662, -0.036907125264406204, 0.032554902136325836, 0.0376807376742363, -0.08435206860303879, 0.003296049777418375, 0.04396742582321167, -0.012907750904560089, 0.04000893235206604, -0.014150022529065609, 0.017953624948859215, -0.02680850587785244, -0.018471600487828255, 0.041608765721321106, 0.020105941221117973, 0.04861859977245331, -0.013706918805837631, -0.05265587568283081, -0.0833578109741211, 0.03300900012254715, 0.014646248891949654, 0.03605816140770912, 0.024250240996479988, -0.02355591580271721, -0.035607971251010895, -0.001255422132089734, -0.06962309032678604, -0.05294698476791382, 0.08024067431688309, -0.05256514996290207, 0.04111393168568611, 0.044137392193078995, 0.02888524904847145, 0.007021070923656225, -0.0593215748667717, 0.00024898265837691724, 0.039713796228170395, 0.046366188675165176, 0.004386021289974451, -0.05880264192819595, -0.06346201151609421, 0.002124595455825329, 0.030953820794820786, -0.06521671265363693, -0.03437795862555504, -0.08330433815717697, -0.053039371967315674, -0.019852353259921074, 0.05120111629366875, 0.02008368819952011, 0.013754978775978088, 0.0328655019402504, -0.0013420546893030405, -0.022503014653921127, -0.029767191037535667, -0.02635234221816063, 0.017108380794525146, 0.01604567840695381, -0.002537995344027877, 0.0689256489276886, 0.05616958066821098, -0.019212404265999794, 0.04107998311519623, -0.06302692741155624, -0.04096689820289612, -0.001670209807343781, 0.016859019175171852, -0.048091910779476166, -0.03552378714084625, 0.040654443204402924, -0.06656268239021301, -0.06405597925186157, 0.009229498915374279, 0.08044889569282532, 0.0037155463360249996, -0.023230940103530884, -0.02085656113922596, 0.04045750945806503, 0.01608499512076378, -0.06146060302853584, -0.03134622797369957, 0.05905153602361679, -0.009260387159883976, 0.03801318258047104, 0.03004448302090168, 0.06723333895206451, -0.04148132726550102, -0.0692562535405159, -0.0013092769077047706, -0.050881437957286835, -0.024717291817069054, -0.019404079765081406, 0.059784043580293655, -0.05046435818076134, 0.06347361207008362, -0.055059053003787994, -0.04675474390387535, 0.03235206753015518, -0.04680732637643814, 0.01592983305454254, -0.02697250433266163, -0.08697662502527237, 0.006325982511043549, -0.05541209876537323, 0.04124559089541435, 0.04838025942444801, 0.026581544429063797, 0.036291562020778656, -0.021624520421028137, -0.0035482647363096476, -0.03274111822247505, -0.0023093270137906075, -0.03960143029689789, -0.01389663852751255, 0.029864737764000893, 0.02283358946442604, 0.07580499351024628, 0.05116503685712814, 0.01597355678677559, -0.003300838405266404, 0.08868572860956192, -0.04295743256807327, -0.06257003545761108, 0.07075933367013931, -0.011005166918039322, -0.008502762764692307, 0.07523509114980698, -0.053475912660360336, -0.07449723035097122, 0.04903283342719078, -0.058068107813596725, 0.05808483436703682, -0.05061332508921623, 0.01947685144841671, -0.0668443813920021, -0.03702550753951073, -0.03693912923336029, -0.034659285098314285, -0.0694742277264595, 0.004041218664497137, -0.008318519219756126, -0.01708226092159748, -0.04697662591934204, 0.040809039026498795, 0.004464625380933285, -0.04804883897304535, -0.07968294620513916, 0.07776656001806259, 0.01000385545194149, -0.03968571498990059, -0.019595839083194733, 0.05734303221106529, 0.05593224614858627, 0.01712670922279358, 0.07347219437360764, -0.07855235785245895, 0.06488888710737228, -0.03242780268192291, -0.04575740173459053, 0.053704556077718735]]]}'" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[36malgo-1-qmeju_1 |\u001b[0m ['{\"tfeager\": true, \"output\": [[[-0.031330183148384094, -0.06338634341955185, -0.016074996441602707, -0.010348981246352196, -0.046500977128744125, 0.03723153844475746, 0.005915854126214981, 0.07174400240182877, 0.016664467751979828, 0.060907647013664246, 0.06655259430408478, 0.023705121129751205, 0.0005764692323282361, 0.05684323608875275, 0.024161657318472862, -0.00533629534766078, 0.04704771935939789, 0.019215712323784828, 0.07682554423809052, 0.005669617559760809, -0.07528220862150192, -0.017137235030531883, -0.07502710819244385, 0.07637348026037216, -0.054379601031541824, -0.0013890593545511365, -0.018301844596862793, -0.04672040790319443, -0.047241389751434326, 0.02706781215965748, 0.03233340010046959, 0.055370621383190155, 0.03370954468846321, -0.013706635683774948, 0.005527033936232328, -0.08226925879716873, 0.01419509295374155, 0.06827915459871292, 0.018320485949516296, -0.021478744223713875, 0.041496679186820984, -0.020274005830287933, -0.006010557524859905, 0.02448243275284767, -0.08840089291334152, -0.0256654042750597, -0.03832615166902542, -0.05610627308487892, 0.046812787652015686, 0.032031238079071045, 0.07727275788784027, -0.08250072598457336, 0.005450617987662554, 0.005793000105768442, -0.03869419917464256, 0.0002909306494984776, 0.06134960427880287, 0.07350336760282516, 0.05463423207402229, -0.08054965734481812, 0.05354289710521698, 0.003447831841185689, -0.0785728171467781, 0.05345219001173973, 0.08730373531579971, 0.001231119385920465, -0.008200918324291706, 0.014453515410423279, 0.06141883134841919, -0.04283349588513374, 0.02920800819993019, -0.046855274587869644, -0.027075883001089096, 0.0740266889333725, 0.06707657128572464, 0.018766090273857117, -0.038682546466588974, -0.023487549275159836, -0.04382677376270294, 0.0627523735165596, -0.01731267012655735, 0.04989194497466087, 0.010957980528473854, -0.08159638196229935, 0.023899002000689507, -0.06540824472904205, -0.025847991928458214, -0.05222587287425995, -0.048486385494470596, 0.043156981468200684, 0.06728990375995636, 0.023130573332309723, 0.05205420032143593, -0.05212564021348953, 0.006367790047079325, 0.07441359758377075, -0.0795416533946991, -0.02001795917749405, 0.024718133732676506, -0.04371218755841255, 0.02089691534638405, 0.011979945003986359, -0.03457764536142349, -0.006132300011813641, 0.04659564420580864, -0.04344385117292404, 0.06174729764461517, -0.005218201782554388, -0.047934964299201965, 0.05067220702767372, -0.009205029346048832, 0.04710583761334419, -0.056614797562360764, 0.04511883482336998, -0.05579575151205063, -0.009089075960218906, -0.06798787415027618, -0.01886197179555893, 0.058884043246507645, -0.08367834985256195, 0.019517384469509125, 0.06671608984470367, 0.07827500253915787, -0.03695891052484512, -0.019600417464971542, -0.06952506303787231, -0.03499816730618477, 0.011369210667908192, -0.04191366955637932, -0.06929595023393631, -0.05114427208900452, 0.04757271707057953, 0.013809421099722385, -0.035893745720386505, -0.04533398896455765, 0.04909994453191757, 0.007652154192328453, 0.044253893196582794, -0.03171328455209732, 0.057876914739608765, -0.01637735776603222, -0.03372560068964958, 0.0644775852560997, 0.06611259281635284, -0.037015244364738464, -0.05423258990049362, 0.04248342663049698, 0.008844238705933094, -0.020803630352020264, 0.016499601304531097, -0.025547238066792488, -0.038437116891145706, -0.032067250460386276, 0.08242538571357727, 0.04629473760724068, -0.05706200748682022, -0.038405194878578186, -0.07293297350406647, -0.07190611213445663, -0.010248933918774128, -0.07315361499786377, -0.061659760773181915, -0.02765096351504326, 0.048867423087358475, -0.015222039073705673, 0.07067492604255676, -0.02952404133975506, -0.005266036372631788, -0.00411289231851697, 0.07203853130340576, 0.012093514204025269, 0.05287892743945122, -0.012248169630765915, 0.02542322501540184, -0.054301608353853226, 0.03501955792307854, 0.024856742471456528, -0.019358817487955093, -0.02106393128633499, -0.05864177644252777, 0.0365971177816391, 0.017275260761380196, -0.03798952326178551, 0.06683705747127533, 0.08466865122318268, -0.06390753388404846, 0.03176082670688629, -0.02773377113044262, 0.010581550188362598, 0.014289459213614464, 0.018591416999697685, 0.06697511672973633, -8.135570533340797e-05, -0.06629001349210739, 0.00396365812048316, 0.02080395817756653, -0.0063473740592598915, 0.021438710391521454, 0.04149652644991875, -0.028641177341341972, -0.06658860296010971, 0.04130375757813454, -0.003844296094030142, 0.020536167547106743, -0.03125283122062683, 0.045037999749183655, -0.051790423691272736, 0.08364971727132797, -0.03800063952803612, 0.053368791937828064, -0.016496896743774414, 0.038055550307035446, -0.04724383354187012, -0.013493286445736885, -0.014117934741079807, 0.003195306984707713, 0.03638426959514618, -0.0006778377573937178, -0.0421210452914238, 0.04385000094771385, 0.009303811006247997, 0.011592378839850426, 0.025404850021004677, 0.027816958725452423, -0.07771264016628265, -0.036864023655653, 0.0033576868008822203, -0.0578950010240078, 0.05500846356153488, -0.03281790018081665, 0.05175198242068291, -0.07882102578878403, 0.035790733993053436, -0.0034756511449813843, 0.0030184390489012003, -0.014469866640865803, -0.009583667851984501, -0.025967570021748543, 0.0046393731608986855, -0.004874974489212036, 0.01931224763393402, -0.03588906675577164, 0.017798995599150658, -0.04859163612127304, 0.08719106763601303, -0.02151617221534252, 0.0059039699845016, 0.07925589382648468, 0.014131531119346619, 0.038771308958530426, 0.007654789835214615, -0.03604533150792122, 0.00437383446842432, 0.015160423703491688, 0.00562448613345623, -0.08528512716293335, -0.02613111212849617, -0.058158282190561295, -0.005544557236135006, 0.006199504714459181, -0.031198129057884216, 0.010851625353097916, 0.03742764890193939, 0.06748316437005997, -0.01572263054549694, 0.05103956535458565, 0.043473631143569946, 0.0429932177066803, -0.053309693932533264, 0.03091443143785, -0.08023348450660706, 0.05154663696885109, 0.04617471992969513, -0.002437247196212411, 0.02651979960501194, -0.05226387083530426, 0.06042409688234329, -0.04478614032268524, -0.01262760628014803, 0.011432714760303497, 0.017342867329716682, 0.03397129103541374, -0.005349427927285433, -0.0486748181283474, -0.006172748748213053, -0.041853342205286026, 0.0053648566827178, 0.08420374989509583, -0.027170618996024132, -0.03358965367078781, -0.0578816719353199, -0.04875055328011513, 0.0726495310664177, 0.03502766042947769, -0.02566519007086754, -0.06706526130437851, -0.0207644272595644, -0.06700704246759415, -0.08660740405321121, 0.03251113370060921, 0.003142010187730193, -0.02877213805913925, -0.021510861814022064, 0.027447886765003204, -0.06871646642684937, -0.07649340480566025, 0.023485517129302025, -0.06365587562322617, 0.018731098622083664, 0.04042151942849159, -0.011959227733314037, 0.017753582447767258, 0.013197426684200764, -0.009165935218334198, 0.060436274856328964, -0.014406451024115086, 0.034785330295562744, 0.03385714814066887, -0.03986155241727829, 0.008972647599875927, -0.006457790266722441, -0.025691131129860878, 0.06597081571817398, -0.013756905682384968, 0.04024309292435646, -0.061379846185445786, 0.05706486105918884, 0.05490966513752937, 0.008057709783315659, 0.022971007972955704, -0.01080258097499609, -0.028922738507390022, -0.010549401864409447, -0.04093077778816223, 0.07029084861278534, 0.016437748447060585, -0.038902707397937775, 0.06806709617376328, 0.01462871115654707, 0.06336338818073273, -0.03276393935084343, 0.01972515694797039, -0.02293352223932743, -0.021750446408987045, -0.018101854249835014, 0.053671251982450485, 0.03208281844854355, 0.035735223442316055, 0.03851852938532829, 0.01228740718215704, -0.05020959675312042, 0.012321753427386284, 0.07447058707475662, -0.036907125264406204, 0.032554902136325836, 0.0376807376742363, -0.08435206860303879, 0.003296049777418375, 0.04396742582321167, -0.012907750904560089, 0.04000893235206604, -0.014150022529065609, 0.017953624948859215, -0.02680850587785244, -0.018471600487828255, 0.041608765721321106, 0.020105941221117973, 0.04861859977245331, -0.013706918805837631, -0.05265587568283081, -0.0833578109741211, 0.03300900012254715, 0.014646248891949654, 0.03605816140770912, 0.024250240996479988, -0.02355591580271721, -0.035607971251010895, -0.001255422132089734, -0.06962309032678604, -0.05294698476791382, 0.08024067431688309, -0.05256514996290207, 0.04111393168568611, 0.044137392193078995, 0.02888524904847145, 0.007021070923656225, -0.0593215748667717, 0.00024898265837691724, 0.039713796228170395, 0.046366188675165176, 0.004386021289974451, -0.05880264192819595, -0.06346201151609421, 0.002124595455825329, 0.030953820794820786, -0.06521671265363693, -0.03437795862555504, -0.08330433815717697, -0.053039371967315674, -0.019852353259921074, 0.05120111629366875, 0.02008368819952011, 0.013754978775978088, 0.0328655019402504, -0.0013420546893030405, -0.022503014653921127, -0.029767191037535667, -0.02635234221816063, 0.017108380794525146, 0.01604567840695381, -0.002537995344027877, 0.0689256489276886, 0.05616958066821098, -0.019212404265999794, 0.04107998311519623, -0.06302692741155624, -0.04096689820289612, -0.001670209807343781, 0.016859019175171852, -0.048091910779476166, -0.03552378714084625, 0.040654443204402924, -0.06656268239021301, -0.06405597925186157, 0.009229498915374279, 0.08044889569282532, 0.0037155463360249996, -0.023230940103530884, -0.02085656113922596, 0.04045750945806503, 0.01608499512076378, -0.06146060302853584, -0.03134622797369957, 0.05905153602361679, -0.009260387159883976, 0.03801318258047104, 0.03004448302090168, 0.06723333895206451, -0.04148132726550102, -0.0692562535405159, -0.0013092769077047706, -0.050881437957286835, -0.024717291817069054, -0.019404079765081406, 0.059784043580293655, -0.05046435818076134, 0.06347361207008362, -0.055059053003787994, -0.04675474390387535, 0.03235206753015518, -0.04680732637643814, 0.01592983305454254, -0.02697250433266163, -0.08697662502527237, 0.006325982511043549, -0.05541209876537323, 0.04124559089541435, 0.04838025942444801, 0.026581544429063797, 0.036291562020778656, -0.021624520421028137, -0.0035482647363096476, -0.03274111822247505, -0.0023093270137906075, -0.03960143029689789, -0.01389663852751255, 0.029864737764000893, 0.02283358946442604, 0.07580499351024628, 0.05116503685712814, 0.01597355678677559, -0.003300838405266404, 0.08868572860956192, -0.04295743256807327, -0.06257003545761108, 0.07075933367013931, -0.011005166918039322, -0.008502762764692307, 0.07523509114980698, -0.053475912660360336, -0.07449723035097122, 0.04903283342719078, -0.058068107813596725, 0.05808483436703682, -0.05061332508921623, 0.01947685144841671, -0.0668443813920021, -0.03702550753951073, -0.03693912923336029, -0.034659285098314285, -0.0694742277264595, 0.004041218664497137, -0.008318519219756126, -0.01708226092159748, -0.04697662591934204, 0.040809039026498795, 0.004464625380933285, -0.04804883897304535, -0.07968294620513916, 0.07776656001806259, 0.01000385545194149, -0.03968571498990059, -0.019595839083194733, 0.05734303221106529, 0.05593224614858627, 0.01712670922279358, 0.07347219437360764, -0.07855235785245895, 0.06488888710737228, -0.03242780268192291, -0.04575740173459053, 0.053704556077718735]]]}']\r\n", "\u001b[36malgo-1-qmeju_1 |\u001b[0m 172.27.0.1 - - [23/Apr/2020:23:41:29 +0000] \"POST /invocations HTTP/1.1\" 200 11252 \"-\" \"-\"\r\n" ] } ], "source": [ "out = ez.predictor.predict(inputs.encode()).decode()\n", "out" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[36malgo-1-qmeju_1 |\u001b[0m [2020-04-23 23:41:35 +0000] [9] [INFO] Handling signal: term\n", "\u001b[36mtmpfd5boyt9_algo-1-qmeju_1 exited with code 0\n", "\u001b[0mAborting on container exit...\n" ] } ], "source": [ "!docker container stop $(docker container ls -aq) >/dev/null" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Deploy on SageMaker" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[K0:00:00.003170 | No model was passed. Assuming you are downloading a model in the script or in the container\n", "\u001b[K0:00:00.077102 | uploaded model tarball(s) ; check returned modelpath\n", "\u001b[K0:00:00.078005 | added requirements file\n", "\u001b[K0:00:00.080012 | added source file\n", "\u001b[K0:00:00.081448 | added Dockerfile\n", "\u001b[K0:00:00.083687 | added model_handler and docker utils\n", "\u001b[K0:00:00.083777 | building docker container\n", "\u001b[K0:01:19.316520 | built docker container\n", "\u001b[K0:01:19.422949 | created model(s). Now deploying on ml.p3.2xlarge\n", "\u001b[K0:10:51.965824 | deployed model-!\n", "\u001b[K0:10:51.966408 | estimated cost is $4.627 per hour\n", "\u001b[K0:10:51.967389 | model monitor data capture location is s3://sagemaker-us-east-1-497456752804/ezsmdeploy/model-anzlpxc6eltjicelbcb5ho/datacapture\n", "\u001b[K\u001b[32m0:10:51.967497 | Done! ✔\u001b[0m \n" ] } ], "source": [ "ezonsm = ezsmdeploy.Deploy(model = None, #Since we are loading a model from TF hub,\n", " script = 'modelscript_tensorflow.py',\n", " requirements = ['numpy','tensorflow-gpu==2.0.0','tensorflow_hub'],\n", " wait = True,\n", " instance_type = 'ml.p3.2xlarge',\n", " monitor = True) # turn on model monitoring " ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'{\"output\": [[[-0.031330183148384094, -0.06338634341955185, -0.016074996441602707, -0.010348981246352196, -0.046500977128744125, 0.03723153844475746, 0.005915854126214981, 0.07174400240182877, 0.016664467751979828, 0.060907647013664246, 0.06655259430408478, 0.023705121129751205, 0.0005764692323282361, 0.05684323608875275, 0.024161657318472862, -0.00533629534766078, 0.04704771935939789, 0.019215712323784828, 0.07682554423809052, 0.005669617559760809, -0.07528220862150192, -0.017137235030531883, -0.07502710819244385, 0.07637348026037216, -0.054379601031541824, -0.0013890593545511365, -0.018301844596862793, -0.04672040790319443, -0.047241389751434326, 0.02706781215965748, 0.03233340010046959, 0.055370621383190155, 0.03370954468846321, -0.013706635683774948, 0.005527033936232328, -0.08226925879716873, 0.01419509295374155, 0.06827915459871292, 0.018320485949516296, -0.021478744223713875, 0.041496679186820984, -0.020274005830287933, -0.006010557524859905, 0.02448243275284767, -0.08840089291334152, -0.0256654042750597, -0.03832615166902542, -0.05610627308487892, 0.046812787652015686, 0.032031238079071045, 0.07727275788784027, -0.08250072598457336, 0.005450617987662554, 0.005793000105768442, -0.03869419917464256, 0.0002909306494984776, 0.06134960427880287, 0.07350336760282516, 0.05463423207402229, -0.08054965734481812, 0.05354289710521698, 0.003447831841185689, -0.0785728171467781, 0.05345219001173973, 0.08730373531579971, 0.001231119385920465, -0.008200918324291706, 0.014453515410423279, 0.06141883134841919, -0.04283349588513374, 0.02920800819993019, -0.046855274587869644, -0.027075883001089096, 0.0740266889333725, 0.06707657128572464, 0.018766090273857117, -0.038682546466588974, -0.023487549275159836, -0.04382677376270294, 0.0627523735165596, -0.01731267012655735, 0.04989194497466087, 0.010957980528473854, -0.08159638196229935, 0.023899002000689507, -0.06540824472904205, -0.025847991928458214, -0.05222587287425995, -0.048486385494470596, 0.043156981468200684, 0.06728990375995636, 0.023130573332309723, 0.05205420032143593, -0.05212564021348953, 0.006367790047079325, 0.07441359758377075, -0.0795416533946991, -0.02001795917749405, 0.024718133732676506, -0.04371218755841255, 0.02089691534638405, 0.011979945003986359, -0.03457764536142349, -0.006132300011813641, 0.04659564420580864, -0.04344385117292404, 0.06174729764461517, -0.005218201782554388, -0.047934964299201965, 0.05067220702767372, -0.009205029346048832, 0.04710583761334419, -0.056614797562360764, 0.04511883482336998, -0.05579575151205063, -0.009089075960218906, -0.06798787415027618, -0.01886197179555893, 0.058884043246507645, -0.08367834985256195, 0.019517384469509125, 0.06671608984470367, 0.07827500253915787, -0.03695891052484512, -0.019600417464971542, -0.06952506303787231, -0.03499816730618477, 0.011369210667908192, -0.04191366955637932, -0.06929595023393631, -0.05114427208900452, 0.04757271707057953, 0.013809421099722385, -0.035893745720386505, -0.04533398896455765, 0.04909994453191757, 0.007652154192328453, 0.044253893196582794, -0.03171328455209732, 0.057876914739608765, -0.01637735776603222, -0.03372560068964958, 0.0644775852560997, 0.06611259281635284, -0.037015244364738464, -0.05423258990049362, 0.04248342663049698, 0.008844238705933094, -0.020803630352020264, 0.016499601304531097, -0.025547238066792488, -0.038437116891145706, -0.032067250460386276, 0.08242538571357727, 0.04629473760724068, -0.05706200748682022, -0.038405194878578186, -0.07293297350406647, -0.07190611213445663, -0.010248933918774128, -0.07315361499786377, -0.061659760773181915, -0.02765096351504326, 0.048867423087358475, -0.015222039073705673, 0.07067492604255676, -0.02952404133975506, -0.005266036372631788, -0.00411289231851697, 0.07203853130340576, 0.012093514204025269, 0.05287892743945122, -0.012248169630765915, 0.02542322501540184, -0.054301608353853226, 0.03501955792307854, 0.024856742471456528, -0.019358817487955093, -0.02106393128633499, -0.05864177644252777, 0.0365971177816391, 0.017275260761380196, -0.03798952326178551, 0.06683705747127533, 0.08466865122318268, -0.06390753388404846, 0.03176082670688629, -0.02773377113044262, 0.010581550188362598, 0.014289459213614464, 0.018591416999697685, 0.06697511672973633, -8.135570533340797e-05, -0.06629001349210739, 0.00396365812048316, 0.02080395817756653, -0.0063473740592598915, 0.021438710391521454, 0.04149652644991875, -0.028641177341341972, -0.06658860296010971, 0.04130375757813454, -0.003844296094030142, 0.020536167547106743, -0.03125283122062683, 0.045037999749183655, -0.051790423691272736, 0.08364971727132797, -0.03800063952803612, 0.053368791937828064, -0.016496896743774414, 0.038055550307035446, -0.04724383354187012, -0.013493286445736885, -0.014117934741079807, 0.003195306984707713, 0.03638426959514618, -0.0006778377573937178, -0.0421210452914238, 0.04385000094771385, 0.009303811006247997, 0.011592378839850426, 0.025404850021004677, 0.027816958725452423, -0.07771264016628265, -0.036864023655653, 0.0033576868008822203, -0.0578950010240078, 0.05500846356153488, -0.03281790018081665, 0.05175198242068291, -0.07882102578878403, 0.035790733993053436, -0.0034756511449813843, 0.0030184390489012003, -0.014469866640865803, -0.009583667851984501, -0.025967570021748543, 0.0046393731608986855, -0.004874974489212036, 0.01931224763393402, -0.03588906675577164, 0.017798995599150658, -0.04859163612127304, 0.08719106763601303, -0.02151617221534252, 0.0059039699845016, 0.07925589382648468, 0.014131531119346619, 0.038771308958530426, 0.007654789835214615, -0.03604533150792122, 0.00437383446842432, 0.015160423703491688, 0.00562448613345623, -0.08528512716293335, -0.02613111212849617, -0.058158282190561295, -0.005544557236135006, 0.006199504714459181, -0.031198129057884216, 0.010851625353097916, 0.03742764890193939, 0.06748316437005997, -0.01572263054549694, 0.05103956535458565, 0.043473631143569946, 0.0429932177066803, -0.053309693932533264, 0.03091443143785, -0.08023348450660706, 0.05154663696885109, 0.04617471992969513, -0.002437247196212411, 0.02651979960501194, -0.05226387083530426, 0.06042409688234329, -0.04478614032268524, -0.01262760628014803, 0.011432714760303497, 0.017342867329716682, 0.03397129103541374, -0.005349427927285433, -0.0486748181283474, -0.006172748748213053, -0.041853342205286026, 0.0053648566827178, 0.08420374989509583, -0.027170618996024132, -0.03358965367078781, -0.0578816719353199, -0.04875055328011513, 0.0726495310664177, 0.03502766042947769, -0.02566519007086754, -0.06706526130437851, -0.0207644272595644, -0.06700704246759415, -0.08660740405321121, 0.03251113370060921, 0.003142010187730193, -0.02877213805913925, -0.021510861814022064, 0.027447886765003204, -0.06871646642684937, -0.07649340480566025, 0.023485517129302025, -0.06365587562322617, 0.018731098622083664, 0.04042151942849159, -0.011959227733314037, 0.017753582447767258, 0.013197426684200764, -0.009165935218334198, 0.060436274856328964, -0.014406451024115086, 0.034785330295562744, 0.03385714814066887, -0.03986155241727829, 0.008972647599875927, -0.006457790266722441, -0.025691131129860878, 0.06597081571817398, -0.013756905682384968, 0.04024309292435646, -0.061379846185445786, 0.05706486105918884, 0.05490966513752937, 0.008057709783315659, 0.022971007972955704, -0.01080258097499609, -0.028922738507390022, -0.010549401864409447, -0.04093077778816223, 0.07029084861278534, 0.016437748447060585, -0.038902707397937775, 0.06806709617376328, 0.01462871115654707, 0.06336338818073273, -0.03276393935084343, 0.01972515694797039, -0.02293352223932743, -0.021750446408987045, -0.018101854249835014, 0.053671251982450485, 0.03208281844854355, 0.035735223442316055, 0.03851852938532829, 0.01228740718215704, -0.05020959675312042, 0.012321753427386284, 0.07447058707475662, -0.036907125264406204, 0.032554902136325836, 0.0376807376742363, -0.08435206860303879, 0.003296049777418375, 0.04396742582321167, -0.012907750904560089, 0.04000893235206604, -0.014150022529065609, 0.017953624948859215, -0.02680850587785244, -0.018471600487828255, 0.041608765721321106, 0.020105941221117973, 0.04861859977245331, -0.013706918805837631, -0.05265587568283081, -0.0833578109741211, 0.03300900012254715, 0.014646248891949654, 0.03605816140770912, 0.024250240996479988, -0.02355591580271721, -0.035607971251010895, -0.001255422132089734, -0.06962309032678604, -0.05294698476791382, 0.08024067431688309, -0.05256514996290207, 0.04111393168568611, 0.044137392193078995, 0.02888524904847145, 0.007021070923656225, -0.0593215748667717, 0.00024898265837691724, 0.039713796228170395, 0.046366188675165176, 0.004386021289974451, -0.05880264192819595, -0.06346201151609421, 0.002124595455825329, 0.030953820794820786, -0.06521671265363693, -0.03437795862555504, -0.08330433815717697, -0.053039371967315674, -0.019852353259921074, 0.05120111629366875, 0.02008368819952011, 0.013754978775978088, 0.0328655019402504, -0.0013420546893030405, -0.022503014653921127, -0.029767191037535667, -0.02635234221816063, 0.017108380794525146, 0.01604567840695381, -0.002537995344027877, 0.0689256489276886, 0.05616958066821098, -0.019212404265999794, 0.04107998311519623, -0.06302692741155624, -0.04096689820289612, -0.001670209807343781, 0.016859019175171852, -0.048091910779476166, -0.03552378714084625, 0.040654443204402924, -0.06656268239021301, -0.06405597925186157, 0.009229498915374279, 0.08044889569282532, 0.0037155463360249996, -0.023230940103530884, -0.02085656113922596, 0.04045750945806503, 0.01608499512076378, -0.06146060302853584, -0.03134622797369957, 0.05905153602361679, -0.009260387159883976, 0.03801318258047104, 0.03004448302090168, 0.06723333895206451, -0.04148132726550102, -0.0692562535405159, -0.0013092769077047706, -0.050881437957286835, -0.024717291817069054, -0.019404079765081406, 0.059784043580293655, -0.05046435818076134, 0.06347361207008362, -0.055059053003787994, -0.04675474390387535, 0.03235206753015518, -0.04680732637643814, 0.01592983305454254, -0.02697250433266163, -0.08697662502527237, 0.006325982511043549, -0.05541209876537323, 0.04124559089541435, 0.04838025942444801, 0.026581544429063797, 0.036291562020778656, -0.021624520421028137, -0.0035482647363096476, -0.03274111822247505, -0.0023093270137906075, -0.03960143029689789, -0.01389663852751255, 0.029864737764000893, 0.02283358946442604, 0.07580499351024628, 0.05116503685712814, 0.01597355678677559, -0.003300838405266404, 0.08868572860956192, -0.04295743256807327, -0.06257003545761108, 0.07075933367013931, -0.011005166918039322, -0.008502762764692307, 0.07523509114980698, -0.053475912660360336, -0.07449723035097122, 0.04903283342719078, -0.058068107813596725, 0.05808483436703682, -0.05061332508921623, 0.01947685144841671, -0.0668443813920021, -0.03702550753951073, -0.03693912923336029, -0.034659285098314285, -0.0694742277264595, 0.004041218664497137, -0.008318519219756126, -0.01708226092159748, -0.04697662591934204, 0.040809039026498795, 0.004464625380933285, -0.04804883897304535, -0.07968294620513916, 0.07776656001806259, 0.01000385545194149, -0.03968571498990059, -0.019595839083194733, 0.05734303221106529, 0.05593224614858627, 0.01712670922279358, 0.07347219437360764, -0.07855235785245895, 0.06488888710737228, -0.03242780268192291, -0.04575740173459053, 0.053704556077718735]]], \"tfeager\": true}'" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "out = ezonsm.predictor.predict(inputs).decode()\n", "out" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "ezonsm.predictor.delete_endpoint()" ] } ], "metadata": { "kernelspec": { "display_name": "conda_python3", "language": "python", "name": "conda_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.6.5" } }, "nbformat": 4, "nbformat_minor": 4 }