Skip to content

Commit 68d53e7

Browse files
committed
fix sidebar by setting pydata-sphinx-theme version
1 parent 35488cf commit 68d53e7

File tree

2 files changed

+94
-9
lines changed

2 files changed

+94
-9
lines changed

dsc_tutorials/non-associativity.ipynb

Lines changed: 92 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,107 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "code",
5-
"execution_count": null,
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Non-Associativity\n",
8+
"\n",
9+
"$$\n",
10+
" a + (b + c) \\neq (a + b) + c\n",
11+
"$$"
12+
]
13+
},
14+
{
15+
"cell_type": "markdown",
616
"metadata": {},
7-
"outputs": [],
817
"source": [
18+
"Seen at: https://medium.com/@anis.zakari/changing-the-gpu-is-changing-the-behaviour-of-your-llm-0e6dd8dfaaae"
19+
]
20+
},
21+
{
22+
"cell_type": "markdown",
23+
"metadata": {},
24+
"source": [
25+
"Original code snippet used torch with bfloats (actually brain floating point):\n",
26+
"\n",
27+
"```python\n",
928
"import torch\n",
1029
"\n",
11-
"a = torch.tensor(1e10, dtype=torch.float16)\n",
12-
"b = torch.tensor(1.0, dtype=torch.float16)\n",
13-
"c = torch.tensor(-1e10, dtype=torch.float16)"
30+
"a = torch.tensor(1e10, dtype=torch.bfloat16)\n",
31+
"b = torch.tensor(-1e10, dtype=torch.bfloat16)\n",
32+
"c = torch.tensor(1.0, dtype=torch.bfloat16)\n",
33+
"```"
1434
]
1535
},
1636
{
1737
"cell_type": "code",
18-
"execution_count": null,
38+
"execution_count": 26,
1939
"metadata": {},
2040
"outputs": [],
41+
"source": [
42+
"import numpy as np\n",
43+
"\n",
44+
"a = np.array(1e4, dtype=np.float16)\n",
45+
"b = np.array(-1e4, dtype=np.float16)\n",
46+
"c = np.array(1, dtype=np.float16)"
47+
]
48+
},
49+
{
50+
"cell_type": "code",
51+
"execution_count": 32,
52+
"metadata": {},
53+
"outputs": [
54+
{
55+
"data": {
56+
"text/plain": [
57+
"np.False_"
58+
]
59+
},
60+
"execution_count": 32,
61+
"metadata": {},
62+
"output_type": "execute_result"
63+
}
64+
],
65+
"source": [
66+
"a + (b + c) == (a + b) + c"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": 33,
72+
"metadata": {},
73+
"outputs": [
74+
{
75+
"data": {
76+
"text/plain": [
77+
"np.float16(0.0)"
78+
]
79+
},
80+
"execution_count": 33,
81+
"metadata": {},
82+
"output_type": "execute_result"
83+
}
84+
],
2185
"source": [
2286
"a + (b + c)"
2387
]
2488
},
2589
{
2690
"cell_type": "code",
27-
"execution_count": null,
91+
"execution_count": 34,
2892
"metadata": {},
29-
"outputs": [],
93+
"outputs": [
94+
{
95+
"data": {
96+
"text/plain": [
97+
"np.float16(1.0)"
98+
]
99+
},
100+
"execution_count": 34,
101+
"metadata": {},
102+
"output_type": "execute_result"
103+
}
104+
],
30105
"source": [
31106
"(a + b) + c"
32107
]
@@ -39,7 +114,15 @@
39114
"name": "python3"
40115
},
41116
"language_info": {
117+
"codemirror_mode": {
118+
"name": "ipython",
119+
"version": 3
120+
},
121+
"file_extension": ".py",
122+
"mimetype": "text/x-python",
42123
"name": "python",
124+
"nbconvert_exporter": "python",
125+
"pygments_lexer": "ipython3",
43126
"version": "3.12.2"
44127
}
45128
},

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ numpy
55
pandas
66
scikit-learn
77
ghp-import
8+
# pydata-sphinx-theme 16.0 breaks sidebar
9+
pydata-sphinx-theme<16.0

0 commit comments

Comments
 (0)