Skip to content

Commit 92b504b

Browse files
deploy changes
1 parent 24e0ff1 commit 92b504b

23 files changed

Lines changed: 1860 additions & 2 deletions

.github/workflows/docs.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "docs/**"
9+
- "mkdocs.yml"
10+
11+
12+
concurrency:
13+
group: pages
14+
cancel-in-progress: true
15+
16+
jobs:
17+
deploy:
18+
if: github.repository == 'Sllambias/asparagus'
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.11"
32+
33+
- name: Install docs dependencies
34+
run: |
35+
pip install mkdocs>=1.6.0 mkdocs-shadcn "mkdocstrings[python]>=0.27.0"
36+
37+
- name: Deploy to GitHub Pages
38+
run: mkdocs gh-deploy --force

docs/advanced/common_issues.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
### torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised:
3+
Example error:
4+
```
5+
torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised:
6+
JSONDecodeError: Extra data: line 1 column 182 (char 181)
7+
Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information
8+
You can suppress this exception and fall back to eager by setting:
9+
import torch._dynamo
10+
torch._dynamo.config.suppress_errors = True
11+
[W 2025-11-28 11:30:51,861] Trial 18 failed with value None.
12+
Trial 18 failed: backend='inductor' raised:
13+
JSONDecodeError: Extra data: line 1 column 182 (char 181)
14+
Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information
15+
You can suppress this exception and fall back to eager by setting:
16+
import torch._dynamo
17+
torch._dynamo.config.suppress_errors = True
18+
```
19+
20+
Solution:
21+
```export TORCHINDUCTOR_FORCE_DISABLE_CACHES=1```
22+
23+
### CUDA Device does not support bfloat16.
24+
Example error:
25+
26+
Solution:
27+
```hardware.precision=float32```
28+
29+
### NumExpr detected 48 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 16.
30+
See [CUDA Device does not support bfloat16](#cuda-device-does-not-support-bfloat16)

docs/advanced/hacking_asparagus.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Hacking Asparagus
2+
Using your own LightningModule or Datamodule or an entirely different train.py script?
3+
No problem. Go into `/configs/core/base` and change the relevant path to one of your liking.
4+
5+
To change the LightningModule AND the default module path from where LightningModules are imported:
6+
7+
```
8+
lightning:
9+
lightning_module: MyFancyLightningModule
10+
_lightning_module:
11+
_target_: my.own.local.repo.${lightning.lightning_module}
12+
```
13+
14+
To change the train script you can simply write your MyTrain.py and call it like we would otherwise call the default scripts. (Remember to point it to the correct config or change it in the CLI.)
15+
16+
```
17+
@hydra.main(
18+
config_path=get_config_path(),
19+
config_name="train",
20+
version_base="1.2",
21+
)
22+
def train(cfg: DictConfig) -> None:
23+
# Your Code Here
24+
25+
if __name__ == "__main__":
26+
train()
27+
```

docs/advanced/training_times.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
PRETRAIN
2+
3+
| it/s | GPU(s) | Workers | Model | Augmentations | Plugins (time) | Patch Size |
4+
| ---- | ------ | ------- | ------------- | ------------------- | ----------------- | ---------- |
5+
| 8.42 | A100 | 14 | UNet_b_lw_dec | None | N/A | 128*3 |
6+
| 8.60 | A100 | 28 | UNet_b_lw_dec | None | N/A | 128*3 |
7+
| 3.25 | A100 | 14 | UNet_b_lw_dec | all: 0.3 @ CPU | N/A | 128*3 |
8+
| 6.50 | A100 | 28 | UNet_b_lw_dec | all: 0.3 @ CPU | N/A | 128*3 |
9+
| 7.97 | A100 | 44 | UNet_b_lw_dec | all: 0.3 @ CPU | N/A | 128*3 |
10+
| 6.35 | A100 | 14 | UNet_b_lw_dec | all: 0.3 @ GPU | N/A | 128*3 |
11+
| 6.85 | A100 | 28 | UNet_b_lw_dec | all: 0.3 @ GPU | N/A | 128*3 |
12+
| 7.04 | A100 | 14 | UNet_b_lw_dec | onlyspa: 0.3 @ GPU | N/A | 128*3 |
13+
| 9.55 | A100 | 14 | UNet_b_lw_dec | nospa: 0.3 @ GPU | N/A | 128*3 |
14+
| 6.98 | A100 | 14 | UNet_b_lw_dec | nodeform: 0.3 @ GPU | N/A | 128*3 |
15+
| 7.05 | A100 | 14 | UNet_b_lw_dec | norot: 0.3 @ GPU | N/A | 128*3 |
16+
| 7.08 | A100 | 14 | UNet_b_lw_dec | noscale: 0.3 @ GPU | N/A | 128*3 |
17+
| 6.40 | A100 | 14 | UNet_b_lw_dec | spa0: 0.3 @ GPU | N/A | 128*3 |
18+
| 9.40 | A100 | 28 | UNet_b_lw_dec | spaCPU: 0.3 @ GPU | N/A | 128*3 |
19+
| 8.98 | A100 | 14 | UNet_b_lw_dec | spaCPU: 0.3 @ GPU | N/A | 128*3 |
20+
| 9.60 | A100 | 44 | UNet_b_lw_dec | spaCPU: 0.3 @ GPU | N/A | 128*3 |
21+
| 9.60 | A100 | 44 | UNet_b_lw_dec | spaCPU: 0.3 @ GPU | 12it/s (3600/300) | 128*3 |
22+
23+
SEGMENTATION
24+
25+
| it/s | GPU(s) | Workers | Model | Augmentations | Plugins (time) | Patch Size |
26+
| ---- | ------ | ------- | ------ | ------------- | -------------- | ---------- |
27+
| 5.86 | A100 | 14 | UNet_b | N/A | N/A | 128*3 |
28+
| 6.60 | A100 | 14 | UNet_b | N/A | N/A | 128*3 |
29+
30+
CLASSIFICATION
31+
32+
| it/s | GPU(s) | Workers | Model | Augmentations | Plugins (time) | Image Size |
33+
| ----- | ------ | ------- | ------------- | ------------- | -------------- | ---------- |
34+
| 16.10 | A100 | 14 | UNet_clsreg_b | N/A | N/A | 128*3 |
35+
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
:root {
2+
--copy-btn-icon-color: #64748b;
3+
--copy-btn-icon-hover-color: #1e293b;
4+
--code-bg-color: #f5f5f5;
5+
--code-border-color: #e0e0e0;
6+
--code-text-color: #333333;
7+
--inline-code-bg: #f0f0f0;
8+
}
9+
10+
html.dark,
11+
html[data-theme="dark"],
12+
body.dark {
13+
--copy-btn-icon-color: #94a3b8;
14+
--copy-btn-icon-hover-color: #e2e8f0;
15+
--code-bg-color: #1f2937;
16+
--code-border-color: #374151;
17+
--code-text-color: #e5e7eb;
18+
--inline-code-bg: #374151;
19+
}
20+
21+
.code-block-wrapper {
22+
position: relative;
23+
margin-bottom: 2rem;
24+
}
25+
26+
.copy-button {
27+
position: absolute;
28+
top: 8px;
29+
right: 8px;
30+
padding: 6px 8px;
31+
background-color: transparent;
32+
border: none;
33+
color: var(--copy-btn-icon-color);
34+
cursor: pointer;
35+
font-size: 0.85em;
36+
font-weight: 500;
37+
transition: all 0.2s ease;
38+
z-index: 10;
39+
display: flex;
40+
align-items: center;
41+
gap: 4px;
42+
font-family: inherit;
43+
outline: none;
44+
}
45+
46+
.copy-button:hover {
47+
color: var(--copy-btn-icon-hover-color);
48+
}
49+
.copy-button:hover .copy-button-text {
50+
display: inline;
51+
}
52+
53+
.copy-button-text {
54+
display: none;
55+
}
56+
.copy-button:active {
57+
transform: scale(0.9);
58+
}
59+
60+
.copy-button.copied {
61+
color: #10b981;
62+
}
63+
.copy-button.copied .copy-button-text {
64+
display: inline;
65+
}
66+
67+
.copy-icon,
68+
.check-icon {
69+
width: 18px;
70+
height: 18px;
71+
display: inline-block;
72+
flex-shrink: 0;
73+
}
74+
.copy-button-text {
75+
font-size: 0.9em;
76+
}
77+
78+
.copy-icon {
79+
width: 16px;
80+
height: 16px;
81+
display: inline-block;
82+
}
83+
.check-icon {
84+
width: 16px;
85+
height: 16px;
86+
display: inline-block;
87+
}
88+
89+
.code-block-wrapper pre {
90+
overflow-x: auto;
91+
max-width: 100%;
92+
width: 100%;
93+
box-sizing: border-box;
94+
padding-right: 100px;
95+
position: relative;
96+
padding-left: 12px !important;
97+
padding-top: 12px !important;
98+
padding-bottom: 12px !important;
99+
margin: 0 !important;
100+
}
101+
102+
.code-block-wrapper pre code {
103+
padding-left: 0 !important;
104+
margin-left: 0 !important;
105+
display: block;
106+
}
107+
108+
@media (max-width: 768px) {
109+
.copy-button {
110+
display: none !important;
111+
}
112+
113+
.code-block-wrapper pre {
114+
padding-right: 12px !important;
115+
}
116+
}
117+
118+
pre {
119+
background-color: var(--code-bg-color) !important;
120+
border: 1px solid var(--code-border-color);
121+
border-radius: 4px;
122+
}
123+
124+
pre code {
125+
background-color: transparent !important;
126+
color: var(--code-text-color);
127+
}
128+
129+
code {
130+
background-color: var(--inline-code-bg);
131+
color: var(--code-text-color);
132+
padding: 2px 6px;
133+
border-radius: 3px;
134+
font-size: 0.9em;
135+
}

docs/assets/js/copy-code-button.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
document.addEventListener('DOMContentLoaded', function() {
2+
// SVG Icons
3+
const copyIconSVG = `<svg class="copy-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>`;
4+
const checkIconSVG = `<svg class="check-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>`;
5+
6+
// Find all code blocks
7+
const codeBlocks = document.querySelectorAll('pre');
8+
9+
codeBlocks.forEach((pre) => {
10+
// Create wrapper
11+
const wrapper = document.createElement('div');
12+
wrapper.className = 'code-block-wrapper';
13+
14+
// Insert wrapper before pre
15+
pre.parentNode.insertBefore(wrapper, pre);
16+
17+
// Move pre into wrapper
18+
wrapper.appendChild(pre);
19+
20+
// Create copy button
21+
const button = document.createElement('button');
22+
button.className = 'copy-button';
23+
button.type = 'button';
24+
button.innerHTML = copyIconSVG + '<span class="copy-button-text">Copy</span>';
25+
button.title = 'Copy code to clipboard';
26+
27+
// Add button to wrapper
28+
wrapper.appendChild(button);
29+
30+
// Copy functionality
31+
button.addEventListener('click', async function(e) {
32+
e.preventDefault();
33+
34+
// Get code text from the pre element
35+
const code = pre.innerText;
36+
37+
try {
38+
// Copy to clipboard
39+
await navigator.clipboard.writeText(code);
40+
41+
// Change button appearance
42+
button.classList.add('copied');
43+
button.innerHTML = checkIconSVG + '<span class="copy-button-text">Copied!</span>';
44+
45+
// Reset button after 2 seconds
46+
setTimeout(() => {
47+
button.classList.remove('copied');
48+
button.innerHTML = copyIconSVG + '<span class="copy-button-text">Copy</span>';
49+
}, 2000);
50+
} catch (err) {
51+
console.error('Failed to copy code:', err);
52+
button.innerHTML = '❌ <span class="copy-button-text">Failed</span>';
53+
setTimeout(() => {
54+
button.innerHTML = copyIconSVG + '<span class="copy-button-text">Copy</span>';
55+
}, 2000);
56+
}
57+
});
58+
});
59+
60+
// Watch for theme changes (for mkdocs-shadcn theme toggle)
61+
const observer = new MutationObserver(function(mutations) {
62+
mutations.forEach(function(mutation) {
63+
if (mutation.attributeName === 'class' || mutation.attributeName === 'data-theme') {
64+
// Force CSS variables update by triggering a repaint
65+
document.documentElement.style.colorScheme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
66+
}
67+
});
68+
});
69+
70+
// Observe html element for class/attribute changes
71+
observer.observe(document.documentElement, {
72+
attributes: true,
73+
attributeFilter: ['class', 'data-theme']
74+
});
75+
});

0 commit comments

Comments
 (0)