+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i
---
title: "Multi-GPU"
format:
@@ -1128,20 +1112,20 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
Add to your YAML config:
```{.yaml}
-deepspeed: deepspeed_configs/zero1.json
+deepspeed : deepspeed_configs/zero1.json
```
### Usage {#sec-deepspeed-usage}
```{.bash}
-# Fetch deepspeed configs (if not already present)
-axolotl fetch deepspeed_configs
+# Fetch deepspeed configs (if not already present)
+axolotl fetch deepspeed_configs
-# Passing arg via config
-axolotl train config.yml
+# Passing arg via config
+axolotl train config.yml
-# Passing arg via cli
-axolotl train config.yml --deepspeed deepspeed_configs/zero1.json
+# Passing arg via cli
+axolotl train config.yml --deepspeed deepspeed_configs/zero1.json
```
### ZeRO Stages {#sec-zero-stages}
@@ -1169,13 +1153,13 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
### Basic FSDP Configuration {#sec-fsdp-config}
```{.yaml}
-fsdp:
- - full_shard
- - auto_wrap
-fsdp_config:
- fsdp_offload_params: true
- fsdp_state_dict_type: FULL_STATE_DICT
- fsdp_transformer_layer_cls_to_wrap: LlamaDecoderLayer
+fsdp :
+ - full_shard
+ - auto_wrap
+fsdp_config :
+ fsdp_offload_params : true
+ fsdp_state_dict_type : FULL_STATE_DICT
+ fsdp_transformer_layer_cls_to_wrap : LlamaDecoderLayer
```
## Sequence parallelism {#sec-sequence-parallelism}
@@ -1191,11 +1175,11 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
Your Axolotl YAML config should contain the following lines:
```{.yaml}
-sequence_parallel_degree: 4 # Split each sequence into 4 parts, one per GPU
-flash_attention: true # Required with sequence parallelism
+sequence_parallel_degree : 4 # Split each sequence into 4 parts, one per GPU
+flash_attention : true # Required with sequence parallelism
-# Optional; strides across the key dimension. Larger values use more memory but will make training faster.
-heads_k_stride: 1
+# Optional; strides across the key dimension. Larger values use more memory but will make training faster.
+heads_k_stride : 1
```
See our [ dedicated guide ](sequence_parallelism.qmd) for more details.
diff --git a/docs/multi-node.html b/docs/multi-node.html
index d8f2054f6..20fdbc44b 100644
--- a/docs/multi-node.html
+++ b/docs/multi-node.html
@@ -2,7 +2,7 @@
-
+
@@ -22,8 +22,9 @@ ul.task-list li input[type="checkbox"] {
vertical-align: middle;
}
/* CSS for syntax highlighting */
+html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
-pre > code.sourceCode > span { line-height: 1.25; }
+pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
@@ -34,7 +35,7 @@ div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
-pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
+pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
@@ -65,15 +66,16 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
-
+
+
-
+
-
+
+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i
diff --git a/docs/multimodal.html b/docs/multimodal.html
index 65f9e9376..f100d1e45 100644
--- a/docs/multimodal.html
+++ b/docs/multimodal.html
@@ -2,7 +2,7 @@
-
+
@@ -21,8 +21,9 @@ ul.task-list li input[type="checkbox"] {
vertical-align: middle;
}
/* CSS for syntax highlighting */
+html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
-pre > code.sourceCode > span { line-height: 1.25; }
+pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
@@ -33,7 +34,7 @@ div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
-pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
+pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
@@ -64,15 +65,16 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
-
+
+
-
+
-
+
+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i
diff --git a/docs/multipack.html b/docs/multipack.html
index 0e7f34a14..b5a110a94 100644
--- a/docs/multipack.html
+++ b/docs/multipack.html
@@ -2,7 +2,7 @@
-
+
@@ -31,15 +31,16 @@ ul.task-list li input[type="checkbox"] {
-
+
+
-
+
-
+
+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i
diff --git a/docs/nccl.html b/docs/nccl.html
index 02411bdee..45cf58f54 100644
--- a/docs/nccl.html
+++ b/docs/nccl.html
@@ -2,7 +2,7 @@
-
+
@@ -22,8 +22,9 @@ ul.task-list li input[type="checkbox"] {
vertical-align: middle;
}
/* CSS for syntax highlighting */
+html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
-pre > code.sourceCode > span { line-height: 1.25; }
+pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
@@ -34,7 +35,7 @@ div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
-pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
+pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
@@ -65,15 +66,16 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
-
+
+
-
+
-
+
+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i
diff --git a/docs/ray-integration.html b/docs/ray-integration.html
index 725802eab..f25c5811f 100644
--- a/docs/ray-integration.html
+++ b/docs/ray-integration.html
@@ -2,7 +2,7 @@
-
+
@@ -22,8 +22,9 @@ ul.task-list li input[type="checkbox"] {
vertical-align: middle;
}
/* CSS for syntax highlighting */
+html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
-pre > code.sourceCode > span { line-height: 1.25; }
+pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
@@ -34,7 +35,7 @@ div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
-pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
+pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
@@ -65,15 +66,16 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
-
+
+
-
+
-
+
+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i
diff --git a/docs/reward_modelling.html b/docs/reward_modelling.html
index e07ef8c19..482b4a36c 100644
--- a/docs/reward_modelling.html
+++ b/docs/reward_modelling.html
@@ -2,7 +2,7 @@
-
+
@@ -22,8 +22,9 @@ ul.task-list li input[type="checkbox"] {
vertical-align: middle;
}
/* CSS for syntax highlighting */
+html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
-pre > code.sourceCode > span { line-height: 1.25; }
+pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
@@ -34,7 +35,7 @@ div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
-pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
+pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
@@ -65,15 +66,16 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
-
+
+
-
+
-
+
+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i
diff --git a/docs/rlhf.html b/docs/rlhf.html
index 97293640c..9d3481f54 100644
--- a/docs/rlhf.html
+++ b/docs/rlhf.html
@@ -2,7 +2,7 @@
-
+
@@ -22,8 +22,9 @@ ul.task-list li input[type="checkbox"] {
vertical-align: middle;
}
/* CSS for syntax highlighting */
+html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
-pre > code.sourceCode > span { line-height: 1.25; }
+pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
@@ -34,7 +35,7 @@ div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
-pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
+pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
@@ -65,15 +66,16 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
-
+
+
-
+
-
+
+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i
diff --git a/docs/sequence_parallelism.html b/docs/sequence_parallelism.html
index 09664f777..4c14a5a8d 100644
--- a/docs/sequence_parallelism.html
+++ b/docs/sequence_parallelism.html
@@ -2,7 +2,7 @@
-
+
@@ -22,8 +22,9 @@ ul.task-list li input[type="checkbox"] {
vertical-align: middle;
}
/* CSS for syntax highlighting */
+html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
-pre > code.sourceCode > span { line-height: 1.25; }
+pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
@@ -34,7 +35,7 @@ div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
-pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
+pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
@@ -65,15 +66,16 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
-
+
+
-
+
-
+
+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i
diff --git a/docs/torchao.html b/docs/torchao.html
index 7dbdb9e65..4cff35095 100644
--- a/docs/torchao.html
+++ b/docs/torchao.html
@@ -2,7 +2,7 @@
-
+
@@ -22,8 +22,9 @@ ul.task-list li input[type="checkbox"] {
vertical-align: middle;
}
/* CSS for syntax highlighting */
+html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
-pre > code.sourceCode > span { line-height: 1.25; }
+pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
@@ -34,7 +35,7 @@ div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
-pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
+pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
@@ -65,15 +66,16 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
-
+
+
-
+
-
+
+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i
diff --git a/docs/unsloth.html b/docs/unsloth.html
index e459527c8..8c4f37739 100644
--- a/docs/unsloth.html
+++ b/docs/unsloth.html
@@ -2,7 +2,7 @@
@@ -22,8 +22,9 @@ ul.task-list li input[type="checkbox"] {
vertical-align: middle;
}
/* CSS for syntax highlighting */
+html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
-pre > code.sourceCode > span { line-height: 1.25; }
+pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
@@ -34,7 +35,7 @@ div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
-pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
+pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
@@ -65,15 +66,16 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
+ let selectedAnnoteEl;
+ const selectorForAnnotation = ( cell, annotation) => {
+ let cellAttr = 'data-code-cell="' + cell + '"';
+ let lineAttr = 'data-code-annotation="' + annotation + '"';
+ const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
+ return selector;
+ }
+ const selectCodeLines = (annoteEl) => {
+ const doc = window.document;
+ const targetCell = annoteEl.getAttribute("data-target-cell");
+ const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
+ const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
+ const lines = annoteSpan.getAttribute("data-code-lines").split(",");
+ const lineIds = lines.map((line) => {
+ return targetCell + "-" + line;
+ })
+ let top = null;
+ let height = null;
+ let parent = null;
+ if (lineIds.length > 0) {
+ //compute the position of the single el (top and bottom and make a div)
+ const el = window.document.getElementById(lineIds[0]);
+ top = el.offsetTop;
+ height = el.offsetHeight;
+ parent = el.parentElement.parentElement;
+ if (lineIds.length > 1) {
+ const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
+ const bottom = lastEl.offsetTop + lastEl.offsetHeight;
+ height = bottom - top;
+ }
+ if (top !== null && height !== null && parent !== null) {
+ // cook up a div (if necessary) and position it
+ let div = window.document.getElementById("code-annotation-line-highlight");
+ if (div === null) {
+ div = window.document.createElement("div");
+ div.setAttribute("id", "code-annotation-line-highlight");
+ div.style.position = 'absolute';
+ parent.appendChild(div);
+ }
+ div.style.top = top - 2 + "px";
+ div.style.height = height + 4 + "px";
+ div.style.left = 0;
+ let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
+ if (gutterDiv === null) {
+ gutterDiv = window.document.createElement("div");
+ gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
+ gutterDiv.style.position = 'absolute';
+ const codeCell = window.document.getElementById(targetCell);
+ const gutter = codeCell.querySelector('.code-annotation-gutter');
+ gutter.appendChild(gutterDiv);
+ }
+ gutterDiv.style.top = top - 2 + "px";
+ gutterDiv.style.height = height + 4 + "px";
+ }
+ selectedAnnoteEl = annoteEl;
+ }
+ };
+ const unselectCodeLines = () => {
+ const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
+ elementsIds.forEach((elId) => {
+ const div = window.document.getElementById(elId);
+ if (div) {
+ div.remove();
+ }
+ });
+ selectedAnnoteEl = undefined;
+ };
+ // Handle positioning of the toggle
+ window.addEventListener(
+ "resize",
+ throttle(() => {
+ elRect = undefined;
+ if (selectedAnnoteEl) {
+ selectCodeLines(selectedAnnoteEl);
+ }
+ }, 10)
+ );
+ function throttle(fn, ms) {
+ let throttle = false;
+ let timer;
+ return (...args) => {
+ if(!throttle) { // first call gets through
+ fn.apply(this, args);
+ throttle = true;
+ } else { // all the others get throttled
+ if(timer) clearTimeout(timer); // cancel #2
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ timer = throttle = false;
+ }, ms);
+ }
+ };
+ }
+ // Attach click handler to the DT
+ const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
+ for (const annoteDlNode of annoteDls) {
+ annoteDlNode.addEventListener('click', (event) => {
+ const clickedEl = event.target;
+ if (clickedEl !== selectedAnnoteEl) {
+ unselectCodeLines();
+ const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
+ if (activeEl) {
+ activeEl.classList.remove('code-annotation-active');
+ }
+ selectCodeLines(clickedEl);
+ clickedEl.classList.add('code-annotation-active');
+ } else {
+ // Unselect the line
+ unselectCodeLines();
+ clickedEl.classList.remove('code-annotation-active');
+ }
+ });
+ }
+ const findCites = (el) => {
+ const parentEl = el.parentElement;
+ if (parentEl) {
+ const cites = parentEl.dataset.cites;
+ if (cites) {
+ return {
+ el,
+ cites: cites.split(' ')
+ };
+ } else {
+ return findCites(el.parentElement)
+ }
+ } else {
+ return undefined;
+ }
+ };
+ var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
+ for (var i=0; i