Julien Simon
commited on
Commit
•
7086631
1
Parent(s):
7157500
Update version numbers
Browse files
code/Sentiment analysis with Hugging Face and SageMaker.ipynb
CHANGED
@@ -26,17 +26,8 @@
|
|
26 |
},
|
27 |
"outputs": [],
|
28 |
"source": [
|
29 |
-
"
|
30 |
-
|
31 |
-
},
|
32 |
-
{
|
33 |
-
"cell_type": "code",
|
34 |
-
"execution_count": null,
|
35 |
-
"metadata": {},
|
36 |
-
"outputs": [],
|
37 |
-
"source": [
|
38 |
-
"!curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash\n",
|
39 |
-
"!apt-get install git-lfs"
|
40 |
]
|
41 |
},
|
42 |
{
|
@@ -303,15 +294,15 @@
|
|
303 |
" entry_point='train.py',\n",
|
304 |
" hyperparameters=hyperparameters,\n",
|
305 |
" # Infrastructure\n",
|
306 |
-
" transformers_version='4.
|
307 |
-
" pytorch_version='1.
|
308 |
-
" py_version='
|
309 |
" instance_type='ml.p3.2xlarge', # 1 GPUs, $4.131/hour in eu-west-1\n",
|
310 |
" instance_count=1,\n",
|
311 |
" # Enable spot instances\n",
|
312 |
-
" use_spot_instances=True, # 70% discount is typical\n",
|
313 |
-
" max_run = 3600,\n",
|
314 |
-
" max_wait = 7200\n",
|
315 |
")"
|
316 |
]
|
317 |
},
|
@@ -535,11 +526,18 @@
|
|
535 |
"huggingface_model = HuggingFaceModel(\n",
|
536 |
" env=hub, \n",
|
537 |
" role=sagemaker.get_execution_role(), \n",
|
538 |
-
" transformers_version='4.
|
539 |
-
" pytorch_version='1.
|
540 |
-
" py_version='
|
541 |
-
")
|
542 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
543 |
"huggingface_predictor = huggingface_model.deploy(\n",
|
544 |
" initial_instance_count=1,\n",
|
545 |
" instance_type='ml.m5.xlarge'\n",
|
@@ -580,9 +578,9 @@
|
|
580 |
"metadata": {
|
581 |
"instance_type": "ml.m5.4xlarge",
|
582 |
"kernelspec": {
|
583 |
-
"display_name": "Python 3 (
|
584 |
"language": "python",
|
585 |
-
"name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:
|
586 |
},
|
587 |
"language_info": {
|
588 |
"codemirror_mode": {
|
@@ -594,7 +592,7 @@
|
|
594 |
"name": "python",
|
595 |
"nbconvert_exporter": "python",
|
596 |
"pygments_lexer": "ipython3",
|
597 |
-
"version": "3.
|
598 |
}
|
599 |
},
|
600 |
"nbformat": 4,
|
|
|
26 |
},
|
27 |
"outputs": [],
|
28 |
"source": [
|
29 |
+
"%%sh\n",
|
30 |
+
"pip -q install torch transformers datasets widgetsnbextension ipywidgets huggingface_hub sacremoses==0.0.49"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
]
|
32 |
},
|
33 |
{
|
|
|
294 |
" entry_point='train.py',\n",
|
295 |
" hyperparameters=hyperparameters,\n",
|
296 |
" # Infrastructure\n",
|
297 |
+
" transformers_version='4.10',\n",
|
298 |
+
" pytorch_version='1.9',\n",
|
299 |
+
" py_version='py38',\n",
|
300 |
" instance_type='ml.p3.2xlarge', # 1 GPUs, $4.131/hour in eu-west-1\n",
|
301 |
" instance_count=1,\n",
|
302 |
" # Enable spot instances\n",
|
303 |
+
" #use_spot_instances=True, # 70% discount is typical\n",
|
304 |
+
" #max_run = 3600,\n",
|
305 |
+
" #max_wait = 7200\n",
|
306 |
")"
|
307 |
]
|
308 |
},
|
|
|
526 |
"huggingface_model = HuggingFaceModel(\n",
|
527 |
" env=hub, \n",
|
528 |
" role=sagemaker.get_execution_role(), \n",
|
529 |
+
" transformers_version='4.10', \n",
|
530 |
+
" pytorch_version='1.9', \n",
|
531 |
+
" py_version='py38' \n",
|
532 |
+
")"
|
533 |
+
]
|
534 |
+
},
|
535 |
+
{
|
536 |
+
"cell_type": "code",
|
537 |
+
"execution_count": null,
|
538 |
+
"metadata": {},
|
539 |
+
"outputs": [],
|
540 |
+
"source": [
|
541 |
"huggingface_predictor = huggingface_model.deploy(\n",
|
542 |
" initial_instance_count=1,\n",
|
543 |
" instance_type='ml.m5.xlarge'\n",
|
|
|
578 |
"metadata": {
|
579 |
"instance_type": "ml.m5.4xlarge",
|
580 |
"kernelspec": {
|
581 |
+
"display_name": "Python 3 (Data Science)",
|
582 |
"language": "python",
|
583 |
+
"name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-west-2:236514542706:image/datascience-1.0"
|
584 |
},
|
585 |
"language_info": {
|
586 |
"codemirror_mode": {
|
|
|
592 |
"name": "python",
|
593 |
"nbconvert_exporter": "python",
|
594 |
"pygments_lexer": "ipython3",
|
595 |
+
"version": "3.7.10"
|
596 |
}
|
597 |
},
|
598 |
"nbformat": 4,
|