|
11 | 11 |
|
12 | 12 | // return object entries sorted by key
|
13 | 13 | function getSortedEntries(obj: object) {
|
14 |
| - return Object.entries(obj).sort(([a, _x], [b, _y]) => a.localeCompare(b)); |
| 14 | + return Object.entries(obj).sort(([a, _x], [b, _y]) => |
| 15 | + a.localeCompare(b), |
| 16 | + ); |
15 | 17 | }
|
16 | 18 |
|
17 | 19 | // Known errors
|
|
29 | 31 | };
|
30 | 32 | </script>
|
31 | 33 |
|
32 |
| -<main> |
33 |
| - <h1>Turing AD tests</h1> |
34 |
| - |
35 |
| - <p> |
36 |
| - <a href="https://turinglang.org/docs">Turing.jl documentation</a> | |
37 |
| - <a href="https://github.com/TuringLang/Turing.jl">Turing.jl GitHub</a> |
38 |
| - | |
39 |
| - <a href="https://github.com/TuringLang/ADTests" |
40 |
| - >Source code for these tests</a |
41 |
| - > |
42 |
| - </p> |
43 |
| - |
44 |
| - <p> |
45 |
| - This page is intended as a brief overview of how different AD backends |
46 |
| - perform on a variety of Turing.jl models. Note that the inclusion of any |
47 |
| - AD backend here does not imply an endorsement from the Turing team; this |
48 |
| - table is purely for information. |
49 |
| - </p> |
50 |
| - |
51 |
| - <ul> |
52 |
| - <li> |
53 |
| - The definitions of the models and AD types below can be found on <a |
54 |
| - href="https://github.com/TuringLang/ADTests" |
55 |
| - target="_blank">GitHub</a |
56 |
| - >. |
57 |
| - </li> |
58 |
| - <li> |
59 |
| - <b>Numbers</b> indicate the time taken to calculate the gradient of |
60 |
| - the log density of the model using the specified AD type, divided by |
61 |
| - the time taken to calculate the log density itself (in AD speak, the |
62 |
| - primal). Basically: |
63 |
| - <b>smaller means faster.</b> |
64 |
| - </li> |
65 |
| - <li> |
66 |
| - '<span class="wrong">wrong</span>' means that AD ran but the result |
67 |
| - was not correct. If this happens you should be very wary! Note that |
68 |
| - this is done by comparing against the result obtained using |
69 |
| - ForwardDiff, i.e., ForwardDiff is by definition always 'correct'. |
70 |
| - </li> |
71 |
| - <li>'<span class="error">error</span>' means that AD didn't run.</li> |
72 |
| - <li> |
73 |
| - Some of the 'wrong' or 'error' entries have question marks next to |
74 |
| - them. These will link to a GitHub issue or other page that describes |
75 |
| - the problem. |
76 |
| - </li> |
77 |
| - </ul> |
78 |
| - |
79 |
| - <h2>Results</h2> |
80 |
| - |
81 |
| - <p> |
82 |
| - (New: You can also hover over the model names to see their definitions.) |
83 |
| - </p> |
84 |
| - |
85 |
| - <table id="results"> |
86 |
| - <thead |
87 |
| - ><tr> |
88 |
| - <th class="right">Model name \\ AD type</th> |
89 |
| - {#each adtypes as adtype} |
90 |
| - <th class="right">{adtype}</th> |
91 |
| - {/each} |
92 |
| - </tr></thead |
93 |
| - > |
94 |
| - <tbody> |
95 |
| - {#each getSortedEntries(data) as [model_name, results]} |
96 |
| - <tr> |
97 |
| - <td |
98 |
| - >{model_name} |
99 |
| - <div class="model-definition"> |
100 |
| - <pre>{modelDefinitions[model_name]}</pre> |
101 |
| - </div></td |
102 |
| - > |
103 |
| - {#each getSortedEntries(results) as [adtype, result]} |
104 |
| - {#if typeof result === "number"} |
105 |
| - <td>{result}</td> |
106 |
| - {:else} |
107 |
| - <td> |
108 |
| - {#if KNOWN_ERRORS[`${model_name}__${adtype}`]} |
109 |
| - <a |
110 |
| - class="issue" |
111 |
| - href={KNOWN_ERRORS[ |
112 |
| - `${model_name}__${adtype}` |
113 |
| - ]} |
114 |
| - target="_blank">(?)</a |
115 |
| - > |
116 |
| - {/if} |
117 |
| - <span class={result}>{result}</span> |
118 |
| - </td> |
119 |
| - {/if} |
| 34 | +<div id="main-wrapper"> |
| 35 | + <main> |
| 36 | + <h1>Turing AD tests</h1> |
| 37 | + |
| 38 | + <p> |
| 39 | + <a href="https://turinglang.org/docs">Turing.jl documentation</a> | |
| 40 | + <a href="https://github.com/TuringLang/Turing.jl" |
| 41 | + >Turing.jl GitHub</a |
| 42 | + > |
| 43 | + | |
| 44 | + <a href="https://github.com/TuringLang/ADTests" |
| 45 | + >Source code for these tests</a |
| 46 | + > |
| 47 | + </p> |
| 48 | + |
| 49 | + <p> |
| 50 | + This page is intended as a brief overview of how different AD |
| 51 | + backends perform on a variety of Turing.jl models. Note that the |
| 52 | + inclusion of any AD backend here does not imply an endorsement from |
| 53 | + the Turing team; this table is purely for information. |
| 54 | + </p> |
| 55 | + |
| 56 | + <ul class="notes"> |
| 57 | + <li> |
| 58 | + You can hover over the model names to see their definitions. |
| 59 | + </li> |
| 60 | + <li> |
| 61 | + The definitions of the AD types can be found in <a |
| 62 | + href="https://github.com/TuringLang/ADTests/blob/main/main.jl" |
| 63 | + target="_blank">the source code</a |
| 64 | + >. |
| 65 | + </li> |
| 66 | + <li> |
| 67 | + <b>Numbers</b> indicate the time taken to calculate the gradient |
| 68 | + of the log density of the model using the specified AD type, |
| 69 | + divided by the time taken to calculate the log density itself |
| 70 | + (in AD speak, the primal). Basically: |
| 71 | + <b>smaller means faster.</b> |
| 72 | + </li> |
| 73 | + <li> |
| 74 | + '<span class="wrong">wrong</span>' means that AD ran but the |
| 75 | + result was not correct. If this happens you should be very wary! |
| 76 | + Note that this is done by comparing against the result obtained |
| 77 | + using ForwardDiff, i.e., ForwardDiff is by definition always |
| 78 | + 'correct'. |
| 79 | + </li> |
| 80 | + <li> |
| 81 | + '<span class="error">error</span>' means that AD didn't run. |
| 82 | + </li> |
| 83 | + <li> |
| 84 | + Some of the 'wrong' or 'error' entries have question marks next |
| 85 | + to them. These will link to a GitHub issue or other page that |
| 86 | + describes the problem. |
| 87 | + </li> |
| 88 | + </ul> |
| 89 | + |
| 90 | + <h2>Results</h2> |
| 91 | + |
| 92 | + <p> |
| 93 | + <a href="/adtests.json" target="_blank" download |
| 94 | + >Download the raw data (JSON)</a |
| 95 | + > |
| 96 | + </p> |
| 97 | + |
| 98 | + <table id="results"> |
| 99 | + <thead |
| 100 | + ><tr> |
| 101 | + <th>Model name \\ AD type</th> |
| 102 | + {#each adtypes as adtype} |
| 103 | + <th>{adtype}</th> |
120 | 104 | {/each}
|
121 |
| - </tr> |
122 |
| - {/each} |
123 |
| - </tbody> |
124 |
| - </table> |
125 |
| - |
126 |
| - <h2>Manifest</h2> |
127 |
| - <p>The tests above were run with the following package versions:</p> |
128 |
| - |
129 |
| - <table id="manifest"> |
130 |
| - <thead> |
131 |
| - <tr> |
132 |
| - <th>Package</th> |
133 |
| - <th>Version</th> |
134 |
| - </tr> |
135 |
| - </thead> |
136 |
| - <tbody> |
137 |
| - {#each getSortedEntries(manifest) as [packageName, version]} |
| 105 | + </tr></thead |
| 106 | + > |
| 107 | + <tbody> |
| 108 | + {#each getSortedEntries(data) as [model_name, results]} |
| 109 | + <tr> |
| 110 | + <td |
| 111 | + >{model_name} |
| 112 | + <div class="model-definition"> |
| 113 | + <pre>{modelDefinitions[model_name]}</pre> |
| 114 | + </div></td |
| 115 | + > |
| 116 | + {#each getSortedEntries(results) as [adtype, result]} |
| 117 | + {#if typeof result === "number"} |
| 118 | + <td>{result}</td> |
| 119 | + {:else} |
| 120 | + <td> |
| 121 | + {#if KNOWN_ERRORS[`${model_name}__${adtype}`]} |
| 122 | + <a |
| 123 | + class="issue" |
| 124 | + href={KNOWN_ERRORS[ |
| 125 | + `${model_name}__${adtype}` |
| 126 | + ]} |
| 127 | + target="_blank">(?)</a |
| 128 | + > |
| 129 | + {/if} |
| 130 | + <span class={result}>{result}</span> |
| 131 | + </td> |
| 132 | + {/if} |
| 133 | + {/each} |
| 134 | + </tr> |
| 135 | + {/each} |
| 136 | + </tbody> |
| 137 | + </table> |
| 138 | + |
| 139 | + <h2>Manifest</h2> |
| 140 | + <p>The tests above were run with the following package versions:</p> |
| 141 | + |
| 142 | + <table id="manifest"> |
| 143 | + <thead> |
138 | 144 | <tr>
|
139 |
| - <td>{packageName}</td> |
140 |
| - <td>{version === null ? "" : `v${version}`}</td> |
| 145 | + <th>Package</th> |
| 146 | + <th>Version</th> |
141 | 147 | </tr>
|
142 |
| - {/each} |
143 |
| - </tbody> |
144 |
| - </table> |
145 |
| -</main> |
| 148 | + </thead> |
| 149 | + <tbody> |
| 150 | + {#each getSortedEntries(manifest) as [packageName, version]} |
| 151 | + <tr> |
| 152 | + <td>{packageName}</td> |
| 153 | + <td>{version === null ? "" : `v${version}`}</td> |
| 154 | + </tr> |
| 155 | + {/each} |
| 156 | + </tbody> |
| 157 | + </table> |
| 158 | + </main> |
| 159 | +</div> |
| 160 | + |
| 161 | +<style> |
| 162 | + div#main-wrapper { |
| 163 | + display: flex; |
| 164 | + align-items: center; |
| 165 | + margin: 0px 0px 50px 0px; |
| 166 | + } |
| 167 | +
|
| 168 | + main { |
| 169 | + margin: auto; |
| 170 | + max-width: min-content; |
| 171 | + } |
| 172 | +
|
| 173 | + ul { |
| 174 | + display: flex; |
| 175 | + flex-direction: column; |
| 176 | + gap: 5px; |
| 177 | + } |
| 178 | +
|
| 179 | + table { |
| 180 | + border: 1px solid black; |
| 181 | + border-collapse: collapse; |
| 182 | +
|
| 183 | + tr > td:first-child, |
| 184 | + tr > th:first-child { |
| 185 | + font-family: "Fira Sans", sans-serif; |
| 186 | + font-weight: 700; |
| 187 | + position: relative; |
| 188 | + text-align: right; |
| 189 | + transition: background-color 0.3s ease; |
| 190 | + } |
| 191 | + tr > td:first-child { |
| 192 | + background-color: #ececec; |
| 193 | + } |
| 194 | + tr > th:first-child { |
| 195 | + background-color: #d1d1d1; |
| 196 | + } |
| 197 | + td, |
| 198 | + th { |
| 199 | + border: 1px solid black; |
| 200 | + padding: 0px 10px; |
| 201 | + white-space: nowrap; |
| 202 | + } |
| 203 | + th { |
| 204 | + background-color: #ececec; |
| 205 | + } |
| 206 | + td { |
| 207 | + font-family: "Fira Code", monospace; |
| 208 | + } |
| 209 | + } |
| 210 | +
|
| 211 | + table#results { |
| 212 | + td, |
| 213 | + th { |
| 214 | + text-align: right; |
| 215 | + } |
| 216 | + div.model-definition { |
| 217 | + background-color: #f6f6f6; |
| 218 | + border: 1px solid black; |
| 219 | + border-radius: 5px; |
| 220 | + padding: 0 10px; |
| 221 | + z-index: 5; |
| 222 | + font-size: 0.9em; |
| 223 | + text-align: left; |
| 224 | + font-weight: normal; |
| 225 | + position: absolute; |
| 226 | + left: 100%; |
| 227 | + top: 0; |
| 228 | + display: none; |
| 229 | + } |
| 230 | + tr > td:first-child:hover { |
| 231 | + background-color: #f8f8f8; |
| 232 | + } |
| 233 | + tr > td:first-child:hover > div.model-definition { |
| 234 | + display: block; |
| 235 | + } |
| 236 | +
|
| 237 | + span.error { |
| 238 | + color: #ff0000; |
| 239 | + } |
| 240 | + span.incorrect, |
| 241 | + span.wrong { |
| 242 | + color: #ff0000; |
| 243 | + background-color: #ffcccc; |
| 244 | + } |
| 245 | +
|
| 246 | + a.issue { |
| 247 | + color: #880000; |
| 248 | + text-decoration: none; |
| 249 | + } |
| 250 | +
|
| 251 | + a.issue:hover { |
| 252 | + background-color: #ffcccc; |
| 253 | + transition: background-color 0.3s ease; |
| 254 | + } |
| 255 | +
|
| 256 | + a.issue:visited { |
| 257 | + color: #880000; |
| 258 | + } |
| 259 | + } |
| 260 | +</style> |
0 commit comments