Test code in pytorch 2.4 (#285)

* test code in pytorch 2.4

* update
This commit is contained in:
Sebastian Raschka
2024-07-24 21:53:41 -05:00
committed by GitHub
parent 6cbe6520a2
commit 08040f024c
17 changed files with 509 additions and 377 deletions

View File

@@ -28,6 +28,36 @@
"# Chapter 2 Exercise solutions"
]
},
{
"cell_type": "markdown",
"id": "2ed9978c-6d8e-401b-9731-bec3802cbb96",
"metadata": {},
"source": [
"Packages that are being used in this notebook:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "78b55ed6-3312-4e30-89b8-51dc8a4a908f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"torch version: 2.4.0\n",
"tiktoken version: 0.7.0\n"
]
}
],
"source": [
"from importlib.metadata import version\n",
"\n",
"print(\"torch version:\", version(\"torch\"))\n",
"print(\"tiktoken version:\", version(\"tiktoken\"))"
]
},
{
"cell_type": "markdown",
"id": "6f678e62-7bcb-4405-86ae-dce94f494303",
@@ -38,7 +68,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "7614337f-f639-42c9-a99b-d33f74fa8a03",
"metadata": {},
"outputs": [],
@@ -50,7 +80,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "4f235d87-be85-4ddf-95a6-af59fca13d82",
"metadata": {},
"outputs": [
@@ -69,7 +99,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "45e4e8f0-3272-48bb-96f6-cced5584ceea",
"metadata": {},
"outputs": [
@@ -93,7 +123,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"id": "664397bc-6daa-4b88-90aa-e8fc1fbd5846",
"metadata": {},
"outputs": [
@@ -103,7 +133,7 @@
"[33901]"
]
},
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@@ -114,7 +144,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"id": "d3664332-e6bb-447e-8b96-203aafde8b24",
"metadata": {},
"outputs": [
@@ -124,7 +154,7 @@
"[86]"
]
},
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
@@ -135,7 +165,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"id": "2773c09d-c136-4372-a2be-04b58d292842",
"metadata": {},
"outputs": [
@@ -145,7 +175,7 @@
"[343]"
]
},
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@@ -156,7 +186,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"id": "8a6abd32-1e0a-4038-9dd2-673f47bcdeb5",
"metadata": {},
"outputs": [
@@ -166,7 +196,7 @@
"[86]"
]
},
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@@ -177,7 +207,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"id": "26ae940a-9841-4e27-a1df-b83fc8a488b3",
"metadata": {},
"outputs": [
@@ -187,7 +217,7 @@
"[220]"
]
},
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@@ -198,7 +228,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"id": "a606c39a-6747-4cd8-bb38-e3183f80908d",
"metadata": {},
"outputs": [
@@ -208,7 +238,7 @@
"[959]"
]
},
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@@ -219,7 +249,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"id": "47c7268d-8fdc-4957-bc68-5be6113f45a7",
"metadata": {},
"outputs": [
@@ -229,7 +259,7 @@
"'Akwirw ier'"
]
},
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -248,7 +278,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"id": "4d50af16-937b-49e0-8ffd-42d30cbb41c9",
"metadata": {},
"outputs": [],
@@ -310,7 +340,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"id": "0128eefa-d7c8-4f76-9851-566dfa7c3745",
"metadata": {},
"outputs": [
@@ -323,7 +353,7 @@
" [ 402, 271]])"
]
},
"execution_count": 12,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
@@ -340,7 +370,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 14,
"id": "ff5c1e90-c6de-4a87-adf6-7e19f603291c",
"metadata": {},
"outputs": [
@@ -353,7 +383,7 @@
" [ 402, 271, 10899, 2138, 257, 7026, 15632, 438]])"
]
},
"execution_count": 13,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
@@ -385,7 +415,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.11.4"
}
},
"nbformat": 4,