Skip to content

Commit d8e1060

Browse files
authored
Merge pull request aws#40 from awslabs/xgboost-updates
removing references to auto-scaling
2 parents d9133bc + 308113d commit d8e1060

File tree

4 files changed

+169
-59
lines changed

4 files changed

+169
-59
lines changed

advanced_functionality/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Example Notebooks include:
77
- *install_r_kernel*: A quick introduction to getting R installed and running within Amazon SageMaker Notebook Instances.
88
- *kmeans_bring_your_own_model*: How to use Amazon SageMaker Algorithms containers to bring a pre-trained model to a realtime hosted endpoint without ever needing to think about REST APIs.
99
- *r_bring_your_own*: How to containerize an R algorithm using Docker and plumber for hosting so that it can be used in Amazon SageMaker's managed training and realtime hosting.
10+
- *xgboost_bring_your_own_model*: How to use Amazon SageMaker Algorithms containers to bring a pre-trained model to a realtime hosted endpoint without ever needing to think about REST APIs.

advanced_functionality/xgboost_bring_your_own_model/xgboost_bring_your_own_model.ipynb

Lines changed: 60 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"---\n",
2727
"## Background\n",
2828
"\n",
29-
"Amazon SageMaker includes functionality to support a hosted notebook environment, distributed, serverless training, and real-time, autoscaling hosting. We think it works best when all three of these services are used together, but they can also be used independently. Some use cases may only require hosting. Maybe the model was trained prior to Amazon SageMaker existing, in a different service.\n",
29+
"Amazon SageMaker includes functionality to support a hosted notebook environment, distributed, serverless training, and real-time hosting. We think it works best when all three of these services are used together, but they can also be used independently. Some use cases may only require hosting. Maybe the model was trained prior to Amazon SageMaker existing, in a different service.\n",
3030
"\n",
3131
"This notebook shows how to use a pre-existing scikit-learn model with the Amazon SageMaker XGBoost Algorithm container to quickly create a hosted endpoint for that model.\n",
3232
"\n",
@@ -44,6 +44,7 @@
4444
"cell_type": "code",
4545
"execution_count": null,
4646
"metadata": {
47+
"collapsed": true,
4748
"isConfigCell": true
4849
},
4950
"outputs": [],
@@ -80,7 +81,9 @@
8081
{
8182
"cell_type": "code",
8283
"execution_count": null,
83-
"metadata": {},
84+
"metadata": {
85+
"collapsed": true
86+
},
8487
"outputs": [],
8588
"source": [
8689
"!conda install -y -c conda-forge xgboost scikit-learn"
@@ -96,7 +99,9 @@
9699
{
97100
"cell_type": "code",
98101
"execution_count": null,
99-
"metadata": {},
102+
"metadata": {
103+
"collapsed": true
104+
},
100105
"outputs": [],
101106
"source": [
102107
"%%time\n",
@@ -119,7 +124,9 @@
119124
{
120125
"cell_type": "code",
121126
"execution_count": null,
122-
"metadata": {},
127+
"metadata": {
128+
"collapsed": true
129+
},
123130
"outputs": [],
124131
"source": [
125132
"%%time\n",
@@ -140,7 +147,9 @@
140147
{
141148
"cell_type": "code",
142149
"execution_count": null,
143-
"metadata": {},
150+
"metadata": {
151+
"collapsed": true
152+
},
144153
"outputs": [],
145154
"source": [
146155
"train_set, valid_set, test_set = get_dataset()\n",
@@ -165,7 +174,9 @@
165174
{
166175
"cell_type": "code",
167176
"execution_count": null,
168-
"metadata": {},
177+
"metadata": {
178+
"collapsed": true
179+
},
169180
"outputs": [],
170181
"source": [
171182
"import xgboost as xgb\n",
@@ -191,7 +202,9 @@
191202
{
192203
"cell_type": "code",
193204
"execution_count": null,
194-
"metadata": {},
205+
"metadata": {
206+
"collapsed": true
207+
},
195208
"outputs": [],
196209
"source": [
197210
"model_file_name = \"locally-trained-xgboost-model\"\n",
@@ -201,7 +214,9 @@
201214
{
202215
"cell_type": "code",
203216
"execution_count": null,
204-
"metadata": {},
217+
"metadata": {
218+
"collapsed": true
219+
},
205220
"outputs": [],
206221
"source": [
207222
"!tar czvf model.tar.gz $model_file_name"
@@ -217,7 +232,9 @@
217232
{
218233
"cell_type": "code",
219234
"execution_count": null,
220-
"metadata": {},
235+
"metadata": {
236+
"collapsed": true
237+
},
221238
"outputs": [],
222239
"source": [
223240
"fObj = open(\"model.tar.gz\", 'rb')\n",
@@ -238,7 +255,9 @@
238255
{
239256
"cell_type": "code",
240257
"execution_count": null,
241-
"metadata": {},
258+
"metadata": {
259+
"collapsed": true
260+
},
242261
"outputs": [],
243262
"source": [
244263
"containers = {'us-west-2': '433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest',\n",
@@ -251,7 +270,9 @@
251270
{
252271
"cell_type": "code",
253272
"execution_count": null,
254-
"metadata": {},
273+
"metadata": {
274+
"collapsed": true
275+
},
255276
"outputs": [],
256277
"source": [
257278
"%%time\n",
@@ -282,13 +303,15 @@
282303
"source": [
283304
"### Create endpoint configuration\n",
284305
"\n",
285-
"SageMaker supports configuring REST endpoints in hosting with multiple models, e.g. for A/B testing purposes. In order to support this, you can create an endpoint configuration, that describes the distribution of traffic across the models, whether split, shadowed, or sampled in some way. In addition, the endpoint configuration describes the instance type required for model deployment and the autoscaling configuration."
306+
"SageMaker supports configuring REST endpoints in hosting with multiple models, e.g. for A/B testing purposes. In order to support this, you can create an endpoint configuration, that describes the distribution of traffic across the models, whether split, shadowed, or sampled in some way. In addition, the endpoint configuration describes the instance type required for model deployment."
286307
]
287308
},
288309
{
289310
"cell_type": "code",
290311
"execution_count": null,
291-
"metadata": {},
312+
"metadata": {
313+
"collapsed": true
314+
},
292315
"outputs": [],
293316
"source": [
294317
"from time import gmtime, strftime\n",
@@ -318,7 +341,9 @@
318341
{
319342
"cell_type": "code",
320343
"execution_count": null,
321-
"metadata": {},
344+
"metadata": {
345+
"collapsed": true
346+
},
322347
"outputs": [],
323348
"source": [
324349
"%%time\n",
@@ -356,7 +381,9 @@
356381
{
357382
"cell_type": "code",
358383
"execution_count": null,
359-
"metadata": {},
384+
"metadata": {
385+
"collapsed": true
386+
},
360387
"outputs": [],
361388
"source": [
362389
"runtime_client = boto3.client('sagemaker-runtime')"
@@ -372,7 +399,9 @@
372399
{
373400
"cell_type": "code",
374401
"execution_count": null,
375-
"metadata": {},
402+
"metadata": {
403+
"collapsed": true
404+
},
376405
"outputs": [],
377406
"source": [
378407
"import numpy as np\n",
@@ -384,7 +413,9 @@
384413
{
385414
"cell_type": "code",
386415
"execution_count": null,
387-
"metadata": {},
416+
"metadata": {
417+
"collapsed": true
418+
},
388419
"outputs": [],
389420
"source": [
390421
"%%time\n",
@@ -414,7 +445,9 @@
414445
{
415446
"cell_type": "code",
416447
"execution_count": null,
417-
"metadata": {},
448+
"metadata": {
449+
"collapsed": true
450+
},
418451
"outputs": [],
419452
"source": [
420453
"arr = result[1:len(result)-1].split(',')\n",
@@ -435,30 +468,33 @@
435468
{
436469
"cell_type": "code",
437470
"execution_count": null,
438-
"metadata": {},
471+
"metadata": {
472+
"collapsed": true
473+
},
439474
"outputs": [],
440475
"source": [
441476
"# sm_client.delete_endpoint(EndpointName=endpoint_name)"
442477
]
443478
}
444479
],
445480
"metadata": {
481+
"anaconda-cloud": {},
446482
"kernelspec": {
447-
"display_name": "Environment (conda_python3)",
483+
"display_name": "Python [conda root]",
448484
"language": "python",
449-
"name": "conda_python3"
485+
"name": "conda-root-py"
450486
},
451487
"language_info": {
452488
"codemirror_mode": {
453489
"name": "ipython",
454-
"version": 3
490+
"version": 2
455491
},
456492
"file_extension": ".py",
457493
"mimetype": "text/x-python",
458494
"name": "python",
459495
"nbconvert_exporter": "python",
460-
"pygments_lexer": "ipython3",
461-
"version": "3.6.3"
496+
"pygments_lexer": "ipython2",
497+
"version": "2.7.12"
462498
},
463499
"notice": "Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with the License. A copy of the License is located at http://aws.amazon.com/apache2.0/ or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."
464500
},

0 commit comments

Comments
 (0)