Skip to content

Commit 4b00c4e

Browse files
author
EC2 Default User
committed
aws_marketplace/using_model_packages/creative-writing-using-gpt-2-text-generation/creative-writing-using-gpt-2-text-generation.ipynb
1 parent 6eef950 commit 4b00c4e

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

aws_marketplace/using_model_packages/creative-writing-using-gpt-2-text-generation/creative-writing-using-gpt-2-text-generation.ipynb

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
"cell_type": "markdown",
2323
"metadata": {},
2424
"source": [
25-
"#### Overview:\n",
25+
"## Overview\n",
2626
"In [step 1](#Step-1:-Determine-input-prompt-and-visualize-word-dependencies) of this notebook, you will determine an input prompt that will be used to condition the GPT-2 model for text generation. You will also [visualize attention](#Step-1.1-Introduction-to-attention) mechanism of GPT-2 model. In [step 2](#Step-2:-Use-an-ML-model-to-generate-text-based-on-prompt), you will create the model from an AWS Marketplace subscription, and deploy to an Amazon SageMaker endpoint. In [step 3](#Step-3:-Explore-use-cases-and-model-parameters), you will explore text generation use cases with various model parameter settings. In [step 4](#Step-4:-Use-Amazon-SageMaker-batch-transform), you will perform inference asynchronously using SageMaker batch transform instead of the endpoint. In [Step 5](#Step-5:-Next-steps) you will find additional models to explore and experiment with."
2727
]
2828
},
2929
{
3030
"cell_type": "markdown",
3131
"metadata": {},
3232
"source": [
33-
"#### Contents:\n",
33+
"## Contents\n",
3434
"* [Pre-requisites](#Pre-requisites)\n",
3535
"* [Step 1: Determine input prompt and visualize word dependencies](#Step-1:-Determine-input-prompt-and-visualize-word-dependencies)\n",
3636
" * [Step 1.1 Introduction to attention](#Step-1.1-Introduction-to-attention)\n",
@@ -54,7 +54,7 @@
5454
" * [Step 5.1: Additional resources](#Step-5.1:-Additional-resources)\n",
5555
" * [Step 5.2: Cancel AWS Marketplace subscription](#Step-5.2:-Cancel-AWS-Marketplace-subscription)\n",
5656
"\n",
57-
"#### Usage instructions\n",
57+
"## Usage instructions\n",
5858
"You can run this notebook one cell at a time (By using Shift+Enter for running a cell)."
5959
]
6060
},
@@ -170,7 +170,7 @@
170170
"cell_type": "markdown",
171171
"metadata": {},
172172
"source": [
173-
"### Step 1: Determine input prompt and visualize word dependencies"
173+
"## Step 1: Determine input prompt and visualize word dependencies"
174174
]
175175
},
176176
{
@@ -186,7 +186,7 @@
186186
"cell_type": "markdown",
187187
"metadata": {},
188188
"source": [
189-
"#### Step 1.1 Introduction to attention\n",
189+
"### Step 1.1 Introduction to attention\n",
190190
"\n",
191191
"[Self-Attention mechanism](https://arxiv.org/abs/1706.03762) is one of the key components for Transformers architectures, including GPT-2. It helps to relate different positions of a specific sequence of tokens in order to compute contextual representation of the sequence.\n",
192192
"\n",
@@ -219,7 +219,7 @@
219219
"cell_type": "markdown",
220220
"metadata": {},
221221
"source": [
222-
"#### Step 1.2 Specify input prompt \n",
222+
"### Step 1.2 Specify input prompt \n",
223223
"\n",
224224
"You can experiment with different prompts and see what contextual dependencies exist in your own examples. "
225225
]
@@ -237,7 +237,7 @@
237237
"cell_type": "markdown",
238238
"metadata": {},
239239
"source": [
240-
"#### Step 1.3 Visualize attention mechanism\n",
240+
"### Step 1.3 Visualize attention mechanism\n",
241241
"\n",
242242
"In this step, let's call BertViz package to produce attention visualization of our input."
243243
]
@@ -303,7 +303,7 @@
303303
"cell_type": "markdown",
304304
"metadata": {},
305305
"source": [
306-
"### Step 2: Use an ML model to generate text based on prompt\n",
306+
"## Step 2: Use an ML model to generate text based on prompt\n",
307307
"\n",
308308
"Because you utilize [GPT-2 XL - Text generation](https://aws.amazon.com/marketplace/pp/prodview-cdujckyfypprg) algorithm from AWS Marketplace - all you need to do to start using it - is to deploy it as an inference endpoint in your account. Alternatively, we can use SageMaker Batch Transformation to run inference on batch payloads. \n",
309309
"\n",
@@ -355,7 +355,7 @@
355355
"cell_type": "markdown",
356356
"metadata": {},
357357
"source": [
358-
"#### Step 2.1: Specify model arn from AWS Marketplace subscription"
358+
"### Step 2.1: Specify model arn from AWS Marketplace subscription"
359359
]
360360
},
361361
{
@@ -380,7 +380,7 @@
380380
"cell_type": "markdown",
381381
"metadata": {},
382382
"source": [
383-
"#### Step 2.2: Create model from model package and deploy to endpoint"
383+
"### Step 2.2: Create model from model package and deploy to endpoint"
384384
]
385385
},
386386
{
@@ -406,7 +406,7 @@
406406
"cell_type": "markdown",
407407
"metadata": {},
408408
"source": [
409-
"### Step 3: Explore use cases and model parameters"
409+
"## Step 3: Explore use cases and model parameters"
410410
]
411411
},
412412
{
@@ -445,7 +445,7 @@
445445
"cell_type": "markdown",
446446
"metadata": {},
447447
"source": [
448-
"#### Step 3.1: Use case 1: Assisted writing of prose"
448+
"### Step 3.1: Use case 1: Assisted writing of prose"
449449
]
450450
},
451451
{
@@ -511,7 +511,7 @@
511511
"cell_type": "markdown",
512512
"metadata": {},
513513
"source": [
514-
"#### Step 3.2: Use case 2: Autonomous authoring of poem"
514+
"### Step 3.2: Use case 2: Autonomous authoring of poem"
515515
]
516516
},
517517
{
@@ -619,7 +619,7 @@
619619
"cell_type": "markdown",
620620
"metadata": {},
621621
"source": [
622-
"#### Step 3.3: Additional Use-Cases"
622+
"### Step 3.3: Additional Use-Cases"
623623
]
624624
},
625625
{
@@ -812,7 +812,7 @@
812812
"cell_type": "markdown",
813813
"metadata": {},
814814
"source": [
815-
"#### Step 3.4: Delete Amazon SageMaker endpoint"
815+
"### Step 3.4: Delete Amazon SageMaker endpoint"
816816
]
817817
},
818818
{
@@ -836,7 +836,7 @@
836836
"cell_type": "markdown",
837837
"metadata": {},
838838
"source": [
839-
"### Step 4: Use Amazon SageMaker batch transform"
839+
"## Step 4: Use Amazon SageMaker batch transform"
840840
]
841841
},
842842
{
@@ -854,7 +854,7 @@
854854
"cell_type": "markdown",
855855
"metadata": {},
856856
"source": [
857-
"#### Step 4.1: Create input file for batch transform job"
857+
"### Step 4.1: Create input file for batch transform job"
858858
]
859859
},
860860
{
@@ -886,7 +886,7 @@
886886
"cell_type": "markdown",
887887
"metadata": {},
888888
"source": [
889-
"#### Step 4.2: Upload file to S3"
889+
"### Step 4.2: Upload file to S3"
890890
]
891891
},
892892
{
@@ -904,7 +904,7 @@
904904
"cell_type": "markdown",
905905
"metadata": {},
906906
"source": [
907-
"#### Step 4.3: Execute the batch transform job"
907+
"### Step 4.3: Execute the batch transform job"
908908
]
909909
},
910910
{
@@ -948,7 +948,7 @@
948948
"cell_type": "markdown",
949949
"metadata": {},
950950
"source": [
951-
"#### Step 4.4: Visualize output"
951+
"### Step 4.4: Visualize output"
952952
]
953953
},
954954
{
@@ -983,7 +983,7 @@
983983
"cell_type": "markdown",
984984
"metadata": {},
985985
"source": [
986-
"#### Step 4.5: Delete the model"
986+
"### Step 4.5: Delete the model"
987987
]
988988
},
989989
{
@@ -999,14 +999,14 @@
999999
"cell_type": "markdown",
10001000
"metadata": {},
10011001
"source": [
1002-
"### Step 5: Next steps"
1002+
"## Step 5: Next steps"
10031003
]
10041004
},
10051005
{
10061006
"cell_type": "markdown",
10071007
"metadata": {},
10081008
"source": [
1009-
"#### Step 5.1: Additional resources"
1009+
"### Step 5.1: Additional resources"
10101010
]
10111011
},
10121012
{
@@ -1025,7 +1025,7 @@
10251025
"cell_type": "markdown",
10261026
"metadata": {},
10271027
"source": [
1028-
"#### Step 5.2: Cancel AWS Marketplace subscription"
1028+
"### Step 5.2: Cancel AWS Marketplace subscription"
10291029
]
10301030
},
10311031
{

0 commit comments

Comments
 (0)