Skip to content

Commit 19aa32a

Browse files
Merge pull request #36 from WallarooLabs/2023.2.1_release
2023.2.1_release
2 parents 942974f + 1d6eaf3 commit 19aa32a

File tree

4,179 files changed

+2854434
-5416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,179 files changed

+2854434
-5416
lines changed

development/mlops_api/Wallaroo-MLOps-Tutorial.ipynb

Lines changed: 101 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,14 +1115,30 @@
11151115
"\n",
11161116
"### Upload Model to Workspace\n",
11171117
"\n",
1118-
"Uploads a ML Model to a Wallaroo workspace via POST with `Content-Type: multipart/form-data`.\n",
1118+
"ML Models are uploaded to Wallaroo through the following endpoint:\n",
11191119
"\n",
1120-
"* **Parameters**\n",
1121-
" * **name** - (*REQUIRED string*): Name of the model\n",
1122-
" * **visibility** - (*OPTIONAL string*): The visibility of the model as either `public` or `private`.\n",
1123-
" * **workspace_id** - (*REQUIRED int*): The numerical id of the workspace to upload the model to.\n",
1124-
" \n",
1125-
"Example: This example will upload the sample file `ccfraud.onnx` to the workspace created in the [Create Workspace](#create-workspace) step as `apitestmodel`. The model name will be saved as `exampleModelName` for use in other examples. The id of the uploaded model will be saved as `example_model_id` for use in later examples."
1120+
"Models uploaded through this method that are not native runtimes are containerized within the Wallaroo instance then run by the Wallaroo engine. See [Wallaroo MLOps API Essentials Guide: Pipeline Management]({{<ref \"wallaroo-mlops-api-essential-guide-pipelines\">}}) for details on pipeline configurations and deployments.\n",
1121+
"\n",
1122+
"For these models, the following inputs are required.\n",
1123+
"\n",
1124+
"* Endpoint:\n",
1125+
" * `/v1/api/models/upload_and_convert`\n",
1126+
"* Headers:\n",
1127+
" * **Content-Type**: `multipart/form-data`\n",
1128+
"* Parameters\n",
1129+
" * **name** (*String* *Required*): The model name.\n",
1130+
" * **visibility** (*String* *Required*): Either `public` or `private`.\n",
1131+
" * **workspace_id** (*String* *Required*): The numerical ID of the workspace to upload the model to.\n",
1132+
" * **conversion** (*String* *Required*): The conversion parameters that include the following:\n",
1133+
" * **framework** (*String* *Required*): The framework of the model being uploaded. See the list of supported models for more details.\n",
1134+
" * **python_version** (*String* *Required*): The version of Python required for model.\n",
1135+
" * **requirements** (*String* *Required*): Required libraries. Can be `[]` if the requirements are default Wallaroo JupyterHub libraries.\n",
1136+
" * **input_schema** (*String* *Optional*): The input schema from the Apache Arrow `pyarrow.lib.Schema` format, encoded with `base64.b64encode`. Only required for non-native runtime models.\n",
1137+
" * **output_schema** (*String* *Optional*): The output schema from the Apache Arrow `pyarrow.lib.Schema` format, encoded with `base64.b64encode`. Only required for non-native runtime models.\n",
1138+
"\n",
1139+
"#### Upload Native Runtime Model Example\n",
1140+
"\n",
1141+
"ONNX are always native runtimes. The following example shows uploading an ONNX model to a Wallaroo instance using the `requests` library. Note that the `input_schema` and `output_schema` encoded details are not required."
11261142
]
11271143
},
11281144
{
@@ -1160,31 +1176,96 @@
11601176
}
11611177
],
11621178
"source": [
1163-
"## upload model\n",
1164-
"\n",
1165-
"# Retrieve the token\n",
1166-
"headers = wl.auth.auth_header()\n",
1179+
" authorization header\n",
1180+
"headers = {'Authorization': 'Bearer abcdefg'}\n",
11671181
"\n",
1168-
"apiRequest = f\"{APIURL}/v1/api/models/upload\"\n",
1182+
"apiRequest = f\"{APIURL}/v1/api/models/upload_and_convert\"\n",
11691183
"\n",
1170-
"# Model name and file to use\n",
1171-
"display(f\"Sample model name: {model_name}\")\n",
1172-
"display(f\"Sample model file: {model_file_name}\")\n",
1184+
"framework='onnx'\n",
11731185
"\n",
1186+
"model_name = f\"{suffix}ccfraud\"\n",
11741187
"\n",
11751188
"data = {\n",
1176-
" \"name\":model_name,\n",
1189+
" \"name\": model_name,\n",
11771190
" \"visibility\": \"public\",\n",
1178-
" \"workspace_id\": example_workspace_id\n",
1191+
" \"workspace_id\": workspaceId,\n",
1192+
" \"conversion\": {\n",
1193+
" \"framework\": framework,\n",
1194+
" \"python_version\": \"3.8\",\n",
1195+
" \"requirements\": []\n",
1196+
" }\n",
11791197
"}\n",
11801198
"\n",
11811199
"files = {\n",
1182-
" 'file': (model_name, open(model_file_name, 'rb'))\n",
1200+
" \"metadata\": (None, json.dumps(data), \"application/json\"),\n",
1201+
" 'file': (model_name, open('./ccfraud.onnx', 'rb'), \"application/octet-stream\")\n",
11831202
" }\n",
11841203
"\n",
11851204
"\n",
1186-
"response = requests.post(apiRequest, files=files, data=data, headers=headers).json()\n",
1187-
"display(response)"
1205+
"response = requests.post(apiRequest, files=files, headers=headers).json()"
1206+
]
1207+
},
1208+
{
1209+
"cell_type": "markdown",
1210+
"id": "861a91ae",
1211+
"metadata": {},
1212+
"source": [
1213+
"#### Upload Converted Model Examples\n",
1214+
"\n",
1215+
"The following example shows uploading a Hugging Face model to a Wallaroo instance using the `requests` library. Note that the `input_schema` and `output_schema` encoded details are required."
1216+
]
1217+
},
1218+
{
1219+
"cell_type": "code",
1220+
"execution_count": null,
1221+
"id": "c20c5ba5",
1222+
"metadata": {},
1223+
"outputs": [],
1224+
"source": [
1225+
"input_schema = pa.schema([\n",
1226+
" pa.field('inputs', pa.string()), # required\n",
1227+
" pa.field('candidate_labels', pa.list_(pa.string(), list_size=2)), # required\n",
1228+
" pa.field('hypothesis_template', pa.string()), # optional\n",
1229+
" pa.field('multi_label', pa.bool_()), # optional\n",
1230+
"])\n",
1231+
"\n",
1232+
"output_schema = pa.schema([\n",
1233+
" pa.field('sequence', pa.string()),\n",
1234+
" pa.field('scores', pa.list_(pa.float64(), list_size=2)), # same as number of candidate labels, list_size can be skipped by may result in slightly worse performance\n",
1235+
" pa.field('labels', pa.list_(pa.string(), list_size=2)), # same as number of candidate labels, list_size can be skipped by may result in slightly worse performance\n",
1236+
"])\n",
1237+
"\n",
1238+
"encoded_input_schema = base64.b64encode(\n",
1239+
" bytes(input_schema.serialize())\n",
1240+
" ).decode(\"utf8\")\n",
1241+
"\n",
1242+
"encoded_output_schema = base64.b64encode(\n",
1243+
" bytes(output_schema.serialize())\n",
1244+
" ).decode(\"utf8\")\n",
1245+
"\n",
1246+
"metadata = {\n",
1247+
" \"name\": model_name,\n",
1248+
" \"visibility\": \"private\",\n",
1249+
" \"workspace_id\": workspace_id,\n",
1250+
" \"conversion\": {\n",
1251+
" \"framework\": framework,\n",
1252+
" \"python_version\": \"3.8\",\n",
1253+
" \"requirements\": []\n",
1254+
" },\n",
1255+
" \"input_schema\": encoded_input_schema,\n",
1256+
" \"output_schema\": encoded_output_schema,\n",
1257+
"}\n",
1258+
"\n",
1259+
"headers = wl.auth.auth_header()\n",
1260+
"\n",
1261+
"files = {\n",
1262+
" 'metadata': (None, json.dumps(metadata), \"application/json\"),\n",
1263+
" 'file': (model_name, open(model_path,'rb'),'application/octet-stream')\n",
1264+
"}\n",
1265+
"\n",
1266+
"response = requests.post('https://{APIURL}/v1/api/models/upload_and_convert', \n",
1267+
" headers=headers, \n",
1268+
" files=files).json()"
11881269
]
11891270
},
11901271
{

development/sdk-install-guides/azure-ml-sdk-install/install-wallaroo-sdk-azureml-guide.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
" * **IMPORTANT NOTE**: The version of the Wallaroo SDK should match the Wallaroo instance. For example, this example connects to a Wallaroo Enterprise version `2023.1` instance, so the SDK version should be `wallaroo==2023.1.0`.\n",
101101
"\n",
102102
" ```bash\n",
103-
" pip install wallaroo==2023.2.0\n",
103+
" pip install wallaroo==2023.2.1rc2\n",
104104
" ```"
105105
]
106106
},

development/sdk-install-guides/google-vertex-sdk-install/install-wallaroo-sdk-google-vertex-guide.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
" * **IMPORTANT NOTE**: The version of the Wallaroo SDK should match the Wallaroo instance. For example, this example connects to a Wallaroo Enterprise version `2023.1` instance, so the SDK version should be `wallaroo==2023.1.0`.\n",
9696
"\n",
9797
" ```bash\n",
98-
" pip install wallaroo==2023.2.0\n",
98+
" pip install wallaroo==2023.2.1rc2\n",
9999
" ```"
100100
]
101101
},

development/sdk-install-guides/standard-install/install-wallaroo-sdk-standard-guide.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
" * **IMPORTANT NOTE**: The version of the Wallaroo SDK should match the Wallaroo instance. For example, this example connects to a Wallaroo Enterprise version `2023.1` instance, so the SDK version should be `wallaroo==2023.1.0`.\n",
9696
"\n",
9797
" ```bash\n",
98-
" pip install wallaroo==2023.2.0\n",
98+
" pip install wallaroo==2023.2.1rc2\n",
9999
" ```"
100100
]
101101
},

0 commit comments

Comments
 (0)