File tree Expand file tree Collapse file tree 2 files changed +33
-5
lines changed
preprocessing/tabular_data Expand file tree Collapse file tree 2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 46
46
" import subprocess\n " ,
47
47
" import pkg_resources\n " ,
48
48
" \n " ,
49
+ " def get_sagemaker_version():\n " ,
50
+ " \" Return the version of 'sagemaker' in your kernel or -1 if 'sagemaker' is not installed\"\n " ,
51
+ " for i in pkg_resources.working_set:\n " ,
52
+ " if i.key == \" sagemaker\" :\n " ,
53
+ " return \" %s==%s\" % (i.key, i.version)\n " ,
54
+ " return -1\n " ,
55
+ " \n " ,
56
+ " # Store original 'sagemaker' version\n " ,
57
+ " sagemaker_version = get_sagemaker_version()\n " ,
58
+ " \n " ,
49
59
" # Install any missing dependencies\n " ,
50
- " !{sys.executable} -m pip install -qU 'matplotlib' 'numpy' 'pandas' ' plotly' 'sagemaker>=2.0.0' 'sklearn '\n " ,
60
+ " !{sys.executable} -m pip install -qU 'plotly' 'sagemaker>=2.0.0'\n " ,
51
61
" \n " ,
52
62
" import numpy as np\n " ,
53
63
" import pandas as pd\n " ,
239
249
" %store Y_train\n " ,
240
250
" %store Y_test\n " ,
241
251
" %store Y_val\n " ,
242
- " %store choosen_data_set"
252
+ " %store choosen_data_set\n " ,
253
+ " %store sagemaker_version"
243
254
]
244
255
}
245
256
],
246
257
"metadata" : {
247
- "instance_type" : " ml.t3.medium" ,
248
258
"kernelspec" : {
249
259
"display_name" : " Python 3 (Data Science)" ,
250
260
"language" : " python" ,
Original file line number Diff line number Diff line change 44
44
"outputs" : [],
45
45
"source" : [
46
46
" import os\n " ,
47
+ " import sys\n " ,
47
48
" import plotly.express as px\n " ,
48
49
" import plotly.offline as pyo\n " ,
49
50
" import plotly.graph_objs as go\n " ,
92
93
" %store -r Y_train\n " ,
93
94
" %store -r Y_test\n " ,
94
95
" %store -r Y_val\n " ,
95
- " %store -r choosen_data_set"
96
+ " %store -r choosen_data_set\n " ,
97
+ " %store -r sagemaker_version"
96
98
]
97
99
},
98
100
{
269
271
"source" : [
270
272
" sagemaker.s3.S3Downloader.download(s3_uri=list_of_trained_models[-1], local_path='./')"
271
273
]
274
+ },
275
+ {
276
+ "cell_type" : " markdown" ,
277
+ "metadata" : {},
278
+ "source" : [
279
+ " Below we safe guard your kernel environment by installing your original sagemaker version."
280
+ ]
281
+ },
282
+ {
283
+ "cell_type" : " code" ,
284
+ "execution_count" : null ,
285
+ "metadata" : {},
286
+ "outputs" : [],
287
+ "source" : [
288
+ " if not sagemaker_version is None:\n " ,
289
+ " !{sys.executable} -m pip install -qU sagemaker_version"
290
+ ]
272
291
}
273
292
],
274
293
"metadata" : {
275
- "instance_type" : " ml.t3.medium" ,
276
294
"kernelspec" : {
277
295
"display_name" : " Python 3 (Data Science)" ,
278
296
"language" : " python" ,
You can’t perform that action at this time.
0 commit comments