Skip to content

Commit

Permalink
fix sidebar by setting pydata-sphinx-theme version
Browse files Browse the repository at this point in the history
  • Loading branch information
chillerb committed Dec 12, 2024
1 parent 35488cf commit 68d53e7
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 9 deletions.
101 changes: 92 additions & 9 deletions dsc_tutorials/non-associativity.ipynb
Original file line number Diff line number Diff line change
@@ -1,32 +1,107 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"source": [
"# Non-Associativity\n",
"\n",
"$$\n",
" a + (b + c) \\neq (a + b) + c\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"Seen at: https://medium.com/@anis.zakari/changing-the-gpu-is-changing-the-behaviour-of-your-llm-0e6dd8dfaaae"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Original code snippet used torch with bfloats (actually brain floating point):\n",
"\n",
"```python\n",
"import torch\n",
"\n",
"a = torch.tensor(1e10, dtype=torch.float16)\n",
"b = torch.tensor(1.0, dtype=torch.float16)\n",
"c = torch.tensor(-1e10, dtype=torch.float16)"
"a = torch.tensor(1e10, dtype=torch.bfloat16)\n",
"b = torch.tensor(-1e10, dtype=torch.bfloat16)\n",
"c = torch.tensor(1.0, dtype=torch.bfloat16)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"a = np.array(1e4, dtype=np.float16)\n",
"b = np.array(-1e4, dtype=np.float16)\n",
"c = np.array(1, dtype=np.float16)"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"np.False_"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a + (b + c) == (a + b) + c"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"np.float16(0.0)"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a + (b + c)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 34,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"np.float16(1.0)"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(a + b) + c"
]
Expand All @@ -39,7 +114,15 @@
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
}
},
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ numpy
pandas
scikit-learn
ghp-import
# pydata-sphinx-theme 16.0 breaks sidebar
pydata-sphinx-theme<16.0

0 comments on commit 68d53e7

Please sign in to comment.