Skip to content

Commit f30b679

Browse files
Using unique prefix accross notebooks: prefix = cv-sagemaker-immersionday
1 parent f349826 commit f30b679

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

01_preprocessing/data_preprocessing.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"role = sagemaker.get_execution_role()\n",
9393
"\n",
9494
"default_bucket = sagemaker_session.default_bucket() # or use your own custom bucket name\n",
95-
"base_job_prefix = \"preprocess\" # or define your own prefix"
95+
"base_job_prefix = \"cv-sagemaker-immersionday\" # or define your own prefix"
9696
]
9797
},
9898
{

02_training/training.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"account = sagemaker_session.account_id()\n",
3232
"region = sagemaker_session.boto_region_name\n",
3333
"default_bucket = sagemaker_session.default_bucket() # or use your own custom bucket name\n",
34-
"prefix = 'postprocessing'"
34+
"prefix = 'cv-sagemaker-immersionday'"
3535
]
3636
},
3737
{
@@ -40,7 +40,7 @@
4040
"metadata": {},
4141
"outputs": [],
4242
"source": [
43-
"processed_data_prefix = f'preprocess/outputs' #prefix generated by data processing module\n",
43+
"processed_data_prefix = f'{prefix}/outputs' #prefix generated by data processing module\n",
4444
"processed_data_s3_uri = f's3://{default_bucket}/{processed_data_prefix}'"
4545
]
4646
},
25 KB
Loading

03_model_evaluation/model-evaluation-processing-job.ipynb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"account = sess.account_id()\n",
7474
"region = sess.boto_region_name\n",
7575
"bucket = sess.default_bucket() # or use your own custom bucket name\n",
76-
"prefix = 'postprocessing'"
76+
"prefix = 'cv-sagemaker-immersionday'"
7777
]
7878
},
7979
{
@@ -97,10 +97,10 @@
9797
"outputs": [],
9898
"source": [
9999
"s3_client = boto3.client('s3')\n",
100-
"model_dir = s3_client.list_objects_v2(Bucket=bucket, Delimiter='/', Prefix=f'{prefix}/')['CommonPrefixes'][-1]['Prefix']\n",
100+
"model_dir = s3_client.list_objects_v2(Bucket=bucket, Delimiter='/', Prefix=f'{prefix}/{prefix}')['CommonPrefixes'][-1]['Prefix']\n",
101101
"\n",
102-
"s3_images = f's3://{bucket}/preprocess/outputs/test/'\n",
103-
"s3_manifest = f's3://{bucket}/preprocess/outputs/manifest'\n",
102+
"s3_images = f's3://{bucket}/{prefix}/outputs/test/'\n",
103+
"s3_manifest = f's3://{bucket}/{prefix}/outputs/manifest'\n",
104104
"s3_model = f's3://{bucket}/{model_dir}output'\n",
105105
"\n",
106106
"print(f's3_images: {s3_images},\\n s3_manifest: {s3_manifest},\\n s3_model: {s3_model}')"
@@ -345,6 +345,13 @@
345345
"source": [
346346
"![confusion_matrix.png](./confusion_matrix.png)"
347347
]
348+
},
349+
{
350+
"cell_type": "code",
351+
"execution_count": null,
352+
"metadata": {},
353+
"outputs": [],
354+
"source": []
348355
}
349356
],
350357
"metadata": {

05_deployment/sagemaker-deploy-model-for-inference.ipynb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181
"\n",
8282
"# Feel free to specify different bucket/folders here if you wish.\n",
8383
"bucket = sess.default_bucket()\n",
84-
"prefix = \"preprocess\"\n",
85-
"model_prefix = 'postprocessing-model-evaluation'\n",
84+
"prefix = 'cv-sagemaker-immersionday'\n",
85+
"\n",
8686
"\n",
8787
"TF_FRAMEWORK_VERSION = '2.4.1'\n",
8888
"ENDPOINT_INSTANCE_TYPE = 'ml.c5.4xlarge'"
@@ -113,8 +113,8 @@
113113
"source": [
114114
"# Get S3 URI of the model artifact\n",
115115
"s3_client = boto3.client('s3')\n",
116-
"postproc_dir = s3_client.list_objects_v2(Bucket=bucket, Delimiter='/', Prefix=f'{model_prefix}/')['CommonPrefixes'][-1]['Prefix']\n",
117-
"bird_model_path = f's3://{bucket}/{postproc_dir}output/model.tar.gz'\n",
116+
"model_dir = s3_client.list_objects_v2(Bucket=bucket, Delimiter='/', Prefix=f'{prefix}/{prefix}')['CommonPrefixes'][-1]['Prefix']\n",
117+
"bird_model_path = f's3://{bucket}/{model_dir}output/model.tar.gz'\n",
118118
"print(f'bird_model_path: {bird_model_path}')"
119119
]
120120
},
@@ -275,7 +275,7 @@
275275
"\n",
276276
"#Update the below variable with your endpoint name from previous cell output\n",
277277
"#tf_endpoint_name='<SAGEMAKER DEPLOYED ENDPOINT NAME>'\n",
278-
"tf_endpoint_name = 'tensorflow-inference-2022-11-02-13-39-59-198'\n",
278+
"tf_endpoint_name = 'tensorflow-inference-2022-11-03-12-22-07-444'\n",
279279
"\n",
280280
"serializer = IdentitySerializer(content_type=\"application/x-image\")\n",
281281
"deserializer = JSONDeserializer(accept='application/json')\n",
@@ -321,10 +321,8 @@
321321
"metadata": {},
322322
"outputs": [],
323323
"source": [
324-
"outputs_dir = s3_client.list_objects_v2(Bucket=bucket, Delimiter='/', Prefix=f'{prefix}/outputs/')['CommonPrefixes'][0]['Prefix']\n",
325-
"sample_images_uri = f'{outputs_dir}test'\n",
324+
"sample_images = cv_utils.get_n_random_images(bucket,prefix=f'{prefix}/outputs/test',n=2)\n",
326325
"\n",
327-
"sample_images = cv_utils.get_n_random_images(bucket,prefix=sample_images_uri,n=2)\n",
328326
"local_paths = cv_utils.download_images_locally(bucket,sample_images)\n",
329327
"print(local_paths)"
330328
]

0 commit comments

Comments
 (0)