Browse Source

move overview up

rasbt 1 year ago
parent
commit
2b38b63a7a
1 changed files with 30 additions and 12 deletions
  1. 30 12
      ch04/01_main-chapter-code/ch04.ipynb

+ 30 - 12
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": [
+    "<img src=\"figures/mental-model-final.webp\" width=350px>"
+   ]
+  },
   {
    "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": [
-    "<img src=\"figures/mental-model-final.webp\" width=350px>"
-   ]
-  },
   {
    "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)"