diff --git a/docs/custom_integrations.qmd b/docs/custom_integrations.qmd index 8e89ee81a4..180f02a64c 100644 --- a/docs/custom_integrations.qmd +++ b/docs/custom_integrations.qmd @@ -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)) +```