From 2b38b63a7a956d3d39d2e689160a5e155e5391d5 Mon Sep 17 00:00:00 2001 From: rasbt Date: Sun, 4 Feb 2024 15:57:03 -0600 Subject: [PATCH] move overview up --- ch04/01_main-chapter-code/ch04.ipynb | 42 ++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/ch04/01_main-chapter-code/ch04.ipynb b/ch04/01_main-chapter-code/ch04.ipynb index b32f1a6..0658728 100644 --- a/ch04/01_main-chapter-code/ch04.ipynb +++ b/ch04/01_main-chapter-code/ch04.ipynb @@ -887,6 +887,14 @@ "print(\"Output shape:\", output.shape)" ] }, + { + "cell_type": "markdown", + "id": "91f502e4-f3e4-40cb-8268-179eec002394", + "metadata": {}, + "source": [ + "" + ] + }, { "cell_type": "markdown", "id": "46618527-15ac-4c32-ad85-6cfea83e006e", @@ -1148,14 +1156,6 @@ " - \"n_heads\" = 25" ] }, - { - "cell_type": "markdown", - "id": "0042c58e-995a-4a42-887f-613cad9f22b9", - "metadata": {}, - "source": [ - "" - ] - }, { "cell_type": "markdown", "id": "da5d9bc0-95ab-45d4-9378-417628d86e35", @@ -1277,10 +1277,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "id": "a72a9b60-de66-44cf-b2f9-1e638934ada4", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Output: tensor([[15496, 11, 314, 716, 27018, 24086, 47843, 30961, 42348, 7267,\n", + " 49706, 43231, 47062, 34657]])\n", + "Output length: 14\n" + ] + } + ], "source": [ "model.eval() # disable dropout\n", "\n", @@ -1305,10 +1315,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "id": "053d99f6-5710-4446-8d52-117fb34ea9f6", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello, I am Featureiman Byeswickattribute argue logger Normandy Compton analogous\n" + ] + } + ], "source": [ "decoded_text = tokenizer.decode(out.squeeze(0).tolist())\n", "print(decoded_text)"