Skip to content

Commit 720198b

Browse files
authored
Changing the model_version for the text generation notebooks (#4472)
* notebooks1 * notebooks2 * notebooks3
1 parent e6c9ffc commit 720198b

16 files changed

+66
-59
lines changed

introduction_to_amazon_algorithms/jumpstart-foundation-models/bloom-z-176b-few-shot-and-zero-shot-learning.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
"source": [
179179
"model_id, model_version, = (\n",
180180
" \"huggingface-textgeneration1-bloomz-176b-fp16\",\n",
181-
" \"*\",\n",
181+
" \"1.*\",\n",
182182
")"
183183
]
184184
},
@@ -265,7 +265,7 @@
265265
"outputs": [],
266266
"source": [
267267
"# model_version=\"*\" fetches the latest version of the model\n",
268-
"model_id, model_version = model_dropdown.value, \"*\""
268+
"model_id, model_version = model_dropdown.value, \"1.*\""
269269
]
270270
},
271271
{

introduction_to_amazon_algorithms/jumpstart-foundation-models/domain-adaption-finetuning-gpt-j-6b.ipynb

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
{
1212
"attachments": {},
1313
"cell_type": "markdown",
14+
"id": "496fab09",
1415
"metadata": {},
1516
"source": [
1617
"---\n",
@@ -120,7 +121,7 @@
120121
"metadata": {},
121122
"outputs": [],
122123
"source": [
123-
"model_id, model_version = \"huggingface-textgeneration1-gpt-j-6b\", \"*\""
124+
"model_id, model_version = \"huggingface-textgeneration1-gpt-j-6b\", \"1.*\""
124125
]
125126
},
126127
{
@@ -317,24 +318,24 @@
317318
"---\n",
318319
"```\n",
319320
"This report includes estimates, projections, statements relating to our\n",
320-
"business plans, objectives, and expected operating results that are \u201cforward-\n",
321-
"looking statements\u201d within the meaning of the Private Securities Litigation\n",
321+
"business plans, objectives, and expected operating results that are “forward-\n",
322+
"looking statements within the meaning of the Private Securities Litigation\n",
322323
"Reform Act of 1995, Section 27A of the Securities Act of 1933, and Section 21E\n",
323324
"of the Securities Exchange Act of 1934. Forward-looking statements may appear\n",
324-
"throughout this report, including the following sections: \u201cBusiness\u201d (Part I,\n",
325-
"Item 1 of this Form 10-K), \u201cRisk Factors\u201d (Part I, Item 1A of this Form 10-K),\n",
326-
"and \u201cManagement\u2019s Discussion and Analysis of Financial Condition and Results\n",
327-
"of Operations\u201d (Part II, Item 7 of this Form 10-K). These forward-looking\n",
328-
"statements generally are identified by the words \u201cbelieve,\u201d \u201cproject,\u201d\n",
329-
"\u201cexpect,\u201d \u201canticipate,\u201d \u201cestimate,\u201d \u201cintend,\u201d \u201cstrategy,\u201d \u201cfuture,\u201d\n",
330-
"\u201copportunity,\u201d \u201cplan,\u201d \u201cmay,\u201d \u201cshould,\u201d \u201cwill,\u201d \u201cwould,\u201d \u201cwill be,\u201d \u201cwill\n",
331-
"continue,\u201d \u201cwill likely result,\u201d and similar expressions. Forward-looking\n",
325+
"throughout this report, including the following sections: “Business” (Part I,\n",
326+
"Item 1 of this Form 10-K), “Risk Factors (Part I, Item 1A of this Form 10-K),\n",
327+
"and “Management’s Discussion and Analysis of Financial Condition and Results\n",
328+
"of Operations (Part II, Item 7 of this Form 10-K). These forward-looking\n",
329+
"statements generally are identified by the words “believe,” “project,”\n",
330+
"“expect,” “anticipate,” “estimate,” “intend,” “strategy,” “future,”\n",
331+
"“opportunity,” “plan,” “may,” “should,” “will,” “would,” “will be,” “will\n",
332+
"continue,” “will likely result, and similar expressions. Forward-looking\n",
332333
"statements are based on current expectations and assumptions that are subject\n",
333334
"to risks and uncertainties that may cause actual results to differ materially.\n",
334335
"We describe risks and uncertainties that could cause actual results and events\n",
335-
"to differ materially in \u201cRisk Factors,\u201d \u201cManagement\u2019s Discussion and Analysis\n",
336-
"of Financial Condition and Results of Operations,\u201d and \u201cQuantitative and\n",
337-
"Qualitative Disclosures about Market Risk\u201d (Part II, Item 7A of this Form\n",
336+
"to differ materially in “Risk Factors,” “Management’s Discussion and Analysis\n",
337+
"of Financial Condition and Results of Operations, and “Quantitative and\n",
338+
"Qualitative Disclosures about Market Risk (Part II, Item 7A of this Form\n",
338339
"10-K). Readers are cautioned not to place undue reliance on forward-looking\n",
339340
"statements, which speak only as of the date they are made. We undertake no\n",
340341
"obligation to update or revise publicly any forward-looking statements,\n",
@@ -762,6 +763,7 @@
762763
{
763764
"attachments": {},
764765
"cell_type": "markdown",
766+
"id": "5eb59a9c",
765767
"metadata": {},
766768
"source": [
767769
"## Notebook CI Test Results\n",
@@ -821,4 +823,4 @@
821823
},
822824
"nbformat": 4,
823825
"nbformat_minor": 5
824-
}
826+
}

introduction_to_amazon_algorithms/jumpstart-foundation-models/instruction-fine-tuning-flan-t5.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"from sagemaker.jumpstart.model import JumpStartModel\n",
125125
"\n",
126126
"# Replace with larger model if needed\n",
127-
"model_id, model_version = \"huggingface-text2text-flan-t5-base\", \"*\"\n",
127+
"model_id, model_version = \"huggingface-text2text-flan-t5-base\", \"1.*\"\n",
128128
"pretrained_model = JumpStartModel(model_id=model_id)\n",
129129
"pretrained_predictor = pretrained_model.deploy()"
130130
]

introduction_to_amazon_algorithms/jumpstart-foundation-models/llama-2-chat-completion.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"source": [
112112
"from sagemaker.jumpstart.model import JumpStartModel\n",
113113
"\n",
114-
"model = JumpStartModel(model_id=model_id)\n",
114+
"model = JumpStartModel(model_id=model_id, model_version=model_version)\n",
115115
"predictor = model.deploy()"
116116
]
117117
},

introduction_to_amazon_algorithms/jumpstart-foundation-models/llama-2-finetuning.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
},
120120
"outputs": [],
121121
"source": [
122-
"model_id, model_version = \"meta-textgeneration-llama-2-7b\", \"*\""
122+
"model_id, model_version = \"meta-textgeneration-llama-2-7b\", \"2.*\""
123123
]
124124
},
125125
{
@@ -133,7 +133,7 @@
133133
"source": [
134134
"from sagemaker.jumpstart.model import JumpStartModel\n",
135135
"\n",
136-
"pretrained_model = JumpStartModel(model_id=model_id)\n",
136+
"pretrained_model = JumpStartModel(model_id=model_id, model_version=model_version)\n",
137137
"pretrained_predictor = pretrained_model.deploy()"
138138
]
139139
},
@@ -358,6 +358,7 @@
358358
"\n",
359359
"estimator = JumpStartEstimator(\n",
360360
" model_id=model_id,\n",
361+
" model_version=model_version,\n",
361362
" environment={\"accept_eula\": \"true\"},\n",
362363
" disable_output_compression=True, # For Llama-2-70b, add instance_type = \"ml.g5.48xlarge\"\n",
363364
")\n",

introduction_to_amazon_algorithms/jumpstart-foundation-models/llama-2-text-completion.ipynb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,9 @@
8484
},
8585
"outputs": [],
8686
"source": [
87-
"(\n",
88-
" model_id,\n",
89-
" model_version,\n",
90-
") = (\n",
87+
"(model_id, model_version,) = (\n",
9188
" \"meta-textgeneration-llama-2-7b\",\n",
92-
" \"*\",\n",
89+
" \"2.*\",\n",
9390
")"
9491
]
9592
},
@@ -116,7 +113,7 @@
116113
"source": [
117114
"from sagemaker.jumpstart.model import JumpStartModel\n",
118115
"\n",
119-
"model = JumpStartModel(model_id=model_id)\n",
116+
"model = JumpStartModel(model_id=model_id, model_version=model_version)\n",
120117
"predictor = model.deploy()"
121118
]
122119
},

introduction_to_amazon_algorithms/jumpstart-foundation-models/question_answering_retrieval_augmented_generation/question_answering_jumpstart_knn.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"aws_role = sagemaker_session.get_caller_identity_arn()\n",
7878
"aws_region = boto3.Session().region_name\n",
7979
"sess = sagemaker.Session()\n",
80-
"model_version = \"*\""
80+
"model_version = \"1.*\""
8181
]
8282
},
8383
{
@@ -327,7 +327,7 @@
327327
"metadata": {},
328328
"outputs": [],
329329
"source": [
330-
"model_id, model_version = \"huggingface-textembedding-gpt-j-6b\", \"*\"\n",
330+
"model_id, model_version = \"huggingface-textembedding-gpt-j-6b\", \"1.*\"\n",
331331
"\n",
332332
"endpoint_name_embed = name_from_base(f\"jumpstart-example-ragknn-{model_id}\")\n",
333333
"\n",

introduction_to_amazon_algorithms/jumpstart-foundation-models/question_answering_retrieval_augmented_generation/question_answering_langchain_jumpstart.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"aws_role = sagemaker_session.get_caller_identity_arn()\n",
8686
"aws_region = boto3.Session().region_name\n",
8787
"sess = sagemaker.Session()\n",
88-
"model_version = \"*\""
88+
"model_version = \"1.*\""
8989
]
9090
},
9191
{

introduction_to_amazon_algorithms/jumpstart-foundation-models/text-generation-chatbot.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@
203203
"from sagemaker.predictor import Predictor\n",
204204
"\n",
205205
"\n",
206-
"model = JumpStartModel(model_id=model_config.model_id, **model_config.model_kwargs)\n",
206+
"model = JumpStartModel(\n",
207+
" model_id=model_config.model_id, model_version=\"1.*\", **model_config.model_kwargs\n",
208+
")\n",
207209
"predictor = model.deploy()"
208210
]
209211
},

introduction_to_amazon_algorithms/jumpstart-foundation-models/text-generation-few-shot-learning.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
"source": [
168168
"model_id, model_version, = (\n",
169169
" \"huggingface-textgeneration1-gpt-j-6b\",\n",
170-
" \"*\",\n",
170+
" \"1.*\",\n",
171171
")"
172172
]
173173
},
@@ -239,7 +239,7 @@
239239
"outputs": [],
240240
"source": [
241241
"# model_version=\"*\" fetches the latest version of the model\n",
242-
"model_id, model_version = model_dropdown.value, \"*\""
242+
"model_id, model_version = model_dropdown.value, \"1.*\""
243243
]
244244
},
245245
{
@@ -524,7 +524,7 @@
524524
" \"\"\"[Original]: Amazon scientists, in collaboration with researchers from the University of Sheffield, are making a large-scale fact extraction and verification dataset publicly available for the first time. The dataset, comprising more than 185,000 evidence-backed claims, is being made available to hopefully catalyze research and development that addresses the problems of fact extraction and verification in software applications or cloud-based services that perform automatic information extraction.\n",
525525
" [Summary]: Amazon and University researchers make fact extraction and verification dataset publicly available.\n",
526526
" ###\n",
527-
" [Original]: Prime members in the U.S. can get even more delivered to their door with a Prime membership. Members can now enjoy one year of Grubhub+ valued at $9.99 per month for free\u2014at no added cost to their Prime membership. To activate this deal, visit amazon.com/grubhub. This new offer includes unlimited, $0 food delivery fees on orders over $12 as well as exclusive perks for Grubhub+ members and rewards like free food and order discounts. Plus, diners can \u201ceat good while doing good\u201d by opting into Grubhub\u2019s Donate the Change program, a donation-matching initiative that raised more than $25 million in 2021 alone, benefiting more than 20 charitable organizations across the country.\n",
527+
" [Original]: Prime members in the U.S. can get even more delivered to their door with a Prime membership. Members can now enjoy one year of Grubhub+ valued at $9.99 per month for free—at no added cost to their Prime membership. To activate this deal, visit amazon.com/grubhub. This new offer includes unlimited, $0 food delivery fees on orders over $12 as well as exclusive perks for Grubhub+ members and rewards like free food and order discounts. Plus, diners can “eat good while doing good by opting into Grubhub’s Donate the Change program, a donation-matching initiative that raised more than $25 million in 2021 alone, benefiting more than 20 charitable organizations across the country.\n",
528528
" [Summary]: Prime members in the U.S. can enjoy one year of Grubhub+ for free, with no food-delivery fees on eligible orders.\n",
529529
" ###\n",
530530
" [Original]: {text}\n",
@@ -695,7 +695,7 @@
695695
},
696696
"outputs": [],
697697
"source": [
698-
"sentence = \"David Melvin is an investment and financial services professional at CITIC CLSA with over 30 years\u2019 experience in investment banking and private equity. He is currently a Senior Adviser of CITIC CLSA.\""
698+
"sentence = \"David Melvin is an investment and financial services professional at CITIC CLSA with over 30 years experience in investment banking and private equity. He is currently a Senior Adviser of CITIC CLSA.\""
699699
]
700700
},
701701
{
@@ -1179,13 +1179,13 @@
11791179
"outputs": [],
11801180
"source": [
11811181
"prompts = [\n",
1182-
" \"\"\"Hugging Face a r\u00e9volutionn\u00e9 le NLP.\n",
1182+
" \"\"\"Hugging Face a révolutionné le NLP.\n",
11831183
" Translation: Hugging Face revolutionized NLP.\n",
11841184
" ###\n",
11851185
" Cela est incroyable!\n",
11861186
" Translation: This is unbelievable!\n",
11871187
" ###\n",
1188-
" D\u00e9sol\u00e9 je ne peux pas.\n",
1188+
" Désolé je ne peux pas.\n",
11891189
" Translation: Sorry but I cannot.\n",
11901190
" ###\n",
11911191
" {sentence}\n",
@@ -1921,4 +1921,4 @@
19211921
},
19221922
"nbformat": 4,
19231923
"nbformat_minor": 5
1924-
}
1924+
}

introduction_to_amazon_algorithms/jumpstart-foundation-models/text-generation-open-llama.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
},
4444
"outputs": [],
4545
"source": [
46-
"model_id, model_version, = (\n",
46+
"model_id, model_version = (\n",
4747
" \"huggingface-textgeneration-open-llama\",\n",
48-
" \"*\",\n",
48+
" \"2.*\",\n",
4949
")"
5050
]
5151
},
@@ -61,7 +61,7 @@
6161
"from sagemaker.jumpstart.model import JumpStartModel\n",
6262
"from sagemaker.serializers import JSONSerializer\n",
6363
"\n",
64-
"my_model = JumpStartModel(model_id=model_id)\n",
64+
"my_model = JumpStartModel(model_id=model_id, model_version=model_version)\n",
6565
"predictor = my_model.deploy()\n",
6666
"\n",
6767
"predictor.serializer = JSONSerializer()\n",

introduction_to_amazon_algorithms/jumpstart-foundation-models/text2text-generation-Batch-Transform.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
"outputs": [],
161161
"source": [
162162
"model_id = \"huggingface-text2text-flan-t5-large\"\n",
163-
"model_version = \"*\""
163+
"model_version = \"1.*\""
164164
]
165165
},
166166
{
@@ -224,7 +224,7 @@
224224
"outputs": [],
225225
"source": [
226226
"# model_version=\"*\" fetches the latest version of the model\n",
227-
"model_id, model_version = model_dropdown.value, \"*\""
227+
"model_id, model_version = model_dropdown.value, \"1.*\""
228228
]
229229
},
230230
{

introduction_to_amazon_algorithms/jumpstart-foundation-models/text2text-generation-bloomz.ipynb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
{
1212
"attachments": {},
1313
"cell_type": "markdown",
14+
"id": "71a7d870",
1415
"metadata": {},
1516
"source": [
1617
"---\n",
@@ -162,7 +163,7 @@
162163
"source": [
163164
"model_id, model_version, = (\n",
164165
" \"huggingface-textgeneration1-bloomz-7b1-fp16\",\n",
165-
" \"*\",\n",
166+
" \"1.*\",\n",
166167
")"
167168
]
168169
},
@@ -232,7 +233,7 @@
232233
"outputs": [],
233234
"source": [
234235
"# model_version=\"*\" fetches the latest version of the model\n",
235-
"model_id, model_version = model_dropdown.value, \"*\""
236+
"model_id, model_version = model_dropdown.value, \"1.*\""
236237
]
237238
},
238239
{
@@ -540,7 +541,7 @@
540541
"metadata": {},
541542
"outputs": [],
542543
"source": [
543-
"text = \"\"\"\u4e00\u4e2a\u4f20\u5947\u7684\u5f00\u7aef\uff0c\u4e00\u4e2a\u4e0d\u706d\u7684\u795e\u8bdd\uff0c\u8fd9\u4e0d\u4ec5\u4ec5\u662f\u4e00\u90e8\u7535\u5f71\uff0c\u800c\u662f\u4f5c\u4e3a\u4e00\u4e2a\u8d70\u8fdb\u65b0\u65f6\u4ee3\u7684\u6807\u7b7e\uff0c\u6c38\u8fdc\u5f6a\u70b3\u53f2\u518c\u3002\"\"\""
544+
"text = \"\"\"一个传奇的开端,一个不灭的神话,这不仅仅是一部电影,而是作为一个走进新时代的标签,永远彪炳史册。\"\"\""
544545
]
545546
},
546547
{
@@ -697,7 +698,7 @@
697698
"source": [
698699
"sentence = \"\"\"Amazon Web Services (AWS) has announced nine major new updates for its cloud-based machine learning platform, SageMaker.\n",
699700
"SageMaker aims to provide a machine learning service which can be used to build, train, and deploy ML models for virtually any use case.\n",
700-
"During this year\u2019s re:Invent conference, AWS made several announcements to further improve SageMaker\u2019s capabilities.\"\"\""
701+
"During this year’s re:Invent conference, AWS made several announcements to further improve SageMaker’s capabilities.\"\"\""
701702
]
702703
},
703704
{
@@ -883,9 +884,9 @@
883884
"source": [
884885
"context = \"\"\"The newest and most innovative Kindle yet lets you take notes on millions of books and documents, write lists and journals, and more. \n",
885886
"\n",
886-
"For readers who have always wished they could write in their eBooks, Amazon\u2019s new Kindle lets them do just that. The Kindle Scribe is the first Kindle for reading and writing and allows users to supplement their books and documents with notes, lists, and more.\n",
887+
"For readers who have always wished they could write in their eBooks, Amazon’s new Kindle lets them do just that. The Kindle Scribe is the first Kindle for reading and writing and allows users to supplement their books and documents with notes, lists, and more.\n",
887888
"\n",
888-
"Here\u2019s everything you need to know about the Kindle Scribe, including frequently asked questions.\n",
889+
"Here’s everything you need to know about the Kindle Scribe, including frequently asked questions.\n",
889890
"\n",
890891
"The Kindle Scribe makes it easy to read and write like you would on paper \n",
891892
"\n",
@@ -1183,9 +1184,9 @@
11831184
"source": [
11841185
"article = \"\"\"The newest and most innovative Kindle yet lets you take notes on millions of books and documents, write lists and journals, and more. \n",
11851186
"\n",
1186-
"For readers who have always wished they could write in their eBooks, Amazon\u2019s new Kindle lets them do just that. The Kindle Scribe is the first Kindle for reading and writing and allows users to supplement their books and documents with notes, lists, and more.\n",
1187+
"For readers who have always wished they could write in their eBooks, Amazon’s new Kindle lets them do just that. The Kindle Scribe is the first Kindle for reading and writing and allows users to supplement their books and documents with notes, lists, and more.\n",
11871188
"\n",
1188-
"Here\u2019s everything you need to know about the Kindle Scribe, including frequently asked questions.\n",
1189+
"Here’s everything you need to know about the Kindle Scribe, including frequently asked questions.\n",
11891190
"\n",
11901191
"The Kindle Scribe makes it easy to read and write like you would on paper \n",
11911192
"\n",
@@ -1248,6 +1249,7 @@
12481249
{
12491250
"attachments": {},
12501251
"cell_type": "markdown",
1252+
"id": "3c8760a6",
12511253
"metadata": {},
12521254
"source": [
12531255
"## Notebook CI Test Results\n",
@@ -1796,4 +1798,4 @@
17961798
},
17971799
"nbformat": 4,
17981800
"nbformat_minor": 5
1799-
}
1801+
}

introduction_to_amazon_algorithms/jumpstart-foundation-models/text2text-generation-flan-t5-ul2.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
"source": [
158158
"model_id, model_version = (\n",
159159
" \"huggingface-text2text-flan-t5-xl\",\n",
160-
" \"*\",\n",
160+
" \"1.*\",\n",
161161
")"
162162
]
163163
},
@@ -227,7 +227,7 @@
227227
"outputs": [],
228228
"source": [
229229
"# model_version=\"*\" fetches the latest version of the model\n",
230-
"model_id, model_version = model_dropdown.value, \"*\""
230+
"model_id, model_version = model_dropdown.value, \"1.*\""
231231
]
232232
},
233233
{

0 commit comments

Comments
 (0)