-
-
Notifications
You must be signed in to change notification settings - Fork 962
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: load custom integration doc dynamically
- Loading branch information
1 parent
cfa9583
commit 7ee474d
Showing
1 changed file
with
52 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,59 @@ | ||
--- | ||
title: Custom Integrations | ||
format: | ||
html: | ||
toc: true | ||
toc-depth: 2 | ||
--- | ||
|
||
|
||
```{python} | ||
#| echo: false | ||
import re | ||
def process_readme(integration_name): | ||
try: | ||
path = f'../src/axolotl/integrations/{integration_name}/README.md' | ||
with open(path, 'r') as f: | ||
txt = f.read() | ||
# Remove h1 headings | ||
txt = re.sub(r'^# .*\n?', '', txt, flags=re.MULTILINE) | ||
# Convert h2 to h3 | ||
txt = re.sub(r'^## ', '### ', txt, flags=re.MULTILINE) | ||
return txt | ||
except FileNotFoundError: | ||
return None | ||
def print_section(name, folder_name): | ||
output = f"\n## {name}\n" | ||
content = process_readme(folder_name) | ||
if content: | ||
output += content | ||
output += f"\nPlease see reference [here](https://github.com/axolotl-ai-cloud/axolotl/tree/main/src/axolotl/integrations/{folder_name})\n" | ||
return output | ||
``` | ||
|
||
```{python} | ||
#| output: asis | ||
#| echo: false | ||
# Introduction text | ||
print(""" | ||
Axolotl adds custom features through `integrations`. They are located within the `src/axolotl/integrations` directory. | ||
To enable them, please check the respective documentations. | ||
|
||
## Cut Cross Entropy | ||
|
||
Please see [here](https://github.com/axolotl-ai-cloud/axolotl/tree/main/src/axolotl/integrations/cut_cross_entropy) | ||
|
||
## Grokfast | ||
|
||
Please see [here](https://github.com/axolotl-ai-cloud/axolotl/tree/main/src/axolotl/integrations/grokfast) | ||
|
||
## Knowledge Distillation (KD) | ||
|
||
Please see [here](https://github.com/axolotl-ai-cloud/axolotl/tree/main/src/axolotl/integrations/kd) | ||
|
||
## Liger Kernels | ||
|
||
Please see [here](https://github.com/axolotl-ai-cloud/axolotl/tree/main/src/axolotl/integrations/liger) | ||
|
||
## Language Model Evaluation Harness (LM Eval) | ||
|
||
Please see [here](https://github.com/axolotl-ai-cloud/axolotl/tree/main/src/axolotl/integrations/lm_eval) | ||
|
||
## Spectrum | ||
|
||
Please see [here](https://github.com/axolotl-ai-cloud/axolotl/tree/main/src/axolotl/integrations/spectrum) | ||
""") | ||
# Sections | ||
sections = [ | ||
("Cut Cross Entropy", "cut_cross_entropy"), | ||
("Grokfast", "grokfast"), | ||
("Knowledge Distillation (KD)", "kd"), | ||
("Liger Kernels", "liger"), | ||
("Language Model Evaluation Harness (LM Eval)", "lm_eval"), | ||
("Spectrum", "spectrum") | ||
] | ||
for section_name, folder_name in sections: | ||
print(print_section(section_name, folder_name)) | ||
``` |