menna commited on
Commit
e9bee6f
1 Parent(s): f2ffe02

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
.bandit ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [bandit]
2
+ exclude = tests
3
+ skips = B101
.editorconfig ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ root = true
2
+
3
+ [*]
4
+ end_of_line = lf
5
+ insert_final_newline = true
6
+ trim_trailing_whitespace = true
7
+
8
+ [*.py]
9
+ indent_style = space
10
+ indent_size = 4
11
+
12
+ [**.yml]
13
+ indent_style = space
14
+ indent_size = 2
.flake8 ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ [flake8]
2
+ max-line-length = 88
3
+
4
+ select = C,E,F,W,B,B950
5
+ extend-ignore = E203, E501, W503
.gitattributes CHANGED
@@ -1,35 +1,44 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
1
+ data/*.jsonl filter=lfs diff=lfs merge=lfs -text
2
+ axol/bin/python filter=lfs diff=lfs merge=lfs -text
3
+ axol/bin/python3 filter=lfs diff=lfs merge=lfs -text
4
+ axol/bin/python3.10 filter=lfs diff=lfs merge=lfs -text
5
+ git-lfs-3.2.0/git-lfs filter=lfs diff=lfs merge=lfs -text
6
+ git-lfs-linux-amd64-v3.2.0.tar.gz filter=lfs diff=lfs merge=lfs -text
7
+ out/adapter_model.bin filter=lfs diff=lfs merge=lfs -text
8
+ out/adapter_model.safetensors filter=lfs diff=lfs merge=lfs -text
9
+ out/checkpoint-126/adapter_model.safetensors filter=lfs diff=lfs merge=lfs -text
10
+ out/checkpoint-126/optimizer.pt filter=lfs diff=lfs merge=lfs -text
11
+ out/checkpoint-126/rng_state_0.pth filter=lfs diff=lfs merge=lfs -text
12
+ out/checkpoint-126/rng_state_1.pth filter=lfs diff=lfs merge=lfs -text
13
+ out/checkpoint-126/scheduler.pt filter=lfs diff=lfs merge=lfs -text
14
+ out/checkpoint-126/tokenizer.model filter=lfs diff=lfs merge=lfs -text
15
+ out/checkpoint-126/training_args.bin filter=lfs diff=lfs merge=lfs -text
16
+ out/checkpoint-189/adapter_model.safetensors filter=lfs diff=lfs merge=lfs -text
17
+ out/checkpoint-189/optimizer.pt filter=lfs diff=lfs merge=lfs -text
18
+ out/checkpoint-189/rng_state_0.pth filter=lfs diff=lfs merge=lfs -text
19
+ out/checkpoint-189/rng_state_1.pth filter=lfs diff=lfs merge=lfs -text
20
+ out/checkpoint-189/scheduler.pt filter=lfs diff=lfs merge=lfs -text
21
+ out/checkpoint-189/tokenizer.model filter=lfs diff=lfs merge=lfs -text
22
+ out/checkpoint-189/training_args.bin filter=lfs diff=lfs merge=lfs -text
23
+ out/checkpoint-230/adapter_model.safetensors filter=lfs diff=lfs merge=lfs -text
24
+ out/checkpoint-230/optimizer.pt filter=lfs diff=lfs merge=lfs -text
25
+ out/checkpoint-230/rng_state_0.pth filter=lfs diff=lfs merge=lfs -text
26
+ out/checkpoint-230/rng_state_1.pth filter=lfs diff=lfs merge=lfs -text
27
+ out/checkpoint-230/scheduler.pt filter=lfs diff=lfs merge=lfs -text
28
+ out/checkpoint-230/tokenizer.model filter=lfs diff=lfs merge=lfs -text
29
+ out/checkpoint-230/training_args.bin filter=lfs diff=lfs merge=lfs -text
30
+ out/checkpoint-345/adapter_model.safetensors filter=lfs diff=lfs merge=lfs -text
31
+ out/checkpoint-345/optimizer.pt filter=lfs diff=lfs merge=lfs -text
32
+ out/checkpoint-345/rng_state_0.pth filter=lfs diff=lfs merge=lfs -text
33
+ out/checkpoint-345/rng_state_1.pth filter=lfs diff=lfs merge=lfs -text
34
+ out/checkpoint-345/scheduler.pt filter=lfs diff=lfs merge=lfs -text
35
+ out/checkpoint-345/tokenizer.model filter=lfs diff=lfs merge=lfs -text
36
+ out/checkpoint-345/training_args.bin filter=lfs diff=lfs merge=lfs -text
37
+ out/merged/git-lfs-3.2.0/git-lfs filter=lfs diff=lfs merge=lfs -text
38
+ out/merged/git-lfs-linux-amd64-v3.2.0.tar.gz.1 filter=lfs diff=lfs merge=lfs -text
39
+ out/merged/pytorch_model-00001-of-00003.bin filter=lfs diff=lfs merge=lfs -text
40
+ out/merged/pytorch_model-00002-of-00003.bin filter=lfs diff=lfs merge=lfs -text
41
+ out/merged/pytorch_model-00003-of-00003.bin filter=lfs diff=lfs merge=lfs -text
42
+ out/merged/tokenizer.model filter=lfs diff=lfs merge=lfs -text
43
+ out/tokenizer.model filter=lfs diff=lfs merge=lfs -text
44
+ out/training_args.bin filter=lfs diff=lfs merge=lfs -text
.github/CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement on Discord
63
+ at https://discord.gg/QYF8QrtEUm
64
+
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series
87
+ of actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or
94
+ permanent ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within
114
+ the community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.0, available at
120
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
121
+
122
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
123
+ enforcement ladder](https://github.com/mozilla/diversity).
124
+
125
+ [homepage]: https://www.contributor-covenant.org
126
+
127
+ For answers to common questions about this code of conduct, see the FAQ at
128
+ https://www.contributor-covenant.org/faq. Translations are available at
129
+ https://www.contributor-covenant.org/translations.
.github/CONTRIBUTING.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to axolotl
2
+
3
+ First of all, thank you for your interest in contributing to axolotl! We appreciate the time and effort you're willing to invest in making our project better. This document provides guidelines and information to make the contribution process as smooth as possible.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Code of Conduct](#code-of-conduct)
8
+ - [Getting Started](#getting-started)
9
+ - [How to Contribute](#how-to-contribute)
10
+ - [Reporting Bugs](#reporting-bugs)
11
+ - [Suggesting Enhancements](#suggesting-enhancements)
12
+ - [Submitting Pull Requests](#submitting-pull-requests)
13
+ - [Style Guidelines](#style-guidelines)
14
+ - [Code Style](#code-style)
15
+ - [Commit Messages](#commit-messages)
16
+ - [Additional Resources](#additional-resources)
17
+
18
+ ## Code of Conductcode
19
+
20
+ All contributors are expected to adhere to our [Code of Conduct](CODE_OF_CONDUCT.md). Please read it before participating in the axolotl community.
21
+
22
+ ## Getting Started
23
+
24
+ Bugs? Please check for open issue else create a new [Issue](https://github.com/OpenAccess-AI-Collective/axolotl/issues/new).
25
+
26
+ PRs are **greatly welcome**!
27
+
28
+ 1. Fork the repository and clone it to your local machine.
29
+ 2. Set up the development environment by following the instructions in the [README.md](https://github.com/OpenAccess-AI-Collective/axolotl/tree/main/README.md) file.
30
+ 3. Explore the codebase, run tests, and verify that everything works as expected.
31
+
32
+ Please run below to setup env
33
+ ```bash
34
+ pip3 install -r requirements-dev.txt -r requirements-tests.txt
35
+ pre-commit install
36
+
37
+ # test
38
+ pytest tests/
39
+ ```
40
+
41
+ ## How to Contribute
42
+
43
+ ### Reporting Bugs
44
+
45
+ If you encounter a bug or issue while using axolotl, please open a new issue on the [GitHub Issues](https://github.com/OpenAccess-AI-Collective/axolotl/issues) page. Provide a clear and concise description of the problem, steps to reproduce it, and any relevant error messages or logs.
46
+
47
+ ### Suggesting Enhancements
48
+
49
+ We welcome ideas for improvements and new features. To suggest an enhancement, open a new issue on the [GitHub Issues](https://github.com/OpenAccess-AI-Collective/axolotl/issues) page. Describe the enhancement in detail, explain the use case, and outline the benefits it would bring to the project.
50
+
51
+ ### Submitting Pull Requests
52
+
53
+ 1. Create a new branch for your feature or bugfix. Use a descriptive name like `feature/your-feature-name` or `fix/your-bugfix-name`.
54
+ 2. Make your changes, following the [Style Guidelines](#style-guidelines) below.
55
+ 3. Test your changes and ensure that they don't introduce new issues or break existing functionality.
56
+ 4. Commit your changes, following the [commit message guidelines](#commit-messages).
57
+ 5. Push your branch to your fork on GitHub.
58
+ 6. Open a new pull request against the `main` branch of the axolotl repository. Include a clear and concise description of your changes, referencing any related issues.
59
+
60
+ ## Style Guidelines
61
+
62
+ ### Code Style
63
+
64
+ axolotl uses [{codestyle}]({URLofCodestyle}) as its code style guide. Please ensure that your code follows these guidelines.
65
+
66
+ ### Commit Messages
67
+
68
+ Write clear and concise commit messages that briefly describe the changes made in each commit. Use the imperative mood and start with a capitalized verb, e.g., "Add new feature" or "Fix bug in function".
69
+
70
+ ## Additional Resources
71
+
72
+ - [GitHub Help](https://help.github.com/)
73
+ - [GitHub Pull Request Documentation](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests)
74
+ - [{codestyle}]({URLofCodestyle})
75
+
76
+ Thank you once again for your interest in contributing to axolotl. We look forward to collaborating with you and creating an even better project together!
.github/FUNDING.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # These are supported funding model platforms
2
+
3
+ github: [winglian, OpenAccess-AI-Collective] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: axolotl_ai # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13
+ custom: ['https://quickchart.io/qr?text=bitcoin%3Abc1qxlgwlqwfea5s2cxm42xqsfmwjct0rj8w8ea5np&size=480&centerImageUrl=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2F4%2F46%2FBitcoin.svg%2F64px-Bitcoin.svg.png'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
.github/ISSUE_TEMPLATE/bug-report.yaml ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Bug Report
2
+ description: File a bug report
3
+ labels: ["bug", "needs triage"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ ## Before you start
9
+ Please **make sure you are on the latest version.**
10
+ If you encountered the issue after you installed, updated, or reloaded, **please try restarting before reporting the bug**.
11
+
12
+ - type: checkboxes
13
+ id: no-duplicate-issues
14
+ attributes:
15
+ label: "Please check that this issue hasn't been reported before."
16
+ description: "The **Label filters** may help make your search more focussed."
17
+ options:
18
+ - label: "I searched previous [Bug Reports](https://github.com/OpenAccess-AI-Collective/axolotl/labels/bug) didn't find any similar reports."
19
+ required: true
20
+
21
+ - type: textarea
22
+ id: expected
23
+ attributes:
24
+ label: Expected Behavior
25
+ description: Tell us what **should** happen.
26
+ validations:
27
+ required: true
28
+
29
+ - type: textarea
30
+ id: what-happened
31
+ attributes:
32
+ label: Current behaviour
33
+ description: |
34
+ Tell us what happens instead of the expected behavior.
35
+ Provide stacktrace and/or screenshots.
36
+ validations:
37
+ required: true
38
+
39
+ - type: textarea
40
+ id: reproduce
41
+ attributes:
42
+ label: Steps to reproduce
43
+ description: |
44
+ Which exact steps can a developer take to reproduce the issue?
45
+ The more detail you provide, the easier it will be to narrow down and fix the bug.
46
+ Please paste in tasks and/or queries **as text, not screenshots**.
47
+ placeholder: |
48
+ Example of the level of detail needed to reproduce any bugs efficiently and reliably.
49
+ 1. Go to the '...' page.
50
+ 2. Click on the '...' button.
51
+ 3. Scroll down to '...'.
52
+ 4. Observe the error.
53
+ validations:
54
+ required: true
55
+
56
+ - type: textarea
57
+ id: config
58
+ attributes:
59
+ label: Config yaml
60
+ description: |
61
+ Please attach the config yaml!
62
+ render: yaml
63
+
64
+ - type: textarea
65
+ id: possible-solution
66
+ attributes:
67
+ label: Possible solution
68
+ description: |
69
+ Not obligatory, but please suggest a fix or reason for the bug, if you have an idea.
70
+
71
+
72
+ - type: checkboxes
73
+ id: operating-systems
74
+ attributes:
75
+ label: Which Operating Systems are you using?
76
+ description: You may select more than one.
77
+ options:
78
+ - label: Linux
79
+ - label: macOS
80
+ - label: Windows
81
+
82
+ - type: input
83
+ id: Python-version
84
+ attributes:
85
+ label: Python Version
86
+ description: Which {Programming} version are you using?
87
+ placeholder: 3.10 / please change accordingly
88
+ validations:
89
+ required: true
90
+
91
+ - type: input
92
+ id: axolotl-branch-commit
93
+ attributes:
94
+ label: axolotl branch-commit
95
+ description: On which branch/commit are you?
96
+ placeholder: main/4d6490b
97
+ validations:
98
+ required: true
99
+
100
+ - type: checkboxes
101
+ id: acknowledgements
102
+ attributes:
103
+ label: 'Acknowledgements'
104
+ description: 'Please confirm the following:'
105
+ options:
106
+ - label: 'My issue title is concise, descriptive, and in title casing.'
107
+ required: true
108
+ - label: 'I have searched the existing issues to make sure this bug has not been reported yet.'
109
+ required: true
110
+ - label: 'I am using the latest version of axolotl.'
111
+ required: true
112
+ - label: 'I have provided enough information for the maintainers to reproduce and diagnose the issue.'
113
+ required: true
.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Ask a question
4
+ url: https://github.com/OpenAccess-AI-Collective/axolotl/discussions/categories/q-a
5
+ about: Ask questions and discuss with other community members
6
+ - name: Discuss the Project in Discord
7
+ url: https://discord.gg/HhrNrHJPRb
.github/ISSUE_TEMPLATE/docs.yml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Documentation Improvement / Clarity
2
+ description: Make a suggestion to improve the project documentation.
3
+ labels: ['needs triage', 'docs']
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: '## :book: Documentation :book:'
8
+ - type: markdown
9
+ attributes:
10
+ value: |
11
+ * Ask questions in [Discord](https://discord.gg/HhrNrHJPRb).
12
+ * Before you file an issue read the [Contributing guide](./CONTRIBUTING.md).
13
+ * Check to make sure someone hasn't already opened a [similar issue](https://github.com/OpenAccess-AI-Collective/axolotl/issues).
14
+ - type: textarea
15
+ attributes:
16
+ label: What piece of documentation is affected?
17
+ description: Please link to the article you'd like to see updated.
18
+ validations:
19
+ required: true
20
+ - type: textarea
21
+ attributes:
22
+ label: What part(s) of the article would you like to see updated?
23
+ description: |
24
+ - Give as much detail as you can to help us understand the change you want to see.
25
+ - Why should the docs be changed? What use cases does it support?
26
+ - What is the expected outcome?
27
+ validations:
28
+ required: true
29
+ - type: textarea
30
+ attributes:
31
+ label: Additional Information
32
+ description: Add any other context or screenshots about the feature request here.
33
+ validations:
34
+ required: false
35
+ - type: checkboxes
36
+ id: acknowledgements
37
+ attributes:
38
+ label: 'Acknowledgements'
39
+ description: 'Please confirm the following:'
40
+ options:
41
+ - label: 'My issue title is concise, descriptive, and in title casing.'
42
+ required: true
43
+ - label: 'I have searched the existing issues to make sure this feature has not been requested yet.'
44
+ required: true
45
+ - label: 'I have provided enough information for the maintainers to understand and evaluate this request.'
46
+ required: true
.github/ISSUE_TEMPLATE/feature-request.yaml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Feature Request / Enhancement
2
+ description: Suggest a new feature or feature enhancement for the project
3
+ labels: ["enhancement", "needs triage"]
4
+ body:
5
+ - type: checkboxes
6
+ id: no-duplicate-issues
7
+ attributes:
8
+ label: "⚠️ Please check that this feature request hasn't been suggested before."
9
+ description: "There are two locations for previous feature requests. Please search in both. Thank you. The **Label filters** may help make your search more focussed."
10
+ options:
11
+ - label: "I searched previous [Ideas in Discussions](https://github.com/OpenAccess-AI-Collective/axolotl/discussions/categories/ideas) didn't find any similar feature requests."
12
+ required: true
13
+ - label: "I searched previous [Issues](https://github.com/OpenAccess-AI-Collective/axolotl/labels/enhancement) didn't find any similar feature requests."
14
+ required: true
15
+
16
+ - type: textarea
17
+ id: feature-description
18
+ validations:
19
+ required: true
20
+ attributes:
21
+ label: "🔖 Feature description"
22
+ description: "A clear and concise description of what the feature request is."
23
+ placeholder: "You should add ..."
24
+
25
+ - type: textarea
26
+ id: solution
27
+ validations:
28
+ required: true
29
+ attributes:
30
+ label: "✔️ Solution"
31
+ description: "A clear and concise description of what you want to happen, and why."
32
+ placeholder: "In my use-case, ..."
33
+
34
+ - type: textarea
35
+ id: alternatives
36
+ validations:
37
+ required: false
38
+ attributes:
39
+ label: "❓ Alternatives"
40
+ description: "A clear and concise description of any alternative solutions or features you've considered."
41
+ placeholder: "I have considered ..."
42
+
43
+ - type: textarea
44
+ id: additional-context
45
+ validations:
46
+ required: false
47
+ attributes:
48
+ label: "📝 Additional Context"
49
+ description: "Add any other context or screenshots about the feature request here."
50
+ placeholder: "..."
51
+
52
+ - type: checkboxes
53
+ id: acknowledgements
54
+ attributes:
55
+ label: 'Acknowledgements'
56
+ description: 'Please confirm the following:'
57
+ options:
58
+ - label: 'My issue title is concise, descriptive, and in title casing.'
59
+ required: true
60
+ - label: 'I have searched the existing issues to make sure this feature has not been requested yet.'
61
+ required: true
62
+ - label: 'I have provided enough information for the maintainers to understand and evaluate this request.'
63
+ required: true
.github/PULL_REQUEST_TEMPLATE.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--- Provide a general summary of your changes in the Title above -->
2
+
3
+ # Description
4
+
5
+ <!--- Describe your changes in detail -->
6
+
7
+ ## Motivation and Context
8
+
9
+ <!--- Why is this change required? What problem does it solve? -->
10
+ <!--- If it fixes an open issue, please link to the issue here. -->
11
+
12
+ ## How has this been tested?
13
+
14
+ <!--- Please describe in detail how you tested your changes. -->
15
+ <!--- Include details of your testing environment, tests ran to see how -->
16
+ <!--- your change affects other areas of the code, etc. -->
17
+
18
+ ## Screenshots (if appropriate)
19
+
20
+ ## Types of changes
21
+
22
+ <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
23
+
24
+ ## Social Handles (Optional)
25
+
26
+ <!-- Thanks for submitting a bugfix or enhancement. -->
27
+ <!-- We'd love to show our thanks to you on Twitter & Discord if you provide your handle -->
.github/SECURITY.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Due to the nature of the fast development that is happening in this project, only the latest released version can be supported.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ If you find a vulnerability, please contact us on [Discord](https://discord.gg/xcu3ECkH9a) rather than creating a GitHub issue to allow us some time to fix it before it is a known vulnerability to others.
.github/SUPPORT.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Support
2
+
3
+ If you need help with this project or have questions, please:
4
+
5
+ 1. Check the documentation.
6
+ 2. Search the existing issues and pull requests.
7
+ 3. Create a new issue if your question is not answered or your problem is not solved.
8
+ 4. Have a look in the [Discord server](https://discord.gg/HhrNrHJPRb)
9
+
10
+ Please note that this project is maintained by volunteers who have limited availability. We'll do our best to address your questions and concerns in a timely manner.
.github/release-drafter.yml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name-template: 'v$RESOLVED_VERSION'
2
+ tag-template: 'v$RESOLVED_VERSION'
3
+ categories:
4
+ - title: '🚀 Features'
5
+ labels:
6
+ - 'feature'
7
+ - 'enhancement'
8
+ - title: '🐛 Bug Fixes'
9
+ labels:
10
+ - 'fix'
11
+ - 'bugfix'
12
+ - 'bug'
13
+ - title: '🧰 Maintenance'
14
+ label: 'chore'
15
+ change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
16
+ change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
17
+ version-resolver:
18
+ major:
19
+ labels:
20
+ - 'major'
21
+ minor:
22
+ labels:
23
+ - 'minor'
24
+ patch:
25
+ labels:
26
+ - 'patch'
27
+ default: patch
28
+ template: |
29
+ ## What’s Changed
30
+
31
+ $CHANGES
.github/workflows/base.yml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: ci-cd-base
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ build-base:
8
+ if: github.repository_owner == 'OpenAccess-AI-Collective'
9
+ # this job needs to be run on self-hosted GPU runners...
10
+ runs-on: axolotl-gpu-runner
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ include:
15
+ - cuda: "118"
16
+ cuda_version: 11.8.0
17
+ python_version: "3.10"
18
+ pytorch: 2.1.2
19
+ torch_cuda_arch_list: "7.0 7.5 8.0 8.6 9.0+PTX"
20
+ - cuda: "121"
21
+ cuda_version: 12.1.0
22
+ python_version: "3.10"
23
+ pytorch: 2.1.2
24
+ torch_cuda_arch_list: "7.0 7.5 8.0 8.6 9.0+PTX"
25
+ - cuda: "121"
26
+ cuda_version: 12.1.0
27
+ python_version: "3.11"
28
+ pytorch: 2.1.2
29
+ torch_cuda_arch_list: "7.0 7.5 8.0 8.6 9.0+PTX"
30
+ steps:
31
+ - name: Checkout
32
+ uses: actions/checkout@v3
33
+ - name: Docker metadata
34
+ id: metadata
35
+ uses: docker/metadata-action@v3
36
+ with:
37
+ images: winglian/axolotl-base
38
+ - name: Login to Docker Hub
39
+ uses: docker/login-action@v2
40
+ with:
41
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
42
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
43
+ - name: Set up Docker Buildx
44
+ uses: docker/setup-buildx-action@v2
45
+ - name: Build
46
+ uses: docker/build-push-action@v4
47
+ with:
48
+ context: .
49
+ file: ./docker/Dockerfile-base
50
+ push: ${{ github.event_name != 'pull_request' }}
51
+ tags: ${{ steps.metadata.outputs.tags }}-base-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }}
52
+ labels: ${{ steps.metadata.outputs.labels }}
53
+ build-args: |
54
+ CUDA_VERSION=${{ matrix.cuda_version }}
55
+ CUDA=${{ matrix.cuda }}
56
+ PYTHON_VERSION=${{ matrix.python_version }}
57
+ PYTORCH_VERSION=${{ matrix.pytorch }}
58
+ TORCH_CUDA_ARCH_LIST=${{ matrix.torch_cuda_arch_list }}
.github/workflows/docs.yml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Publish Docs
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+
7
+ permissions:
8
+ contents: write
9
+ pages: write
10
+
11
+ jobs:
12
+ build-deploy:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Check out repository
16
+ uses: actions/checkout@v4
17
+ - name: Set up Quarto
18
+ uses: quarto-dev/quarto-actions/setup@v2
19
+ - name: Setup Python
20
+ uses: actions/setup-python@v3
21
+ with:
22
+ python-version: '3.10'
23
+ - name: install dependencies
24
+ run: |
25
+ python3 -m pip install jupyter
26
+ - name: Publish to GitHub Pages (and render)
27
+ uses: quarto-dev/quarto-actions/publish@v2
28
+ with:
29
+ target: gh-pages
30
+ env:
31
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
.github/workflows/lint.yml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: lint
2
+ on:
3
+ # check on PRs, and manual triggers
4
+ pull_request:
5
+ paths:
6
+ - '**.py'
7
+ - 'requirements.txt'
8
+ - '.github/workflows/*.yml'
9
+ - "*.md"
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ pre-commit:
14
+ name: pre-commit
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v3
18
+ - uses: actions/setup-python@v4
19
+ with:
20
+ python-version: "3.10"
21
+ cache: 'pip' # caching pip dependencies
22
+ - uses: pre-commit/action@v3.0.0
.github/workflows/main.yml ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: ci-cd
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "main"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build-axolotl:
11
+ if: ${{ ! contains(github.event.commits[0].message, '[skip docker]]') && github.repository_owner == 'OpenAccess-AI-Collective' }}
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ include:
16
+ - cuda: 118
17
+ cuda_version: 11.8.0
18
+ python_version: "3.10"
19
+ pytorch: 2.1.2
20
+ axolotl_extras:
21
+ axolotl_args: "--extra-index-url https://download.pytorch.org/whl/cu118"
22
+ is_latest: true
23
+ - cuda: 121
24
+ cuda_version: 12.1.0
25
+ python_version: "3.10"
26
+ pytorch: 2.1.2
27
+ axolotl_extras:
28
+ - cuda: 121
29
+ cuda_version: 12.1.0
30
+ python_version: "3.11"
31
+ pytorch: 2.1.2
32
+ axolotl_extras:
33
+ runs-on: axolotl-gpu-runner
34
+ steps:
35
+ - name: Checkout
36
+ uses: actions/checkout@v4
37
+ - name: Docker metadata
38
+ id: metadata
39
+ uses: docker/metadata-action@v5
40
+ with:
41
+ images: winglian/axolotl
42
+ - name: Set up Docker Buildx
43
+ uses: docker/setup-buildx-action@v3
44
+ - name: Login to Docker Hub
45
+ uses: docker/login-action@v3
46
+ with:
47
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
48
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
49
+ # guidance for testing before pushing: https://docs.docker.com/build/ci/github-actions/test-before-push/
50
+ - name: Build and export to Docker
51
+ uses: docker/build-push-action@v5
52
+ with:
53
+ context: .
54
+ build-args: |
55
+ BASE_TAG=${{ github.ref_name }}-base-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}
56
+ CUDA=${{ matrix.cuda }}
57
+ PYTORCH_VERSION=${{ matrix.pytorch }}
58
+ AXOLOTL_ARGS=${{ matrix.axolotl_args }}
59
+ file: ./docker/Dockerfile
60
+ push: ${{ github.event_name != 'pull_request' }}
61
+ tags: |
62
+ ${{ steps.metadata.outputs.tags }}-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }}
63
+ ${{ (matrix.is_latest) && format('{0}-latest', steps.metadata.outputs.tags) || '' }}
64
+ labels: ${{ steps.metadata.outputs.labels }}
65
+
66
+ build-axolotl-runpod:
67
+ needs: build-axolotl
68
+ if: ${{ ! contains(github.event.commits[0].message, '[skip docker]]') && github.repository_owner == 'OpenAccess-AI-Collective' }}
69
+ # this job needs to be run on self-hosted GPU runners...
70
+ strategy:
71
+ matrix:
72
+ include:
73
+ - cuda: 118
74
+ cuda_version: 11.8.0
75
+ python_version: "3.10"
76
+ pytorch: 2.1.2
77
+ axolotl_extras:
78
+ is_latest: true
79
+ - cuda: 121
80
+ cuda_version: 12.1.0
81
+ python_version: "3.10"
82
+ pytorch: 2.1.2
83
+ axolotl_extras:
84
+ - cuda: 121
85
+ cuda_version: 12.1.0
86
+ python_version: "3.11"
87
+ pytorch: 2.1.2
88
+ axolotl_extras:
89
+ runs-on: axolotl-gpu-runner
90
+ steps:
91
+ - name: Checkout
92
+ uses: actions/checkout@v4
93
+ - name: Docker metadata
94
+ id: metadata
95
+ uses: docker/metadata-action@v5
96
+ with:
97
+ images: winglian/axolotl-cloud
98
+ - name: Login to Docker Hub
99
+ uses: docker/login-action@v3
100
+ with:
101
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
102
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
103
+ - name: Set up Docker Buildx
104
+ uses: docker/setup-buildx-action@v2
105
+ - name: Build
106
+ uses: docker/build-push-action@v5
107
+ with:
108
+ context: .
109
+ build-args: |
110
+ BASE_TAG=${{ github.ref_name }}-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }}
111
+ CUDA=${{ matrix.cuda }}
112
+ file: ./docker/Dockerfile-cloud
113
+ push: ${{ github.event_name != 'pull_request' }}
114
+ tags: |
115
+ ${{ steps.metadata.outputs.tags }}-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }}
116
+ winglian/axolotl-runpod:main-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }}
117
+ ${{ (matrix.is_latest) && format('{0}-latest', steps.metadata.outputs.tags) || '' }}
118
+ ${{ (matrix.is_latest) && format('{0}-latest', 'winglian/axolotl-runpod:main') || '' }}
119
+ labels: ${{ steps.metadata.outputs.labels }}
.github/workflows/pypi.yml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: publish pypi
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+
8
+ jobs:
9
+ pypi-publish:
10
+ name: Upload release to PyPI
11
+ runs-on: ubuntu-latest
12
+ environment:
13
+ name: pypi
14
+ url: https://pypi.org/p/axolotl
15
+ permissions:
16
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
17
+ steps:
18
+ - name: Check out repository code
19
+ uses: actions/checkout@v3
20
+
21
+ - name: Setup Python
22
+ uses: actions/setup-python@v4
23
+ with:
24
+ python-version: "3.10"
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ pip3 install wheel
29
+ pip3 install -e .
30
+ pip3 install -r requirements-tests.txt
31
+
32
+ - name: Extract tag name
33
+ id: tag
34
+ run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)
35
+
36
+ - name: Update version in setup.py
37
+ run: |
38
+ sed -i -E 's/version="([0-9.]+)",/version="${{ steps.tag.outputs.TAG_NAME }}",/g' setup.py
39
+
40
+ - name: Build a binary wheel
41
+ run: |
42
+ python setup.py sdist bdist_wheel
43
+
44
+ - name: Publish package distributions to PyPI
45
+ uses: pypa/gh-action-pypi-publish@release/v1
.github/workflows/tests.yml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Tests
2
+ on:
3
+ # check on push/merge to main, PRs, and manual triggers
4
+ push:
5
+ branches:
6
+ - "main"
7
+ paths:
8
+ - '**.py'
9
+ - 'requirements.txt'
10
+ - '.github/workflows/*.yml'
11
+ pull_request:
12
+ paths:
13
+ - '**.py'
14
+ - 'requirements.txt'
15
+ - '.github/workflows/*.yml'
16
+ workflow_dispatch:
17
+
18
+ jobs:
19
+ pre-commit:
20
+ name: pre-commit
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v3
24
+ - uses: actions/setup-python@v4
25
+ with:
26
+ python-version: "3.10"
27
+ cache: 'pip' # caching pip dependencies
28
+ - uses: pre-commit/action@v3.0.0
29
+
30
+ pytest:
31
+ name: PyTest
32
+ runs-on: ubuntu-latest
33
+ strategy:
34
+ fail-fast: false
35
+ matrix:
36
+ python_version: ["3.10", "3.11"]
37
+ timeout-minutes: 20
38
+
39
+ steps:
40
+ - name: Check out repository code
41
+ uses: actions/checkout@v3
42
+
43
+ - name: Setup Python
44
+ uses: actions/setup-python@v4
45
+ with:
46
+ python-version: ${{ matrix.python_version }}
47
+ cache: 'pip' # caching pip dependencies
48
+
49
+ - name: Install dependencies
50
+ run: |
51
+ pip3 install -U -e .
52
+ pip3 install -r requirements-tests.txt
53
+
54
+ - name: Run tests
55
+ run: |
56
+ pytest --ignore=tests/e2e/ tests/
57
+
58
+ docker-e2e-tests:
59
+ if: github.repository_owner == 'OpenAccess-AI-Collective'
60
+ # this job needs to be run on self-hosted GPU runners...
61
+ runs-on: [self-hosted, modal]
62
+ timeout-minutes: 60
63
+ needs: [pre-commit, pytest]
64
+
65
+ strategy:
66
+ fail-fast: false
67
+ matrix:
68
+ include:
69
+ - cuda: 118
70
+ cuda_version: 11.8.0
71
+ python_version: "3.10"
72
+ pytorch: 2.1.2
73
+ axolotl_args: "--extra-index-url https://download.pytorch.org/whl/cu118"
74
+ num_gpus: 1
75
+ - cuda: 121
76
+ cuda_version: 12.1.0
77
+ python_version: "3.10"
78
+ pytorch: 2.1.2
79
+ num_gpus: 1
80
+ steps:
81
+ - name: Checkout
82
+ uses: actions/checkout@v4
83
+ - name: Install Python
84
+ uses: actions/setup-python@v5
85
+ with:
86
+ python-version: "3.10"
87
+ - name: Install Modal
88
+ run: |
89
+ python -m pip install --upgrade pip
90
+ pip install modal jinja2
91
+ - name: Update env vars
92
+ run: |
93
+ echo "BASE_TAG=main-base-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}" >> $GITHUB_ENV
94
+ echo "PYTORCH_VERSION=${{ matrix.pytorch}}" >> $GITHUB_ENV
95
+ echo "AXOLOTL_ARGS=${{ matrix.axolotl_args}}" >> $GITHUB_ENV
96
+ echo "CUDA=${{ matrix.cuda }}" >> $GITHUB_ENV
97
+ echo "N_GPUS=${{ matrix.num_gpus }}" >> $GITHUB_ENV
98
+ - name: Run tests job on Modal
99
+ run: |
100
+ modal run cicd.tests
.gitignore ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **/axolotl.egg-info
2
+ configs
3
+ last_run_prepared/
4
+ .vscode
5
+ _site/
6
+
7
+ # Byte-compiled / optimized / DLL files
8
+ __pycache__/
9
+ *.py[cod]
10
+ *$py.class
11
+
12
+ # C extensions
13
+ *.so
14
+
15
+ # Distribution / packaging
16
+ .Python
17
+ build/
18
+ develop-eggs/
19
+ dist/
20
+ downloads/
21
+ eggs/
22
+ .eggs/
23
+ lib/
24
+ lib64/
25
+ parts/
26
+ sdist/
27
+ var/
28
+ wheels/
29
+ share/python-wheels/
30
+ *.egg-info/
31
+ .installed.cfg
32
+ *.egg
33
+ MANIFEST
34
+
35
+ # PyInstaller
36
+ # Usually these files are written by a python script from a template
37
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
38
+ *.manifest
39
+ *.spec
40
+
41
+ # Installer logs
42
+ pip-log.txt
43
+ pip-delete-this-directory.txt
44
+
45
+ # Unit test / coverage reports
46
+ htmlcov/
47
+ .tox/
48
+ .nox/
49
+ .coverage
50
+ .coverage.*
51
+ .cache
52
+ nosetests.xml
53
+ coverage.xml
54
+ *.cover
55
+ *.py,cover
56
+ .hypothesis/
57
+ .pytest_cache/
58
+ cover/
59
+
60
+ # Translations
61
+ *.mo
62
+ *.pot
63
+
64
+ # Django stuff:
65
+ *.log
66
+ local_settings.py
67
+ db.sqlite3
68
+ db.sqlite3-journal
69
+
70
+ # Flask stuff:
71
+ instance/
72
+ .webassets-cache
73
+
74
+ # Scrapy stuff:
75
+ .scrapy
76
+
77
+ # Sphinx documentation
78
+ docs/_build/
79
+
80
+ # PyBuilder
81
+ .pybuilder/
82
+ target/
83
+
84
+ # Jupyter Notebook
85
+ .ipynb_checkpoints
86
+
87
+ # IPython
88
+ profile_default/
89
+ ipython_config.py
90
+
91
+ # pyenv
92
+ # For a library or package, you might want to ignore these files since the code is
93
+ # intended to run in multiple environments; otherwise, check them in:
94
+ # .python-version
95
+
96
+ # pipenv
97
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
98
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
99
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
100
+ # install all needed dependencies.
101
+ #Pipfile.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/#use-with-ide
116
+ .pdm.toml
117
+
118
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
119
+ __pypackages__/
120
+
121
+ # Celery stuff
122
+ celerybeat-schedule
123
+ celerybeat.pid
124
+
125
+ # SageMath parsed files
126
+ *.sage.py
127
+
128
+ # Environments
129
+ .env
130
+ .venv
131
+ env/
132
+ venv/
133
+ ENV/
134
+ env.bak/
135
+ venv.bak/
136
+
137
+ # Spyder project settings
138
+ .spyderproject
139
+ .spyproject
140
+
141
+ # Rope project settings
142
+ .ropeproject
143
+
144
+ # mkdocs documentation
145
+ /site
146
+
147
+ # mypy
148
+ .mypy_cache/
149
+ .dmypy.json
150
+ dmypy.json
151
+
152
+ # Pyre type checker
153
+ .pyre/
154
+
155
+ # pytype static type analyzer
156
+ .pytype/
157
+
158
+ # Cython debug symbols
159
+ cython_debug/
160
+
161
+ # PyCharm
162
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
163
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
164
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
165
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
166
+ .idea/
167
+
168
+ # WandB
169
+ # wandb creates a folder to store logs for training runs
170
+ wandb
171
+
172
+ # Runs
173
+ lora-out/*
174
+ qlora-out/*
175
+ mlruns/*
176
+
177
+ /.quarto/
.isort.cfg ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [settings]
2
+ profile=black
3
+ known_third_party=wandb
.mypy.ini ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [mypy]
2
+ plugins = pydantic.mypy
3
+ exclude = venv
4
+
5
+ [mypy-alpaca_lora_4bit.*]
6
+ ignore_missing_imports = True
7
+
8
+ [mypy-axolotl.monkeypatch.*]
9
+ ignore_errors = True
10
+
11
+ [mypy-axolotl.models.mixtral.*]
12
+ ignore_errors = True
13
+
14
+ [mypy-axolotl.models.phi.*]
15
+ ignore_errors = True
16
+
17
+ [mypy-flash_attn.*]
18
+ ignore_missing_imports = True
19
+
20
+ [mypy-huggingface_hub]
21
+ ignore_missing_imports = True
22
+
23
+ [mypy-transformers.*]
24
+ ignore_missing_imports = True
25
+
26
+ [mypy-peft]
27
+ ignore_missing_imports = True
28
+
29
+ [mypy-wandb]
30
+ ignore_missing_imports = True
31
+
32
+ [mypy-bitsandbytes]
33
+ ignore_missing_imports = True
34
+
35
+ [mypy-requests]
36
+ ignore_missing_imports = True
37
+
38
+ [mypy-datasets]
39
+ ignore_missing_imports = True
40
+
41
+ [mypy-fire]
42
+ ignore_missing_imports = True
43
+
44
+ [mypy-setuptools]
45
+ ignore_missing_imports = True
46
+
47
+ [mypy-addict]
48
+ ignore_missing_imports = True
49
+
50
+ [mypy-xformers.*]
51
+ ignore_missing_imports = True
.pre-commit-config.yaml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ default_language_version:
2
+ python: python3
3
+
4
+ repos:
5
+ - repo: https://github.com/pre-commit/pre-commit-hooks
6
+ rev: v4.4.0
7
+ hooks:
8
+ - id: check-yaml
9
+ - id: end-of-file-fixer
10
+ - id: trailing-whitespace
11
+ - repo: https://github.com/psf/black
12
+ rev: 23.3.0
13
+ hooks:
14
+ - id: black
15
+ - repo: https://github.com/pycqa/isort
16
+ rev: 5.12.0
17
+ hooks:
18
+ - id: isort
19
+ - repo: https://github.com/PyCQA/flake8
20
+ rev: 6.0.0
21
+ hooks:
22
+ - id: flake8
23
+ - repo: https://github.com/PyCQA/pylint
24
+ rev: v2.17.4
25
+ hooks:
26
+ - id: pylint
27
+ - repo: https://github.com/pre-commit/mirrors-mypy
28
+ rev: v1.3.0
29
+ hooks:
30
+ - id: mypy
31
+ additional_dependencies:
32
+ [
33
+ 'types-PyYAML',
34
+ 'pydantic>=2.5.3',
35
+ ]
36
+ - repo: https://github.com/PyCQA/bandit
37
+ rev: 1.7.5
38
+ hooks:
39
+ - id: bandit
40
+ args: [
41
+ '--ini',
42
+ '.bandit',
43
+ ]
.pylintrc ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [MASTER]
2
+ init-hook="from pylint.config import find_pylintrc; import os, sys; sys.path.append(os.path.dirname(find_pylintrc()))"
3
+
4
+ [TYPECHECK]
5
+
6
+ # List of members which are set dynamically and missed by Pylint inference
7
+ # system, and so shouldn't trigger E1101 when accessed.
8
+ generated-members=numpy.*, torch.*
9
+
10
+
11
+ [pylint.messages_control]
12
+ disable=missing-function-docstring, line-too-long, import-error,
13
+ too-many-arguments, too-many-locals, too-many-statements, too-many-branches, too-few-public-methods,
14
+ too-many-instance-attributes, fixme, import-outside-toplevel, logging-fstring-interpolation,
FAQS.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # FAQs
2
+
3
+ - Can you train StableLM with this? Yes, but only with a single GPU atm. Multi GPU support is coming soon! Just waiting on this [PR](https://github.com/huggingface/transformers/pull/22874)
4
+ - Will this work with Deepspeed? That's still a WIP, but setting `export ACCELERATE_USE_DEEPSPEED=true` should work in some cases
5
+ - `Error invalid argument at line 359 in file /workspace/bitsandbytes/csrc/pythonInterface.c`
6
+ `/arrow/cpp/src/arrow/filesystem/s3fs.cc:2598: arrow::fs::FinalizeS3 was not called even though S3 was initialized.`
7
+ This could lead to a segmentation fault at exit. Try reinstalling bitsandbytes and transformers from source.
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,1356 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Axolotl
2
+
3
+ Axolotl is a tool designed to streamline the fine-tuning of various AI models, offering support for multiple configurations and architectures.
4
+
5
+ Features:
6
+ - Train various Huggingface models such as llama, pythia, falcon, mpt
7
+ - Supports fullfinetune, lora, qlora, relora, and gptq
8
+ - Customize configurations using a simple yaml file or CLI overwrite
9
+ - Load different dataset formats, use custom formats, or bring your own tokenized datasets
10
+ - Integrated with xformer, flash attention, rope scaling, and multipacking
11
+ - Works with single GPU or multiple GPUs via FSDP or Deepspeed
12
+ - Easily run with Docker locally or on the cloud
13
+ - Log results and optionally checkpoints to wandb or mlflow
14
+ - And more!
15
+
16
+ <a href="https://www.phorm.ai/query?projectId=e315ba4a-4e14-421f-ab05-38a1f9076f25">
17
+ <img alt="phorm.ai" src="https://img.shields.io/badge/Phorm-Ask_AI-%23F2777A.svg?&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNSIgaGVpZ2h0PSI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxwYXRoIGQ9Ik00LjQzIDEuODgyYTEuNDQgMS40NCAwIDAgMS0uMDk4LjQyNmMtLjA1LjEyMy0uMTE1LjIzLS4xOTIuMzIyLS4wNzUuMDktLjE2LjE2NS0uMjU1LjIyNmExLjM1MyAxLjM1MyAwIDAgMS0uNTk1LjIxMmMtLjA5OS4wMTItLjE5Mi4wMTQtLjI3OS4wMDZsLTEuNTkzLS4xNHYtLjQwNmgxLjY1OGMuMDkuMDAxLjE3LS4xNjkuMjQ2LS4xOTFhLjYwMy42MDMgMCAwIDAgLjItLjEwNi41MjkuNTI5IDAgMCAwIC4xMzgtLjE3LjY1NC42NTQgMCAwIDAgLjA2NS0uMjRsLjAyOC0uMzJhLjkzLjkzIDAgMCAwLS4wMzYtLjI0OS41NjcuNTY3IDAgMCAwLS4xMDMtLjIuNTAyLjUwMiAwIDAgMC0uMTY4LS4xMzguNjA4LjYwOCAwIDAgMC0uMjQtLjA2N0wyLjQzNy43MjkgMS42MjUuNjcxYS4zMjIuMzIyIDAgMCAwLS4yMzIuMDU4LjM3NS4zNzUgMCAwIDAtLjExNi4yMzJsLS4xMTYgMS40NS0uMDU4LjY5Ny0uMDU4Ljc1NEwuNzA1IDRsLS4zNTctLjA3OUwuNjAyLjkwNkMuNjE3LjcyNi42NjMuNTc0LjczOS40NTRhLjk1OC45NTggMCAwIDEgLjI3NC0uMjg1Ljk3MS45NzEgMCAwIDEgLjMzNy0uMTRjLjExOS0uMDI2LjIyNy0uMDM0LjMyNS0uMDI2TDMuMjMyLjE2Yy4xNTkuMDE0LjMzNi4wMy40NTkuMDgyYTEuMTczIDEuMTczIDAgMCAxIC41NDUuNDQ3Yy4wNi4wOTQuMTA5LjE5Mi4xNDQuMjkzYTEuMzkyIDEuMzkyIDAgMCAxIC4wNzguNThsLS4wMjkuMzJaIiBmaWxsPSIjRjI3NzdBIi8+CiAgPHBhdGggZD0iTTQuMDgyIDIuMDA3YTEuNDU1IDEuNDU1IDAgMCAxLS4wOTguNDI3Yy0uMDUuMTI0LS4xMTQuMjMyLS4xOTIuMzI0YTEuMTMgMS4xMyAwIDAgMS0uMjU0LjIyNyAxLjM1MyAxLjM1MyAwIDAgMS0uNTk1LjIxNGMtLjEuMDEyLS4xOTMuMDE0LS4yOC4wMDZsLTEuNTYtLjEwOC4wMzQtLjQwNi4wMy0uMzQ4IDEuNTU5LjE1NGMuMDkgMCAuMTczLS4wMS4yNDgtLjAzM2EuNjAzLjYwMyAwIDAgMCAuMi0uMTA2LjUzMi41MzIgMCAwIDAgLjEzOS0uMTcyLjY2LjY2IDAgMCAwIC4wNjQtLjI0MWwuMDI5LS4zMjFhLjk0Ljk0IDAgMCAwLS4wMzYtLjI1LjU3LjU3IDAgMCAwLS4xMDMtLjIwMi41MDIuNTAyIDAgMCAwLS4xNjgtLjEzOC42MDUuNjA1IDAgMCAwLS4yNC0uMDY3TDEuMjczLjgyN2MtLjA5NC0uMDA4LS4xNjguMDEtLjIyMS4wNTUtLjA1My4wNDUtLjA4NC4xMTQtLjA5Mi4yMDZMLjcwNSA0IDAgMy45MzhsLjI1NS0yLjkxMUExLjAxIDEuMDEgMCAwIDEgLjM5My41NzIuOTYyLjk2MiAwIDAgMSAuNjY2LjI4NmEuOTcuOTcgMCAwIDEgLjMzOC0uMTRDMS4xMjIuMTIgMS4yMy4xMSAxLjMyOC4xMTlsMS41OTMuMTRjLjE2LjAxNC4zLjA0Ny40MjMuMWExLjE3IDEuMTcgMCAwIDEgLjU0NS40NDhjLjA2MS4wOTUuMTA5LjE5My4xNDQuMjk1YTEuNDA2IDEuNDA2IDAgMCAxIC4wNzcuNTgzbC0uMDI4LjMyMloiIGZpbGw9IndoaXRlIi8+CiAgPHBhdGggZD0iTTQuMDgyIDIuMDA3YTEuNDU1IDEuNDU1IDAgMCAxLS4wOTguNDI3Yy0uMDUuMTI0LS4xMTQuMjMyLS4xOTIuMzI0YTEuMTMgMS4xMyAwIDAgMS0uMjU0LjIyNyAxLjM1MyAxLjM1MyAwIDAgMS0uNTk1LjIxNGMtLjEuMDEyLS4xOTMuMDE0LS4yOC4wMDZsLTEuNTYtLjEwOC4wMzQtLjQwNi4wMy0uMzQ4IDEuNTU5LjE1NGMuMDkgMCAuMTczLS4wMS4yNDgtLjAzM2EuNjAzLjYwMyAwIDAgMCAuMi0uMTA2LjUzMi41MzIgMCAwIDAgLjEzOS0uMTcyLjY2LjY2IDAgMCAwIC4wNjQtLjI0MWwuMDI5LS4zMjFhLjk0Ljk0IDAgMCAwLS4wMzYtLjI1LjU3LjU3IDAgMCAwLS4xMDMtLjIwMi41MDIuNTAyIDAgMCAwLS4xNjgtLjEzOC42MDUuNjA1IDAgMCAwLS4yNC0uMDY3TDEuMjczLjgyN2MtLjA5NC0uMDA4LS4xNjguMDEtLjIyMS4wNTUtLjA1My4wNDUtLjA4NC4xMTQtLjA5Mi4yMDZMLjcwNSA0IDAgMy45MzhsLjI1NS0yLjkxMUExLjAxIDEuMDEgMCAwIDEgLjM5My41NzIuOTYyLjk2MiAwIDAgMSAuNjY2LjI4NmEuOTcuOTcgMCAwIDEgLjMzOC0uMTRDMS4xMjIuMTIgMS4yMy4xMSAxLjMyOC4xMTlsMS41OTMuMTRjLjE2LjAxNC4zLjA0Ny40MjMuMWExLjE3IDEuMTcgMCAwIDEgLjU0NS40NDhjLjA2MS4wOTUuMTA5LjE5My4xNDQuMjk1YTEuNDA2IDEuNDA2IDAgMCAxIC4wNzcuNTgzbC0uMDI4LjMyMloiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=">
18
+ </a>
19
+
20
+ <table>
21
+ <tr>
22
+ <td>
23
+
24
+ ## Table of Contents
25
+ - [Introduction](#axolotl)
26
+ - [Supported Features](#axolotl-supports)
27
+ - [Quickstart](#quickstart-)
28
+ - [Environment](#environment)
29
+ - [Docker](#docker)
30
+ - [Conda/Pip venv](#condapip-venv)
31
+ - [Cloud GPU](#cloud-gpu) - Latitude.sh, JarvisLabs, RunPod
32
+ - [Bare Metal Cloud GPU](#bare-metal-cloud-gpu)
33
+ - [Windows](#windows)
34
+ - [Mac](#mac)
35
+ - [Google Colab](#google-colab)
36
+ - [Launching on public clouds via SkyPilot](#launching-on-public-clouds-via-skypilot)
37
+ - [Dataset](#dataset)
38
+ - [How to Add Custom Prompts](#how-to-add-custom-prompts)
39
+ - [How to Use Custom Pretokenized Dataset](#how-to-use-your-custom-pretokenized-dataset)
40
+ - [Config](#config)
41
+ - [Train](#train)
42
+ - [Inference](#inference-playground)
43
+ - [Merge LORA to Base](#merge-lora-to-base)
44
+ - [Special Tokens](#special-tokens)
45
+ - Advanced Topics
46
+ - [Multipack](./docs/multipack.qmd)<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9" class="icon_svg-stroke" stroke="#666" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg>
47
+ - [RLHF & DPO](./docs/rlhf.qmd)<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9" class="icon_svg-stroke" stroke="#666" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg>
48
+ - [Common Errors](#common-errors-)
49
+ - [Tokenization Mismatch b/w Training & Inference](#tokenization-mismatch-bw-inference--training)
50
+ - [Debugging Axolotl](#debugging-axolotl)
51
+ - [Need Help?](#need-help-)
52
+ - [Badge](#badge-)
53
+ - [Community Showcase](#community-showcase)
54
+ - [Contributing](#contributing-)
55
+ - [Sponsors](#sponsors-)
56
+
57
+ </td>
58
+ <td>
59
+
60
+ <div align="center">
61
+ <img src="image/axolotl.png" alt="axolotl" width="160">
62
+ <div>
63
+ <p>
64
+ <b>Axolotl provides a unified repository for fine-tuning <br />a variety of AI models with ease</b>
65
+ </p>
66
+ <p>
67
+ Go ahead and Axolotl questions!!
68
+ </p>
69
+ <img src="https://github.com/OpenAccess-AI-Collective/axolotl/actions/workflows/pre-commit.yml/badge.svg?branch=main" alt="pre-commit">
70
+ <img alt="PyTest Status" src="https://github.com/OpenAccess-AI-Collective/axolotl/actions/workflows/tests.yml/badge.svg?branch=main">
71
+ </div>
72
+ </div>
73
+
74
+ </td>
75
+ </tr>
76
+ </table>
77
+
78
+ ## Axolotl supports
79
+
80
+ | | fp16/fp32 | lora | qlora | gptq | gptq w/flash attn | flash attn | xformers attn |
81
+ |-------------|:----------|:-----|-------|------|-------------------|------------|--------------|
82
+ | llama | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
83
+ | Mistral | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
84
+ | Mixtral-MoE | ✅ | ✅ | ✅ | ❓ | ❓ | ❓ | ❓ |
85
+ | Pythia | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❓ |
86
+ | cerebras | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❓ |
87
+ | btlm | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❓ |
88
+ | mpt | ✅ | ❌ | ❓ | ❌ | ❌ | ❌ | ❓ |
89
+ | falcon | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❓ |
90
+ | gpt-j | ✅ | ✅ | ✅ | ❌ | ❌ | ❓ | ❓ |
91
+ | XGen | ✅ | ❓ | ✅ | ❓ | ❓ | ❓ | ✅ |
92
+ | phi | ✅ | ✅ | ✅ | ❓ | ❓ | ❓ | ❓ |
93
+ | RWKV | ✅ | ❓ | ❓ | ❓ | ❓ | ❓ | ❓ |
94
+ | Qwen | ✅ | ✅ | ✅ | ❓ | ❓ | ❓ | ❓ |
95
+ | Gemma | ✅ | ✅ | ✅ | ❓ | ❓ | ✅ | ❓ |
96
+
97
+ ✅: supported
98
+ ❌: not supported
99
+ ❓: untested
100
+
101
+ ## Quickstart ⚡
102
+
103
+ Get started with Axolotl in just a few steps! This quickstart guide will walk you through setting up and running a basic fine-tuning task.
104
+
105
+ **Requirements**: Python >=3.10 and Pytorch >=2.1.1.
106
+
107
+ ```bash
108
+ git clone https://github.com/OpenAccess-AI-Collective/axolotl
109
+ cd axolotl
110
+
111
+ pip3 install packaging
112
+ pip3 install -e '.[flash-attn,deepspeed]'
113
+ ```
114
+
115
+ ### Usage
116
+ ```bash
117
+ # preprocess datasets - optional but recommended
118
+ CUDA_VISIBLE_DEVICES="" python -m axolotl.cli.preprocess examples/openllama-3b/lora.yml
119
+
120
+ # finetune lora
121
+ accelerate launch -m axolotl.cli.train examples/openllama-3b/lora.yml
122
+
123
+ # inference
124
+ accelerate launch -m axolotl.cli.inference examples/openllama-3b/lora.yml \
125
+ --lora_model_dir="./lora-out"
126
+
127
+ # gradio
128
+ accelerate launch -m axolotl.cli.inference examples/openllama-3b/lora.yml \
129
+ --lora_model_dir="./lora-out" --gradio
130
+
131
+ # remote yaml files - the yaml config can be hosted on a public URL
132
+ # Note: the yaml config must directly link to the **raw** yaml
133
+ accelerate launch -m axolotl.cli.train https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/examples/openllama-3b/lora.yml
134
+ ```
135
+
136
+ ## Advanced Setup
137
+
138
+ ### Environment
139
+
140
+ #### Docker
141
+
142
+ ```bash
143
+ docker run --gpus '"all"' --rm -it winglian/axolotl:main-latest
144
+ ```
145
+
146
+ Or run on the current files for development:
147
+
148
+ ```sh
149
+ docker compose up -d
150
+ ```
151
+
152
+ >[!Tip]
153
+ > If you want to debug axolotl or prefer to use Docker as your development environment, see the [debugging guide's section on Docker](docs/debugging.qmd#debugging-with-docker).
154
+
155
+ <details>
156
+
157
+ <summary>Docker advanced</summary>
158
+
159
+ A more powerful Docker command to run would be this:
160
+
161
+ ```bash
162
+ docker run --privileged --gpus '"all"' --shm-size 10g --rm -it --name axolotl --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 --mount type=bind,src="${PWD}",target=/workspace/axolotl -v ${HOME}/.cache/huggingface:/root/.cache/huggingface winglian/axolotl:main-latest
163
+ ```
164
+
165
+ It additionally:
166
+ * Prevents memory issues when running e.g. deepspeed (e.g. you could hit SIGBUS/signal 7 error) through `--ipc` and `--ulimit` args.
167
+ * Persists the downloaded HF data (models etc.) and your modifications to axolotl code through `--mount`/`-v` args.
168
+ * The `--name` argument simply makes it easier to refer to the container in vscode (`Dev Containers: Attach to Running Container...`) or in your terminal.
169
+ * The `--privileged` flag gives all capabilities to the container.
170
+ * The `--shm-size 10g` argument increases the shared memory size. Use this if you see `exitcode: -7` errors using deepspeed.
171
+
172
+ [More information on nvidia website](https://docs.nvidia.com/deeplearning/frameworks/user-guide/index.html#setincshmem)
173
+
174
+ </details>
175
+
176
+ #### Conda/Pip venv
177
+ 1. Install python >=**3.10**
178
+
179
+ 2. Install pytorch stable https://pytorch.org/get-started/locally/
180
+
181
+ 3. Install Axolotl along with python dependencies
182
+ ```bash
183
+ pip3 install packaging
184
+ pip3 install -e '.[flash-attn,deepspeed]'
185
+ ```
186
+ 4. (Optional) Login to Huggingface to use gated models/datasets.
187
+ ```bash
188
+ huggingface-cli login
189
+ ```
190
+ Get the token at huggingface.co/settings/tokens
191
+
192
+ #### Cloud GPU
193
+
194
+ For cloud GPU providers that support docker images, use [`winglian/axolotl-cloud:main-latest`](https://hub.docker.com/r/winglian/axolotl-cloud/tags)
195
+
196
+ - on Latitude.sh use this [direct link](https://latitude.sh/blueprint/989e0e79-3bf6-41ea-a46b-1f246e309d5c)
197
+ - on JarvisLabs.ai use this [direct link](https://jarvislabs.ai/templates/axolotl)
198
+ - on RunPod use this [direct link](https://runpod.io/gsc?template=v2ickqhz9s&ref=6i7fkpdz)
199
+
200
+ #### Bare Metal Cloud GPU
201
+
202
+ ##### LambdaLabs
203
+
204
+ <details>
205
+
206
+ <summary>Click to Expand</summary>
207
+
208
+ 1. Install python
209
+ ```bash
210
+ sudo apt update
211
+ sudo apt install -y python3.10
212
+
213
+ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
214
+ sudo update-alternatives --config python # pick 3.10 if given option
215
+ python -V # should be 3.10
216
+
217
+ ```
218
+
219
+ 2. Install pip
220
+ ```bash
221
+ wget https://bootstrap.pypa.io/get-pip.py
222
+ python get-pip.py
223
+ ```
224
+
225
+ 3. Install torch
226
+ ```bash
227
+ pip3 install -U torch --index-url https://download.pytorch.org/whl/cu118
228
+ ```
229
+
230
+ 4. Axolotl
231
+ ```bash
232
+ git clone https://github.com/OpenAccess-AI-Collective/axolotl
233
+ cd axolotl
234
+
235
+ pip3 install packaging
236
+ pip3 install -e '.[flash-attn,deepspeed]'
237
+ pip3 install protobuf==3.20.3
238
+ pip3 install -U --ignore-installed requests Pillow psutil scipy
239
+ ```
240
+
241
+ 5. Set path
242
+ ```bash
243
+ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
244
+ ```
245
+ </details>
246
+
247
+ ##### GCP
248
+
249
+ <details>
250
+
251
+ <summary>Click to Expand</summary>
252
+
253
+ Use a Deeplearning linux OS with cuda and pytorch installed. Then follow instructions on quickstart.
254
+
255
+ Make sure to run the below to uninstall xla.
256
+ ```bash
257
+ pip uninstall -y torch_xla[tpu]
258
+ ```
259
+
260
+ </details>
261
+
262
+ #### Windows
263
+ Please use WSL or Docker!
264
+
265
+ #### Mac
266
+
267
+ Use the below instead of the install method in QuickStart.
268
+ ```
269
+ pip3 install -e '.'
270
+ ```
271
+ More info: [mac.md](/docs/mac.qmd)
272
+
273
+ #### Google Colab
274
+
275
+ Please use this example [notebook](examples/colab-notebooks/colab-axolotl-example.ipynb).
276
+
277
+ #### Launching on public clouds via SkyPilot
278
+ To launch on GPU instances (both on-demand and spot instances) on 7+ clouds (GCP, AWS, Azure, OCI, and more), you can use [SkyPilot](https://skypilot.readthedocs.io/en/latest/index.html):
279
+
280
+ ```bash
281
+ pip install "skypilot-nightly[gcp,aws,azure,oci,lambda,kubernetes,ibm,scp]" # choose your clouds
282
+ sky check
283
+ ```
284
+
285
+ Get the [example YAMLs](https://github.com/skypilot-org/skypilot/tree/master/llm/axolotl) of using Axolotl to finetune `mistralai/Mistral-7B-v0.1`:
286
+ ```
287
+ git clone https://github.com/skypilot-org/skypilot.git
288
+ cd skypilot/llm/axolotl
289
+ ```
290
+
291
+ Use one command to launch:
292
+ ```bash
293
+ # On-demand
294
+ HF_TOKEN=xx sky launch axolotl.yaml --env HF_TOKEN
295
+
296
+ # Managed spot (auto-recovery on preemption)
297
+ HF_TOKEN=xx BUCKET=<unique-name> sky spot launch axolotl-spot.yaml --env HF_TOKEN --env BUCKET
298
+ ```
299
+
300
+ ### Dataset
301
+
302
+ Axolotl supports a variety of dataset formats. Below are some of the formats you can use.
303
+ Have dataset(s) in one of the following format (JSONL recommended):
304
+
305
+ #### Pretraining
306
+
307
+ - `completion`: raw corpus
308
+ ```json
309
+ {"text": "..."}
310
+ ```
311
+
312
+ Note: Axolotl usually loads the entire dataset into memory. This will be challenging for large datasets. Use the following config to enable streaming:
313
+
314
+ ```yaml
315
+ pretraining_dataset: # hf path only
316
+ ```
317
+
318
+ #### Supervised finetuning
319
+
320
+ ##### Instruction
321
+
322
+ - `alpaca`: instruction; input(optional)
323
+ ```json
324
+ {"instruction": "...", "input": "...", "output": "..."}
325
+ ```
326
+
327
+ <details>
328
+
329
+ <summary>See other formats</summary>
330
+
331
+ - `jeopardy`: question and answer
332
+ ```json
333
+ {"question": "...", "category": "...", "answer": "..."}
334
+ ```
335
+ - `oasst`: instruction
336
+ ```json
337
+ {"INSTRUCTION": "...", "RESPONSE": "..."}
338
+ ```
339
+ - `gpteacher`: instruction; input(optional)
340
+ ```json
341
+ {"instruction": "...", "input": "...", "response": "..."}
342
+ ```
343
+ - `reflection`: instruction with reflect; input(optional)
344
+ ```json
345
+ {"instruction": "...", "input": "...", "output": "...", "reflection": "...", "corrected": "..."}
346
+ ```
347
+ - `explainchoice`: question, choices, (solution OR explanation)
348
+ ```json
349
+ {"question": "...", "choices": ["..."], "solution": "...", "explanation": "..."}
350
+ ```
351
+ - `concisechoice`: question, choices, (solution OR explanation)
352
+ ```json
353
+ {"question": "...", "choices": ["..."], "solution": "...", "explanation": "..."}
354
+ ```
355
+ - `summarizetldr`: article and summary
356
+ ```json
357
+ {"article": "...", "summary": "..."}
358
+ ```
359
+ - `alpaca_chat`: basic instruct for alpaca chat
360
+ ```json
361
+ {"instruction": "...", "input": "...", "response": "..."}
362
+ ```
363
+ - `alpaca_chat.load_qa`: question and answer for alpaca chat
364
+ ```json
365
+ {"question": "...", "answer": "..."}
366
+ ```
367
+ - `alpaca_chat.load_concise`: question and answer for alpaca chat, for concise answers
368
+ ```json
369
+ {"instruction": "...", "input": "...", "response": "..."}
370
+ ```
371
+ - `alpaca_chat.load_camel_ai`: question and answer for alpaca chat, for load_camel_ai
372
+ ```json
373
+ {"message_1": "...", "message_2": "..."}
374
+ ```
375
+ - `alpaca_w_system.load_open_orca`: support for open orca datasets with included system prompts, instruct
376
+ ```json
377
+ {"system_prompt": "...", "question": "...", "response": "..."}
378
+ ```
379
+ - `context_qa`: in context question answering from an article
380
+ ```json
381
+ {"article": "...", "question": "...", "answer": "..."}
382
+ ```
383
+ - `context_qa.load_v2`: in context question answering (alternate)
384
+ ```json
385
+ {"context": "...", "question": "...", "answer": "..."}
386
+ ```
387
+ - `context_qa.load_404`: in context question answering from an article, with default response for no answer from context
388
+ ```json
389
+ {"article": "...", "unanswerable_question": "..."}
390
+ ```
391
+ - `creative_acr.load_answer`: instruction and revision
392
+ ```json
393
+ {"instruction": "...", "revision": "..."}
394
+ ```
395
+ - `creative_acr.load_critique`: critique
396
+ ```json
397
+ {"scores": "...", "critiques": "...", "instruction": "...", "answer": "..."}
398
+ ```
399
+ - `creative_acr.load_revise`: critique and revise
400
+ ```json
401
+ {"scores": "...", "critiques": "...", "instruction": "...", "answer": "...", "revision": "..."}
402
+ ```
403
+ - `metharme`: instruction, adds additional eos tokens
404
+ ```json
405
+ {"prompt": "...", "generation": "..."}
406
+ ```
407
+
408
+ </details>
409
+
410
+ ##### Template-Free
411
+
412
+ - `input_output`: template-free prompt construction
413
+ ```json
414
+ {"segments": [{"label": true|false, "text": "..."}]}
415
+ ```
416
+
417
+ This is a special format that allows you to construct prompts without using templates. This is for advanced users who want more freedom with prompt construction. See [these docs](docs/input_output.qmd) for more details.
418
+
419
+ ##### Conversation
420
+
421
+ - `sharegpt`: conversations where `from` is `human`/`gpt`. (optional: first row with role `system` to override default system prompt)
422
+ ```json
423
+ {"conversations": [{"from": "...", "value": "..."}]}
424
+ ```
425
+
426
+ <details>
427
+
428
+ <summary>See other formats</summary>
429
+
430
+ - `pygmalion`: pygmalion
431
+ ```json
432
+ {"conversations": [{"role": "...", "value": "..."}]}
433
+ ```
434
+ - `sharegpt.load_role`: conversations where `role` is used instead of `from`
435
+ ```json
436
+ {"conversations": [{"role": "...", "value": "..."}]}
437
+ ```
438
+ - `sharegpt.load_guanaco`: conversations where `from` is `prompter`/`assistant` instead of default sharegpt
439
+ ```json
440
+ {"conversations": [{"from": "...", "value": "..."}]}
441
+ ```
442
+ - `sharegpt_jokes`: creates a chat where bot is asked to tell a joke, then explain why the joke is funny
443
+ ```json
444
+ {"conversations": [{"title": "...", "text": "...", "explanation": "..."}]}
445
+ ```
446
+
447
+ </details>
448
+
449
+ Note: `type: sharegpt` opens a special config `conversation:` that enables conversions to many Conversation types. See dataset section under [all yaml options](#all-yaml-options).
450
+
451
+ #### How to add custom prompts
452
+
453
+ For a dataset that is preprocessed for instruction purposes:
454
+
455
+ ```json
456
+ {"input": "...", "output": "..."}
457
+ ```
458
+
459
+ You can use this example in your YAML config:
460
+
461
+ ```yaml
462
+ datasets:
463
+ - path: repo
464
+ type:
465
+ system_prompt: ""
466
+ field_system: system
467
+ field_instruction: input
468
+ field_output: output
469
+ format: "[INST] {instruction} [/INST]"
470
+ no_input_format: "[INST] {instruction} [/INST]"
471
+ ```
472
+ See full config options under [all yaml options](#all-yaml-options).
473
+
474
+ #### How to use your custom pretokenized dataset
475
+
476
+ - Do not pass a `type:`
477
+ - Columns in Dataset must be exactly `input_ids`, `attention_mask`, `labels`
478
+
479
+ ```yaml
480
+ - path: ...
481
+ ```
482
+
483
+ ### Config
484
+
485
+ See [examples](examples) for quick start. It is recommended to duplicate and modify to your needs. The most important options are:
486
+
487
+ - model
488
+ ```yaml
489
+ base_model: ./llama-7b-hf # local or huggingface repo
490
+ ```
491
+ Note: The code will load the right architecture.
492
+
493
+ - dataset
494
+ ```yaml
495
+ datasets:
496
+ # huggingface repo
497
+ - path: vicgalle/alpaca-gpt4
498
+ type: alpaca
499
+
500
+ # huggingface repo with specific configuration/subset
501
+ - path: EleutherAI/pile
502
+ name: enron_emails
503
+ type: completion # format from earlier
504
+ field: text # Optional[str] default: text, field to use for completion data
505
+
506
+ # huggingface repo with multiple named configurations/subsets
507
+ - path: bigcode/commitpackft
508
+ name:
509
+ - ruby
510
+ - python
511
+ - typescript
512
+ type: ... # unimplemented custom format
513
+
514
+ # fastchat conversation
515
+ # See 'conversation' options: https://github.com/lm-sys/FastChat/blob/main/fastchat/conversation.py
516
+ - path: ...
517
+ type: sharegpt
518
+ conversation: chatml # default: vicuna_v1.1
519
+
520
+ # local
521
+ - path: data.jsonl # or json
522
+ ds_type: json # see other options below
523
+ type: alpaca
524
+
525
+ # dataset with splits, but no train split
526
+ - path: knowrohit07/know_sql
527
+ type: context_qa.load_v2
528
+ train_on_split: validation
529
+
530
+ # loading from s3 or gcs
531
+ # s3 creds will be loaded from the system default and gcs only supports public access
532
+ - path: s3://path_to_ds # Accepts folder with arrow/parquet or file path like above. Supports s3, gcs.
533
+ ...
534
+
535
+ # Loading Data From a Public URL
536
+ # - The file format is `json` (which includes `jsonl`) by default. For different formats, adjust the `ds_type` option accordingly.
537
+ - path: https://some.url.com/yourdata.jsonl # The URL should be a direct link to the file you wish to load. URLs must use HTTPS protocol, not HTTP.
538
+ ds_type: json # this is the default, see other options below.
539
+ ```
540
+
541
+ - loading
542
+ ```yaml
543
+ load_in_4bit: true
544
+ load_in_8bit: true
545
+
546
+ bf16: auto # require >=ampere, auto will detect if your GPU supports this and choose automatically.
547
+ fp16: # leave empty to use fp16 when bf16 is 'auto'. set to false if you want to fallback to fp32
548
+ tf32: true # require >=ampere
549
+
550
+ bfloat16: true # require >=ampere, use instead of bf16 when you don't want AMP (automatic mixed precision)
551
+ float16: true # use instead of fp16 when you don't want AMP
552
+ ```
553
+ Note: Repo does not do 4-bit quantization.
554
+
555
+ - lora
556
+ ```yaml
557
+ adapter: lora # 'qlora' or leave blank for full finetune
558
+ lora_r: 8
559
+ lora_alpha: 16
560
+ lora_dropout: 0.05
561
+ lora_target_modules:
562
+ - q_proj
563
+ - v_proj
564
+ ```
565
+
566
+ <details id="all-yaml-options">
567
+
568
+ <summary>All yaml options (click to expand)</summary>
569
+
570
+ ```yaml
571
+ # This is the huggingface model that contains *.pt, *.safetensors, or *.bin files
572
+ # This can also be a relative path to a model on disk
573
+ base_model: ./llama-7b-hf
574
+ # You can specify an ignore pattern if the model repo contains more than 1 model type (*.pt, etc)
575
+ base_model_ignore_patterns:
576
+ # If the base_model repo on hf hub doesn't include configuration .json files,
577
+ # You can set that here, or leave this empty to default to base_model
578
+ base_model_config: ./llama-7b-hf
579
+ # You can specify to choose a specific model revision from huggingface hub
580
+ revision_of_model:
581
+ # Optional tokenizer configuration path in case you want to use a different tokenizer
582
+ # than the one defined in the base model
583
+ tokenizer_config:
584
+ # If you want to specify the type of model to load, AutoModelForCausalLM is a good choice too
585
+ model_type: AutoModelForCausalLM
586
+ # Corresponding tokenizer for the model AutoTokenizer is a good choice
587
+ tokenizer_type: AutoTokenizer
588
+ # Trust remote code for untrusted source
589
+ trust_remote_code:
590
+ # use_fast option for tokenizer loading from_pretrained, default to True
591
+ tokenizer_use_fast:
592
+ # Whether to use the legacy tokenizer setting, defaults to True
593
+ tokenizer_legacy:
594
+ # Resize the model embeddings when new tokens are added to multiples of 32
595
+ # This is reported to improve training speed on some models
596
+ resize_token_embeddings_to_32x:
597
+
598
+ # (Internal use only)
599
+ # Used to identify which the model is based on
600
+ is_falcon_derived_model:
601
+ is_llama_derived_model:
602
+ is_qwen_derived_model:
603
+ # Please note that if you set this to true, `padding_side` will be set to "left" by default
604
+ is_mistral_derived_model:
605
+
606
+ # optional overrides to the base model configuration
607
+ overrides_of_model_config:
608
+ # RoPE Scaling https://github.com/huggingface/transformers/pull/24653
609
+ rope_scaling:
610
+ type: # linear | dynamic
611
+ factor: # float
612
+
613
+ # optional overrides to the bnb 4bit quantization configuration
614
+ # https://huggingface.co/docs/transformers/main/main_classes/quantization#transformers.BitsAndBytesConfig
615
+ bnb_config_kwargs:
616
+ # These are default values
617
+ llm_int8_has_fp16_weight: false
618
+ bnb_4bit_quant_type: nf4
619
+ bnb_4bit_use_double_quant: true
620
+
621
+
622
+ # Whether you are training a 4-bit GPTQ quantized model
623
+ gptq: true
624
+
625
+ # This will attempt to quantize the model down to 8 bits and use adam 8 bit optimizer
626
+ load_in_8bit: true
627
+ # Use bitsandbytes 4 bit
628
+ load_in_4bit:
629
+
630
+ # Use CUDA bf16
631
+ bf16: true # bool or 'full' for `bf16_full_eval`. require >=ampere
632
+ # Use CUDA fp16
633
+ fp16: true
634
+ # Use CUDA tf32
635
+ tf32: true # require >=ampere
636
+
637
+ # No AMP (automatic mixed precision)
638
+ bfloat16: true # require >=ampere
639
+ float16: true
640
+
641
+ # Limit the memory for all available GPUs to this amount (if an integer, expressed in gigabytes); default: unset
642
+ gpu_memory_limit: 20GiB
643
+ # Do the LoRA/PEFT loading on CPU -- this is required if the base model is so large it takes up most or all of the available GPU VRAM, e.g. during a model and LoRA merge
644
+ lora_on_cpu: true
645
+
646
+ # A list of one or more datasets to finetune the model with
647
+ datasets:
648
+ # HuggingFace dataset repo | s3://,gs:// path | "json" for local dataset, make sure to fill data_files
649
+ - path: vicgalle/alpaca-gpt4
650
+ # The type of prompt to use for training. [alpaca, sharegpt, gpteacher, oasst, reflection]
651
+ type: alpaca # format | format:<prompt_style> (chat/instruct) | <prompt_strategies>.load_<load_fn>
652
+ ds_type: # Optional[str] (json|arrow|parquet|text|csv) defines the datatype when path is a file
653
+ data_files: # Optional[str] path to source data files
654
+ shards: # Optional[int] number of shards to split data into
655
+ name: # Optional[str] name of dataset configuration to load
656
+ train_on_split: train # Optional[str] name of dataset split to load from
657
+
658
+ # Optional[str] fastchat conversation type, only used with type: sharegpt
659
+ conversation: # Options (see Conversation 'name'): https://github.com/lm-sys/FastChat/blob/main/fastchat/conversation.py
660
+ field_human: # Optional[str]. Human key to use for conversation.
661
+ field_model: # Optional[str]. Assistant key to use for conversation.
662
+ # Add additional keys from your dataset as input or output roles
663
+ roles:
664
+ input: # Optional[List[str]]. These will be masked based on train_on_input
665
+ output: # Optional[List[str]].
666
+
667
+ # Custom user instruction prompt
668
+ - path: repo
669
+ type:
670
+ # The below are defaults. only set what's needed if you use a different column name.
671
+ system_prompt: ""
672
+ system_format: "{system}"
673
+ field_system: system
674
+ field_instruction: instruction
675
+ field_input: input
676
+ field_output: output
677
+
678
+ # Customizable to be single line or multi-line
679
+ # Use {instruction}/{input} as key to be replaced
680
+ # 'format' can include {input}
681
+ format: |-
682
+ User: {instruction} {input}
683
+ Assistant:
684
+ # 'no_input_format' cannot include {input}
685
+ no_input_format: "{instruction} "
686
+
687
+ # For `completion` datsets only, uses the provided field instead of `text` column
688
+ field:
689
+
690
+ # If false, the datasets will not be shuffled and will keep their original order in `datasets`.
691
+ # The same applies to the `test_datasets` option and the `pretraining_dataset` option. Default is true.
692
+ shuffle_merged_datasets: true
693
+
694
+ # A list of one or more datasets to eval the model with.
695
+ # You can use either test_datasets, or val_set_size, but not both.
696
+ test_datasets:
697
+ - path: /workspace/data/eval.jsonl
698
+ ds_type: json
699
+ # You need to specify a split. For "json" datasets the default split is called "train".
700
+ split: train
701
+ type: completion
702
+ data_files:
703
+ - /workspace/data/eval.jsonl
704
+
705
+ # use RL training: 'dpo', 'ipo', 'kto_pair'
706
+ rl:
707
+
708
+ # Saves the desired chat template to the tokenizer_config.json for easier inferencing
709
+ # Currently supports chatml and inst (mistral/mixtral)
710
+ chat_template: chatml
711
+ # Changes the default system message
712
+ default_system_message: You are a helpful assistant. Please give a long and detailed answer. # Currently only supports chatml.
713
+ # Axolotl attempts to save the dataset as an arrow after packing the data together so
714
+ # subsequent training attempts load faster, relative path
715
+ dataset_prepared_path: data/last_run_prepared
716
+ # Push prepared dataset to hub
717
+ push_dataset_to_hub: # repo path
718
+ # The maximum number of processes to use while preprocessing your input dataset. This defaults to `os.cpu_count()`
719
+ # if not set.
720
+ dataset_processes: # defaults to os.cpu_count() if not set
721
+ # Keep dataset in memory while preprocessing
722
+ # Only needed if cached dataset is taking too much storage
723
+ dataset_keep_in_memory:
724
+ # push checkpoints to hub
725
+ hub_model_id: # private repo path to push finetuned model
726
+ # how to push checkpoints to hub
727
+ # https://huggingface.co/docs/transformers/v4.31.0/en/main_classes/trainer#transformers.TrainingArguments.hub_strategy
728
+ hub_strategy:
729
+ # Whether to use hf `use_auth_token` for loading datasets. Useful for fetching private datasets
730
+ # Required to be true when used in combination with `push_dataset_to_hub`
731
+ hf_use_auth_token: # boolean
732
+ # How much of the dataset to set aside as evaluation. 1 = 100%, 0.50 = 50%, etc. 0 for no eval.
733
+ val_set_size: 0.04
734
+ # Num shards for whole dataset
735
+ dataset_shard_num:
736
+ # Index of shard to use for whole dataset
737
+ dataset_shard_idx:
738
+
739
+ # The maximum length of an input to train with, this should typically be less than 2048
740
+ # as most models have a token/context limit of 2048
741
+ sequence_len: 2048
742
+ # Pad inputs so each step uses constant sized buffers
743
+ # This will reduce memory fragmentation and may prevent OOMs, by re-using memory more efficiently
744
+ pad_to_sequence_len:
745
+ # Use efficient multi-packing with block diagonal attention and per sequence position_ids. Recommend set to 'true'
746
+ sample_packing:
747
+ # Set to 'false' if getting errors during eval with sample_packing on.
748
+ eval_sample_packing:
749
+ # You can set these packing optimizations AFTER starting a training at least once.
750
+ # The trainer will provide recommended values for these values.
751
+ sample_packing_eff_est:
752
+ total_num_tokens:
753
+
754
+ # Passed through to transformers when loading the model when launched without accelerate
755
+ # Use `sequential` when training w/ model parallelism to limit memory
756
+ device_map:
757
+ # Defines the max memory usage per gpu on the system. Passed through to transformers when loading the model.
758
+ max_memory:
759
+
760
+ # If you want to use 'lora' or 'qlora' or leave blank to train all parameters in original model
761
+ adapter: lora
762
+ # If you already have a lora model trained that you want to load, put that here.
763
+ # This means after training, if you want to test the model, you should set this to the value of `output_dir`.
764
+ # Note that if you merge an adapter to the base model, a new subdirectory `merged` will be created under the `output_dir`.
765
+ lora_model_dir:
766
+
767
+ # LoRA hyperparameters
768
+ # For more details about the following options, see:
769
+ # https://www.anyscale.com/blog/fine-tuning-llms-lora-or-full-parameter-an-in-depth-analysis-with-llama-2
770
+ lora_r: 8
771
+ lora_alpha: 16
772
+ lora_dropout: 0.05
773
+ lora_target_modules:
774
+ - q_proj
775
+ - v_proj
776
+ # - k_proj
777
+ # - o_proj
778
+ # - gate_proj
779
+ # - down_proj
780
+ # - up_proj
781
+ lora_target_linear: # If true, will target all linear modules
782
+ peft_layers_to_transform: # The layer indices to transform, otherwise, apply to all layers
783
+
784
+ # If you added new tokens to the tokenizer, you may need to save some LoRA modules because they need to know the new tokens.
785
+ # For LLaMA and Mistral, you need to save `embed_tokens` and `lm_head`. It may vary for other models.
786
+ # `embed_tokens` converts tokens to embeddings, and `lm_head` converts embeddings to token probabilities.
787
+ # https://github.com/huggingface/peft/issues/334#issuecomment-1561727994
788
+ lora_modules_to_save:
789
+ # - embed_tokens
790
+ # - lm_head
791
+
792
+ lora_fan_in_fan_out: false
793
+
794
+ peft:
795
+ # Configuration options for loftq initialization for LoRA
796
+ # https://huggingface.co/docs/peft/developer_guides/quantization#loftq-initialization
797
+ loftq_config:
798
+ loftq_bits: # typically 4 bits
799
+
800
+ # ReLoRA configuration
801
+ # Must use either 'lora' or 'qlora' adapter, and does not support fsdp or deepspeed
802
+ relora_steps: # Number of steps per ReLoRA restart
803
+ relora_warmup_steps: # Number of per-restart warmup steps
804
+ relora_anneal_steps: # Number of anneal steps for each relora cycle
805
+ relora_prune_ratio: # threshold for optimizer magnitude when pruning
806
+ relora_cpu_offload: # True to perform lora weight merges on cpu during restarts, for modest gpu memory savings
807
+
808
+ # wandb configuration if you're using it
809
+ # Make sure your `WANDB_API_KEY` environment variable is set (recommended) or you login to wandb with `wandb login`.
810
+ wandb_mode: # "offline" to save run metadata locally and not sync to the server, "disabled" to turn off wandb
811
+ wandb_project: # Your wandb project name
812
+ wandb_entity: # A wandb Team name if using a Team
813
+ wandb_watch:
814
+ wandb_name: # Set the name of your wandb run
815
+ wandb_run_id: # Set the ID of your wandb run
816
+ wandb_log_model: # "checkpoint" to log model to wandb Artifacts every `save_steps` or "end" to log only at the end of training
817
+
818
+ # mlflow configuration if you're using it
819
+ mlflow_tracking_uri: # URI to mlflow
820
+ mlflow_experiment_name: # Your experiment name
821
+ hf_mlflow_log_artifacts: # set to true to copy each saved checkpoint on each save to mlflow artifact registry
822
+
823
+ # Where to save the full-finetuned model to
824
+ output_dir: ./completed-model
825
+
826
+ # Whether to use torch.compile and which backend to use
827
+ torch_compile: # bool
828
+ torch_compile_backend: # Optional[str]
829
+
830
+ # Training hyperparameters
831
+
832
+ # If greater than 1, backpropagation will be skipped and the gradients will be accumulated for the given number of steps.
833
+ gradient_accumulation_steps: 1
834
+ # The number of samples to include in each batch. This is the number of samples sent to each GPU.
835
+ micro_batch_size: 2
836
+ eval_batch_size:
837
+ num_epochs: 4
838
+ warmup_steps: 100 # cannot use with warmup_ratio
839
+ warmup_ratio: 0.05 # cannot use with warmup_steps
840
+ learning_rate: 0.00003
841
+ lr_quadratic_warmup:
842
+ logging_steps:
843
+ eval_steps: # Leave empty to eval at each epoch, integers for every N steps. decimal for fraction of total steps
844
+ evals_per_epoch: # number of times per epoch to run evals, mutually exclusive with eval_steps
845
+ save_strategy: # Set to `no` to skip checkpoint saves
846
+ save_steps: # Leave empty to save at each epoch
847
+ saves_per_epoch: # number of times per epoch to save a checkpoint, mutually exclusive with save_steps
848
+ save_total_limit: # Checkpoints saved at a time
849
+ # Maximum number of iterations to train for. It precedes num_epochs which means that
850
+ # if both are set, num_epochs will not be guaranteed.
851
+ # e.g., when 1 epoch is 1000 steps => `num_epochs: 2` and `max_steps: 100` will train for 100 steps
852
+ max_steps:
853
+
854
+ eval_table_size: # Approximate number of predictions sent to wandb depending on batch size. Enabled above 0. Default is 0
855
+ eval_max_new_tokens: # Total number of tokens generated for predictions sent to wandb. Default is 128
856
+ eval_causal_lm_metrics: # HF evaluate metrics used during evaluation. Default is ["sacrebleu", "comet", "ter", chrf]
857
+
858
+ loss_watchdog_threshold: # High loss value, indicating the learning has broken down (a good estimate is ~2 times the loss at the start of training)
859
+ loss_watchdog_patience: # Number of high-loss steps in a row before the trainer aborts (default: 3)
860
+
861
+ # Save model as safetensors (require safetensors package)
862
+ save_safetensors:
863
+
864
+ # Whether to mask out or include the human's prompt from the training labels
865
+ train_on_inputs: false
866
+ # Group similarly sized data to minimize padding.
867
+ # May be slower to start, as it must download and sort the entire dataset.
868
+ # Note that training loss may have an oscillating pattern with this enabled.
869
+ group_by_length: false
870
+
871
+ # Whether to use gradient checkpointing https://huggingface.co/docs/transformers/v4.18.0/en/performance#gradient-checkpointing
872
+ gradient_checkpointing: false
873
+ # additional kwargs to pass to the trainer for gradient checkpointing
874
+ # gradient_checkpointing_kwargs:
875
+ # use_reentrant: true
876
+
877
+ # Stop training after this many evaluation losses have increased in a row
878
+ # https://huggingface.co/transformers/v4.2.2/_modules/transformers/trainer_callback.html#EarlyStoppingCallback
879
+ early_stopping_patience: 3
880
+
881
+ # Specify a scheduler and kwargs to use with the optimizer
882
+ lr_scheduler: # 'one_cycle' | 'log_sweep' | empty for cosine
883
+ lr_scheduler_kwargs:
884
+ cosine_min_lr_ratio: # decay lr to some percentage of the peak lr, e.g. cosine_min_lr_ratio=0.1 for 10% of peak lr
885
+ cosine_constant_lr_ratio: # freeze lr at some percentage of the step, e.g. cosine_constant_lr_ratio=0.8 means start cosine_min_lr at 80% of training step (https://arxiv.org/pdf/2308.04014.pdf)
886
+
887
+ # For one_cycle optim
888
+ lr_div_factor: # Learning rate div factor
889
+
890
+ # Specify optimizer
891
+ # Valid values are driven by the Transformers OptimizerNames class, see:
892
+ # https://github.com/huggingface/transformers/blob/95b374952dc27d8511541d6f5a4e22c9ec11fb24/src/transformers/training_args.py#L134
893
+ #
894
+ # Note that not all optimizers may be available in your environment, ex: 'adamw_anyprecision' is part of
895
+ # torchdistx, 'adamw_bnb_8bit' is part of bnb.optim.Adam8bit, etc. When in doubt, it is recommended to start with the optimizer used
896
+ # in the examples/ for your model and fine-tuning use case.
897
+ #
898
+ # Valid values for 'optimizer' include:
899
+ # - adamw_hf
900
+ # - adamw_torch
901
+ # - adamw_torch_fused
902
+ # - adamw_torch_xla
903
+ # - adamw_apex_fused
904
+ # - adafactor
905
+ # - adamw_anyprecision
906
+ # - sgd
907
+ # - adagrad
908
+ # - adamw_bnb_8bit
909
+ # - lion_8bit
910
+ # - lion_32bit
911
+ # - paged_adamw_32bit
912
+ # - paged_adamw_8bit
913
+ # - paged_lion_32bit
914
+ # - paged_lion_8bit
915
+ # - galore_adamw
916
+ # - galore_adamw_8bit
917
+ # - galore_adafactor
918
+ # - galore_adamw_layerwise
919
+ # - galore_adamw_8bit_layerwise
920
+ # - galore_adafactor_layerwise
921
+ optimizer:
922
+ # Dictionary of arguments to pass to the optimizer
923
+ optim_args:
924
+ # For Galore Optimizers the following optim_args are available
925
+ # rank: # type: int
926
+ # update_proj_gap # type: int
927
+ # scale # type: float
928
+ # proj_type: # type: str, default = std
929
+
930
+ # The target modules to optimize, i.e. the module names that you would like to train, right now this is used only for GaLore algorithm
931
+ optim_target_modules:
932
+ # - self_attn # for llama
933
+ # - mlp
934
+
935
+ # Specify weight decay
936
+ weight_decay:
937
+ # adamw hyperparams
938
+ adam_beta1:
939
+ adam_beta2:
940
+ adam_epsilon:
941
+ # Gradient clipping max norm
942
+ max_grad_norm:
943
+
944
+ # Augmentation techniques
945
+ # NEFT https://arxiv.org/abs/2310.05914, set this to a number (paper default is 5) to add noise to embeddings
946
+ # currently only supported on Llama and Mistral
947
+ neftune_noise_alpha:
948
+
949
+ # Whether to bettertransformers
950
+ flash_optimum:
951
+ # Whether to use xformers attention patch https://github.com/facebookresearch/xformers:
952
+ xformers_attention:
953
+ # Whether to use flash attention patch https://github.com/Dao-AILab/flash-attention:
954
+ flash_attention:
955
+ flash_attn_cross_entropy: # Whether to use flash-attention cross entropy implementation - advanced use only
956
+ flash_attn_rms_norm: # Whether to use flash-attention rms norm implementation - advanced use only
957
+ flash_attn_fuse_qkv: # Whether to fuse QKV into a single operation
958
+ flash_attn_fuse_mlp: # Whether to fuse part of the MLP into a single operation
959
+ # Whether to use scaled-dot-product attention
960
+ # https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html
961
+ sdp_attention:
962
+ # Shifted-sparse attention (only llama) - https://arxiv.org/pdf/2309.12307.pdf
963
+ s2_attention:
964
+ # Resume from a specific checkpoint dir
965
+ resume_from_checkpoint:
966
+ # If resume_from_checkpoint isn't set and you simply want it to start where it left off.
967
+ # Be careful with this being turned on between different models.
968
+ auto_resume_from_checkpoints: false
969
+
970
+ # Don't mess with this, it's here for accelerate and torchrun
971
+ local_rank:
972
+
973
+ # Add or change special tokens.
974
+ # If you add tokens here, you don't need to add them to the `tokens` list.
975
+ special_tokens:
976
+ # bos_token: "<s>"
977
+ # eos_token: "</s>"
978
+ # unk_token: "<unk>"
979
+
980
+ # Add extra tokens.
981
+ tokens:
982
+
983
+ # FSDP
984
+ fsdp:
985
+ fsdp_config:
986
+
987
+ # Deepspeed config path. e.g., deepspeed_configs/zero3.json
988
+ deepspeed:
989
+
990
+ # Advanced DDP Arguments
991
+ ddp_timeout:
992
+ ddp_bucket_cap_mb:
993
+ ddp_broadcast_buffers:
994
+
995
+ # Path to torch distx for optim 'adamw_anyprecision'
996
+ torchdistx_path:
997
+
998
+ # Set to HF dataset for type: 'completion' for streaming instead of pre-tokenize
999
+ pretraining_dataset:
1000
+
1001
+ # Debug mode
1002
+ debug:
1003
+
1004
+ # Seed
1005
+ seed:
1006
+
1007
+ # Allow overwrite yml config using from cli
1008
+ strict:
1009
+ ```
1010
+
1011
+ </details>
1012
+
1013
+ <details>
1014
+ <summary> Understanding of batch size and gradient accumulation steps </summary>
1015
+ <br/>
1016
+ Gradient accumulation means accumulating gradients over several mini-batches and updating the model weights afterward. When the samples in each batch are diverse, this technique doesn't significantly impact learning.
1017
+
1018
+ This method allows for effective training with larger effective batch sizes without needing proportionally larger memory. Here's why:
1019
+
1020
+ 1. **Memory Consumption with Batch Size**: The primary reason increasing the batch size impacts memory is due to the storage requirements for intermediate activations. When you forward propagate a batch through a network, you have to store the activations at each layer for each sample in the batch, because these activations are used during backpropagation to compute gradients. Therefore, larger batches mean more activations, leading to greater GPU memory consumption.
1021
+
1022
+ 2. **Gradient Accumulation**: With gradient accumulation, you're effectively simulating a larger batch size by accumulating gradients over several smaller batches (or micro-batches). However, at any given time, you're only forward and backward propagating a micro-batch. This means you only store activations for the micro-batch, not the full accumulated batch. As a result, you can simulate the effect of a larger batch size without the memory cost of storing activations for a large batch.
1023
+
1024
+ **Example 1:**
1025
+ Micro batch size: 3
1026
+ Gradient accumulation steps: 2
1027
+ Number of GPUs: 3
1028
+ Total batch size = 3 * 2 * 3 = 18
1029
+
1030
+ ```
1031
+ | GPU 1 | GPU 2 | GPU 3 |
1032
+ |----------------|----------------|----------------|
1033
+ | S1, S2, S3 | S4, S5, S6 | S7, S8, S9 |
1034
+ | e1, e2, e3 | e4, e5, e6 | e7, e8, e9 |
1035
+ |----------------|----------------|----------------|
1036
+ | → (accumulate) | → (accumulate) | → (accumulate) |
1037
+ |----------------|----------------|----------------|
1038
+ | S10, S11, S12 | S13, S14, S15 | S16, S17, S18 |
1039
+ | e10, e11, e12 | e13, e14, e15 | e16, e17, e18 |
1040
+ |----------------|----------------|----------------|
1041
+ | → (apply) | → (apply) | → (apply) |
1042
+
1043
+ Accumulated gradient for the weight w1 after the second iteration (considering all GPUs):
1044
+ Total gradient for w1 = e1 + e2 + e3 + e4 + e5 + e6 + e7 + e8 + e9 + e10 + e11 + e12 + e13 + e14 + e15 + e16 + e17 + e18
1045
+
1046
+ Weight update for w1:
1047
+ w1_new = w1_old - learning rate x (Total gradient for w1 / 18)
1048
+ ```
1049
+
1050
+ **Example 2:**
1051
+ Micro batch size: 2
1052
+ Gradient accumulation steps: 1
1053
+ Number of GPUs: 3
1054
+ Total batch size = 2 * 1 * 3 = 6
1055
+
1056
+ ```
1057
+ | GPU 1 | GPU 2 | GPU 3 |
1058
+ |-----------|-----------|-----------|
1059
+ | S1, S2 | S3, S4 | S5, S6 |
1060
+ | e1, e2 | e3, e4 | e5, e6 |
1061
+ |-----------|-----------|-----------|
1062
+ | → (apply) | → (apply) | → (apply) |
1063
+
1064
+ Accumulated gradient for the weight w1 (considering all GPUs):
1065
+ Total gradient for w1 = e1 + e2 + e3 + e4 + e5 + e6
1066
+
1067
+ Weight update for w1:
1068
+ w1_new = w1_old - learning rate × (Total gradient for w1 / 6)
1069
+ ```
1070
+
1071
+ </details>
1072
+
1073
+ ### Train
1074
+
1075
+ Run
1076
+ ```bash
1077
+ accelerate launch -m axolotl.cli.train your_config.yml
1078
+ ```
1079
+
1080
+ > [!TIP]
1081
+ > You can also reference a config file that is hosted on a public URL, for example `accelerate launch -m axolotl.cli.train https://yourdomain.com/your_config.yml`
1082
+
1083
+ #### Preprocess dataset
1084
+
1085
+ You can optionally pre-tokenize dataset with the following before finetuning.
1086
+ This is recommended for large datasets.
1087
+
1088
+ - Set `dataset_prepared_path:` to a local folder for saving and loading pre-tokenized dataset.
1089
+ - (Optional): Set `push_dataset_to_hub: hf_user/repo` to push it to Huggingface.
1090
+ - (Optional): Use `--debug` to see preprocessed examples.
1091
+
1092
+ ```bash
1093
+ python -m axolotl.cli.preprocess your_config.yml
1094
+ ```
1095
+
1096
+ #### Multi-GPU
1097
+
1098
+ Below are the options available in axolotl for training with multiple GPUs. Note that DeepSpeed
1099
+ is the recommended multi-GPU option currently because FSDP may experience
1100
+ [loss instability](https://github.com/huggingface/transformers/issues/26498).
1101
+
1102
+ ##### DeepSpeed
1103
+
1104
+ Deepspeed is an optimization suite for multi-gpu systems allowing you to train much larger models than you
1105
+ might typically be able to fit into your GPU's VRAM. More information about the various optimization types
1106
+ for deepspeed is available at https://huggingface.co/docs/accelerate/main/en/usage_guides/deepspeed#what-is-integrated
1107
+
1108
+ We provide several default deepspeed JSON configurations for ZeRO stage 1, 2, and 3.
1109
+
1110
+ ```yaml
1111
+ deepspeed: deepspeed_configs/zero1.json
1112
+ ```
1113
+
1114
+ ```shell
1115
+ accelerate launch -m axolotl.cli.train examples/llama-2/config.py --deepspeed deepspeed_configs/zero1.json
1116
+ ```
1117
+
1118
+ ##### FSDP
1119
+
1120
+ - llama FSDP
1121
+ ```yaml
1122
+ fsdp:
1123
+ - full_shard
1124
+ - auto_wrap
1125
+ fsdp_config:
1126
+ fsdp_offload_params: true
1127
+ fsdp_state_dict_type: FULL_STATE_DICT
1128
+ fsdp_transformer_layer_cls_to_wrap: LlamaDecoderLayer
1129
+ ```
1130
+
1131
+ ##### FSDP + QLoRA
1132
+
1133
+ Axolotl supports training with FSDP and QLoRA, see [these docs](docs/fsdp_qlora.qmd) for more information.
1134
+
1135
+ ##### Weights & Biases Logging
1136
+
1137
+ Make sure your `WANDB_API_KEY` environment variable is set (recommended) or you login to wandb with `wandb login`.
1138
+
1139
+ - wandb options
1140
+ ```yaml
1141
+ wandb_mode:
1142
+ wandb_project:
1143
+ wandb_entity:
1144
+ wandb_watch:
1145
+ wandb_name:
1146
+ wandb_log_model:
1147
+ ```
1148
+
1149
+ ##### Special Tokens
1150
+
1151
+ It is important to have special tokens like delimiters, end-of-sequence, beginning-of-sequence in your tokenizer's vocabulary. This will help you avoid tokenization issues and help your model train better. You can do this in axolotl like this:
1152
+
1153
+ ```yml
1154
+ special_tokens:
1155
+ bos_token: "<s>"
1156
+ eos_token: "</s>"
1157
+ unk_token: "<unk>"
1158
+ tokens: # these are delimiters
1159
+ - "<|im_start|>"
1160
+ - "<|im_end|>"
1161
+ ```
1162
+
1163
+ When you include these tokens in your axolotl config, axolotl adds these tokens to the tokenizer's vocabulary.
1164
+
1165
+ ### Inference Playground
1166
+
1167
+ Axolotl allows you to load your model in an interactive terminal playground for quick experimentation.
1168
+ The config file is the same config file used for training.
1169
+
1170
+ Pass the appropriate flag to the inference command, depending upon what kind of model was trained:
1171
+
1172
+ - Pretrained LORA:
1173
+ ```bash
1174
+ python -m axolotl.cli.inference examples/your_config.yml --lora_model_dir="./lora-output-dir"
1175
+ ```
1176
+ - Full weights finetune:
1177
+ ```bash
1178
+ python -m axolotl.cli.inference examples/your_config.yml --base_model="./completed-model"
1179
+ ```
1180
+ - Full weights finetune w/ a prompt from a text file:
1181
+ ```bash
1182
+ cat /tmp/prompt.txt | python -m axolotl.cli.inference examples/your_config.yml \
1183
+ --base_model="./completed-model" --prompter=None --load_in_8bit=True
1184
+ ```
1185
+ -- With gradio hosting
1186
+ ```bash
1187
+ python -m axolotl.cli.inference examples/your_config.yml --gradio
1188
+ ```
1189
+
1190
+ Please use `--sample_packing False` if you have it on and receive the error similar to below:
1191
+
1192
+ > RuntimeError: stack expects each tensor to be equal size, but got [1, 32, 1, 128] at entry 0 and [1, 32, 8, 128] at entry 1
1193
+
1194
+ ### Merge LORA to base
1195
+
1196
+ The following command will merge your LORA adapater with your base model. You can optionally pass the argument `--lora_model_dir` to specify the directory where your LORA adapter was saved, otherwhise, this will be inferred from `output_dir` in your axolotl config file. The merged model is saved in the sub-directory `{lora_model_dir}/merged`.
1197
+
1198
+ ```bash
1199
+ python3 -m axolotl.cli.merge_lora your_config.yml --lora_model_dir="./completed-model"
1200
+ ```
1201
+
1202
+ You may need to use the `gpu_memory_limit` and/or `lora_on_cpu` config options to avoid running out of memory. If you still run out of CUDA memory, you can try to merge in system RAM with
1203
+
1204
+ ```bash
1205
+ CUDA_VISIBLE_DEVICES="" python3 -m axolotl.cli.merge_lora ...
1206
+ ```
1207
+
1208
+ although this will be very slow, and using the config options above are recommended instead.
1209
+
1210
+ ## Common Errors 🧰
1211
+
1212
+ See also the [FAQ's](./docs/faq.qmd) and [debugging guide](docs/debugging.qmd).
1213
+
1214
+ > If you encounter a 'Cuda out of memory' error, it means your GPU ran out of memory during the training process. Here's how to resolve it:
1215
+
1216
+ Please reduce any below
1217
+ - `micro_batch_size`
1218
+ - `eval_batch_size`
1219
+ - `gradient_accumulation_steps`
1220
+ - `sequence_len`
1221
+
1222
+ If it does not help, try running without deepspeed and without accelerate (replace "accelerate launch" with "python") in the command.
1223
+
1224
+ Using adamw_bnb_8bit might also save you some memory.
1225
+
1226
+ > `failed (exitcode: -9)`
1227
+
1228
+ Usually means your system has run out of system memory.
1229
+ Similarly, you should consider reducing the same settings as when you run out of VRAM.
1230
+ Additionally, look into upgrading your system RAM which should be simpler than GPU upgrades.
1231
+
1232
+ > RuntimeError: expected scalar type Float but found Half
1233
+
1234
+ Try set `fp16: true`
1235
+
1236
+ > NotImplementedError: No operator found for `memory_efficient_attention_forward` ...
1237
+
1238
+ Try to turn off xformers.
1239
+
1240
+ > accelerate config missing
1241
+
1242
+ It's safe to ignore it.
1243
+
1244
+ > NCCL Timeouts during training
1245
+
1246
+ See the [NCCL](docs/nccl.qmd) guide.
1247
+
1248
+
1249
+ ### Tokenization Mismatch b/w Inference & Training
1250
+
1251
+ For many formats, Axolotl constructs prompts by concatenating token ids _after_ tokenizing strings. The reason for concatenating token ids rather than operating on strings is to maintain precise accounting for attention masks.
1252
+
1253
+ If you decode a prompt constructed by axolotl, you might see spaces between tokens (or lack thereof) that you do not expect, especially around delimiters and special tokens. When you are starting out with a new format, you should always do the following:
1254
+
1255
+ 1. Materialize some data using `python -m axolotl.cli.preprocess your_config.yml --debug`, and then decode the first few rows with your model's tokenizer.
1256
+ 2. During inference, right before you pass a tensor of token ids to your model, decode these tokens back into a string.
1257
+ 3. Make sure the inference string from #2 looks **exactly** like the data you fine tuned on from #1, including spaces and new lines. If they aren't the same, adjust your inference server accordingly.
1258
+ 4. As an additional troubleshooting step, you can look at the token ids between 1 and 2 to make sure they are identical.
1259
+
1260
+ Having misalignment between your prompts during training and inference can cause models to perform very poorly, so it is worth checking this. See [this blog post](https://hamel.dev/notes/llm/05_tokenizer_gotchas.html) for a concrete example.
1261
+
1262
+ ## Debugging Axolotl
1263
+
1264
+ See [this debugging guide](docs/debugging.qmd) for tips on debugging Axolotl, along with an example configuration for debugging with VSCode.
1265
+
1266
+ ## Need help? 🙋
1267
+
1268
+ Join our [Discord server](https://discord.gg/HhrNrHJPRb) where we our community members can help you.
1269
+
1270
+ Need dedicated support? Please contact us at [✉️wing@openaccessaicollective.org](mailto:wing@openaccessaicollective.org) for dedicated support options.
1271
+
1272
+ ## Badge ❤🏷️
1273
+
1274
+ Building something cool with Axolotl? Consider adding a badge to your model card.
1275
+
1276
+ ```markdown
1277
+ [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
1278
+ ```
1279
+
1280
+ [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
1281
+
1282
+ ## Community Showcase
1283
+
1284
+ Check out some of the projects and models that have been built using Axolotl! Have a model you'd like to add to our Community Showcase? Open a PR with your model.
1285
+
1286
+ Open Access AI Collective
1287
+ - [Minotaur 13b](https://huggingface.co/openaccess-ai-collective/minotaur-13b-fixed)
1288
+ - [Manticore 13b](https://huggingface.co/openaccess-ai-collective/manticore-13b)
1289
+ - [Hippogriff 30b](https://huggingface.co/openaccess-ai-collective/hippogriff-30b-chat)
1290
+
1291
+ PocketDoc Labs
1292
+ - [Dan's PersonalityEngine 13b LoRA](https://huggingface.co/PocketDoc/Dans-PersonalityEngine-13b-LoRA)
1293
+
1294
+ ## Contributing 🤝
1295
+
1296
+ Please read the [contributing guide](./.github/CONTRIBUTING.md)
1297
+
1298
+ Bugs? Please check the [open issues](https://github.com/OpenAccess-AI-Collective/axolotl/issues/bug) else create a new Issue.
1299
+
1300
+ PRs are **greatly welcome**!
1301
+
1302
+ Please run below to setup env
1303
+ ```bash
1304
+ git clone https://github.com/OpenAccess-AI-Collective/axolotl
1305
+ cd axolotl
1306
+
1307
+ pip3 install packaging
1308
+ pip3 install -e '.[flash-attn,deepspeed]'
1309
+
1310
+ pip3 install -r requirements-dev.txt -r requirements-tests.txt
1311
+ pre-commit install
1312
+
1313
+ # test
1314
+ pytest tests/
1315
+
1316
+ # optional: run against all files
1317
+ pre-commit run --all-files
1318
+ ```
1319
+
1320
+ Thanks to all of our contributors to date. Help drive open source AI progress forward by contributing to Axolotl.
1321
+
1322
+ <a href="https://github.com/openaccess-ai-collective/axolotl/graphs/contributors">
1323
+ <img src="https://contrib.rocks/image?repo=openaccess-ai-collective/axolotl" alt="contributor chart by https://contrib.rocks"/>
1324
+ </a>
1325
+
1326
+ ## Sponsors 🤝❤
1327
+
1328
+ OpenAccess AI Collective is run by volunteer contributors such as [winglian](https://github.com/winglian),
1329
+ [NanoCode012](https://github.com/NanoCode012), [tmm1](https://github.com/tmm1),
1330
+ [mhenrichsen](https://github.com/mhenrichsen), [casper-hansen](https://github.com/casper-hansen),
1331
+ [hamelsmu](https://github.com/hamelsmu) and many more who help us accelerate forward by fixing bugs, answering
1332
+ community questions and implementing new features. Axolotl needs donations from sponsors for the compute needed to
1333
+ run our unit & integration tests, troubleshooting community issues, and providing bounties. If you love axolotl,
1334
+ consider sponsoring the project via [GitHub Sponsors](https://github.com/sponsors/OpenAccess-AI-Collective),
1335
+ [Ko-fi](https://ko-fi.com/axolotl_ai) or reach out directly to
1336
+ [wing@openaccessaicollective.org](mailto:wing@openaccessaicollective.org).
1337
+
1338
+ ---
1339
+
1340
+ #### 💎 Diamond Sponsors - [Contact directly](mailto:wing@openaccessaicollective.org)
1341
+
1342
+ ---
1343
+
1344
+ #### 🥇 Gold Sponsors - $5000/mo
1345
+
1346
+ ---
1347
+
1348
+ #### 🥈 Silver Sponsors - $1000/mo
1349
+
1350
+ ---
1351
+
1352
+ #### 🥉 Bronze Sponsors - $500/mo
1353
+
1354
+ - [JarvisLabs.ai](https://jarvislabs.ai)
1355
+
1356
+ ---
TODO.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # todo list
2
+
3
+ - [] Validation of parameters for combinations that won't work
4
+
5
+
6
+
7
+ ## things that are known not to work
8
+
9
+ - FSDP offload and gradient_checkpointing - https://github.com/pytorch/pytorch/issues/82203
10
+ - adamw_bnb_8bit doesn't play well with FSDP offload
_quarto.yml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ project:
2
+ type: website
3
+
4
+ website:
5
+ title: "Axolotl"
6
+ description: "Fine-tuning"
7
+ favicon: favicon.jpg
8
+ navbar:
9
+ title: Axolotl
10
+ background: dark
11
+ pinned: false
12
+ collapse: false
13
+ tools:
14
+ - icon: twitter
15
+ href: https://twitter.com/axolotl_ai
16
+ - icon: github
17
+ href: https://github.com/OpenAccess-AI-Collective/axolotl/
18
+ - icon: discord
19
+ href: https://discord.gg/7m9sfhzaf3
20
+
21
+ sidebar:
22
+ pinned: true
23
+ collapse-level: 2
24
+ style: docked
25
+ contents:
26
+ - text: Home
27
+ href: index.qmd
28
+ - section: "How-To Guides"
29
+ contents:
30
+ # TODO Edit folder structure after we have more docs.
31
+ - docs/debugging.qmd
32
+ - docs/multipack.qmd
33
+ - docs/fdsp_qlora.qmd
34
+ - docs/input_output.qmd
35
+ - docs/rlhf.qmd
36
+ - docs/nccl.qmd
37
+ - docs/mac.qmd
38
+ - docs/multi-node.qmd
39
+ - section: "Reference"
40
+ contents:
41
+ - docs/config.qmd
42
+ - docs/faq.qmd
43
+
44
+
45
+
46
+
47
+ format:
48
+ html:
49
+ theme: materia
50
+ css: styles.css
51
+ toc: true
axol/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # created by virtualenv automatically
2
+ *
axol/bin/activate ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used with "source bin/activate" *from bash*
2
+ # you cannot run it directly
3
+
4
+
5
+ if [ "${BASH_SOURCE-}" = "$0" ]; then
6
+ echo "You must source this script: \$ source $0" >&2
7
+ exit 33
8
+ fi
9
+
10
+ deactivate () {
11
+ unset -f pydoc >/dev/null 2>&1 || true
12
+
13
+ # reset old environment variables
14
+ # ! [ -z ${VAR+_} ] returns true if VAR is declared at all
15
+ if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then
16
+ PATH="$_OLD_VIRTUAL_PATH"
17
+ export PATH
18
+ unset _OLD_VIRTUAL_PATH
19
+ fi
20
+ if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
21
+ PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
22
+ export PYTHONHOME
23
+ unset _OLD_VIRTUAL_PYTHONHOME
24
+ fi
25
+
26
+ # The hash command must be called to get it to forget past
27
+ # commands. Without forgetting past commands the $PATH changes
28
+ # we made may not be respected
29
+ hash -r 2>/dev/null
30
+
31
+ if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
32
+ PS1="$_OLD_VIRTUAL_PS1"
33
+ export PS1
34
+ unset _OLD_VIRTUAL_PS1
35
+ fi
36
+
37
+ unset VIRTUAL_ENV
38
+ unset VIRTUAL_ENV_PROMPT
39
+ if [ ! "${1-}" = "nondestructive" ] ; then
40
+ # Self destruct!
41
+ unset -f deactivate
42
+ fi
43
+ }
44
+
45
+ # unset irrelevant variables
46
+ deactivate nondestructive
47
+
48
+ VIRTUAL_ENV='/workspace/axolotl/axol'
49
+ if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then
50
+ VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV")
51
+ fi
52
+ export VIRTUAL_ENV
53
+
54
+ _OLD_VIRTUAL_PATH="$PATH"
55
+ PATH="$VIRTUAL_ENV/bin:$PATH"
56
+ export PATH
57
+
58
+ if [ "x" != x ] ; then
59
+ VIRTUAL_ENV_PROMPT=""
60
+ else
61
+ VIRTUAL_ENV_PROMPT=$(basename "$VIRTUAL_ENV")
62
+ fi
63
+ export VIRTUAL_ENV_PROMPT
64
+
65
+ # unset PYTHONHOME if set
66
+ if ! [ -z "${PYTHONHOME+_}" ] ; then
67
+ _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
68
+ unset PYTHONHOME
69
+ fi
70
+
71
+ if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
72
+ _OLD_VIRTUAL_PS1="${PS1-}"
73
+ PS1="(${VIRTUAL_ENV_PROMPT}) ${PS1-}"
74
+ export PS1
75
+ fi
76
+
77
+ # Make sure to unalias pydoc if it's already there
78
+ alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true
79
+
80
+ pydoc () {
81
+ python -m pydoc "$@"
82
+ }
83
+
84
+ # The hash command must be called to get it to forget past
85
+ # commands. Without forgetting past commands the $PATH changes
86
+ # we made may not be respected
87
+ hash -r 2>/dev/null
axol/bin/activate.csh ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used with "source bin/activate.csh" *from csh*.
2
+ # You cannot run it directly.
3
+ # Created by Davide Di Blasi <davidedb@gmail.com>.
4
+
5
+ set newline='\
6
+ '
7
+
8
+ alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH:q" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT:q" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
9
+
10
+ # Unset irrelevant variables.
11
+ deactivate nondestructive
12
+
13
+ setenv VIRTUAL_ENV '/workspace/axolotl/axol'
14
+
15
+ set _OLD_VIRTUAL_PATH="$PATH:q"
16
+ setenv PATH "$VIRTUAL_ENV:q/bin:$PATH:q"
17
+
18
+
19
+
20
+ if ('' != "") then
21
+ setenv VIRTUAL_ENV_PROMPT ''
22
+ else
23
+ setenv VIRTUAL_ENV_PROMPT "$VIRTUAL_ENV:t:q"
24
+ endif
25
+
26
+ if ( $?VIRTUAL_ENV_DISABLE_PROMPT ) then
27
+ if ( $VIRTUAL_ENV_DISABLE_PROMPT == "" ) then
28
+ set do_prompt = "1"
29
+ else
30
+ set do_prompt = "0"
31
+ endif
32
+ else
33
+ set do_prompt = "1"
34
+ endif
35
+
36
+ if ( $do_prompt == "1" ) then
37
+ # Could be in a non-interactive environment,
38
+ # in which case, $prompt is undefined and we wouldn't
39
+ # care about the prompt anyway.
40
+ if ( $?prompt ) then
41
+ set _OLD_VIRTUAL_PROMPT="$prompt:q"
42
+ if ( "$prompt:q" =~ *"$newline:q"* ) then
43
+ :
44
+ else
45
+ set prompt = '('"$VIRTUAL_ENV_PROMPT:q"') '"$prompt:q"
46
+ endif
47
+ endif
48
+ endif
49
+
50
+ unset env_name
51
+ unset do_prompt
52
+
53
+ alias pydoc python -m pydoc
54
+
55
+ rehash
axol/bin/activate.fish ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
2
+ # Do not run it directly.
3
+
4
+ function _bashify_path -d "Converts a fish path to something bash can recognize"
5
+ set fishy_path $argv
6
+ set bashy_path $fishy_path[1]
7
+ for path_part in $fishy_path[2..-1]
8
+ set bashy_path "$bashy_path:$path_part"
9
+ end
10
+ echo $bashy_path
11
+ end
12
+
13
+ function _fishify_path -d "Converts a bash path to something fish can recognize"
14
+ echo $argv | tr ':' '\n'
15
+ end
16
+
17
+ function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
18
+ # reset old environment variables
19
+ if test -n "$_OLD_VIRTUAL_PATH"
20
+ # https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
21
+ if test (echo $FISH_VERSION | head -c 1) -lt 3
22
+ set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH")
23
+ else
24
+ set -gx PATH $_OLD_VIRTUAL_PATH
25
+ end
26
+ set -e _OLD_VIRTUAL_PATH
27
+ end
28
+
29
+ if test -n "$_OLD_VIRTUAL_PYTHONHOME"
30
+ set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME"
31
+ set -e _OLD_VIRTUAL_PYTHONHOME
32
+ end
33
+
34
+ if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
35
+ and functions -q _old_fish_prompt
36
+ # Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
37
+ set -l fish_function_path
38
+
39
+ # Erase virtualenv's `fish_prompt` and restore the original.
40
+ functions -e fish_prompt
41
+ functions -c _old_fish_prompt fish_prompt
42
+ functions -e _old_fish_prompt
43
+ set -e _OLD_FISH_PROMPT_OVERRIDE
44
+ end
45
+
46
+ set -e VIRTUAL_ENV
47
+ set -e VIRTUAL_ENV_PROMPT
48
+
49
+ if test "$argv[1]" != 'nondestructive'
50
+ # Self-destruct!
51
+ functions -e pydoc
52
+ functions -e deactivate
53
+ functions -e _bashify_path
54
+ functions -e _fishify_path
55
+ end
56
+ end
57
+
58
+ # Unset irrelevant variables.
59
+ deactivate nondestructive
60
+
61
+ set -gx VIRTUAL_ENV '/workspace/axolotl/axol'
62
+
63
+ # https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
64
+ if test (echo $FISH_VERSION | head -c 1) -lt 3
65
+ set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH)
66
+ else
67
+ set -gx _OLD_VIRTUAL_PATH $PATH
68
+ end
69
+ set -gx PATH "$VIRTUAL_ENV"'/bin' $PATH
70
+
71
+ # Prompt override provided?
72
+ # If not, just use the environment name.
73
+ if test -n ''
74
+ set -gx VIRTUAL_ENV_PROMPT ''
75
+ else
76
+ set -gx VIRTUAL_ENV_PROMPT (basename "$VIRTUAL_ENV")
77
+ end
78
+
79
+ # Unset `$PYTHONHOME` if set.
80
+ if set -q PYTHONHOME
81
+ set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
82
+ set -e PYTHONHOME
83
+ end
84
+
85
+ function pydoc
86
+ python -m pydoc $argv
87
+ end
88
+
89
+ if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
90
+ # Copy the current `fish_prompt` function as `_old_fish_prompt`.
91
+ functions -c fish_prompt _old_fish_prompt
92
+
93
+ function fish_prompt
94
+ # Run the user's prompt first; it might depend on (pipe)status.
95
+ set -l prompt (_old_fish_prompt)
96
+
97
+ printf '(%s) ' $VIRTUAL_ENV_PROMPT
98
+
99
+ string join -- \n $prompt # handle multi-line prompts
100
+ end
101
+
102
+ set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
103
+ end
axol/bin/activate.nu ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # virtualenv activation module
2
+ # Activate with `overlay use activate.nu`
3
+ # Deactivate with `deactivate`, as usual
4
+ #
5
+ # To customize the overlay name, you can call `overlay use activate.nu as foo`,
6
+ # but then simply `deactivate` won't work because it is just an alias to hide
7
+ # the "activate" overlay. You'd need to call `overlay hide foo` manually.
8
+
9
+ export-env {
10
+ def is-string [x] {
11
+ ($x | describe) == 'string'
12
+ }
13
+
14
+ def has-env [...names] {
15
+ $names | each {|n|
16
+ $n in $env
17
+ } | all {|i| $i == true}
18
+ }
19
+
20
+ # Emulates a `test -z`, but btter as it handles e.g 'false'
21
+ def is-env-true [name: string] {
22
+ if (has-env $name) {
23
+ # Try to parse 'true', '0', '1', and fail if not convertible
24
+ let parsed = (do -i { $env | get $name | into bool })
25
+ if ($parsed | describe) == 'bool' {
26
+ $parsed
27
+ } else {
28
+ not ($env | get -i $name | is-empty)
29
+ }
30
+ } else {
31
+ false
32
+ }
33
+ }
34
+
35
+ let virtual_env = '/workspace/axolotl/axol'
36
+ let bin = 'bin'
37
+
38
+ let is_windows = ($nu.os-info.family) == 'windows'
39
+ let path_name = (if (has-env 'Path') {
40
+ 'Path'
41
+ } else {
42
+ 'PATH'
43
+ }
44
+ )
45
+
46
+ let venv_path = ([$virtual_env $bin] | path join)
47
+ let new_path = ($env | get $path_name | prepend $venv_path)
48
+
49
+ # If there is no default prompt, then use the env name instead
50
+ let virtual_env_prompt = (if ('' | is-empty) {
51
+ ($virtual_env | path basename)
52
+ } else {
53
+ ''
54
+ })
55
+
56
+ let new_env = {
57
+ $path_name : $new_path
58
+ VIRTUAL_ENV : $virtual_env
59
+ VIRTUAL_ENV_PROMPT : $virtual_env_prompt
60
+ }
61
+
62
+ let new_env = (if (is-env-true 'VIRTUAL_ENV_DISABLE_PROMPT') {
63
+ $new_env
64
+ } else {
65
+ # Creating the new prompt for the session
66
+ let virtual_prefix = $'(char lparen)($virtual_env_prompt)(char rparen) '
67
+
68
+ # Back up the old prompt builder
69
+ let old_prompt_command = (if (has-env 'PROMPT_COMMAND') {
70
+ $env.PROMPT_COMMAND
71
+ } else {
72
+ ''
73
+ })
74
+
75
+ let new_prompt = (if (has-env 'PROMPT_COMMAND') {
76
+ if 'closure' in ($old_prompt_command | describe) {
77
+ {|| $'($virtual_prefix)(do $old_prompt_command)' }
78
+ } else {
79
+ {|| $'($virtual_prefix)($old_prompt_command)' }
80
+ }
81
+ } else {
82
+ {|| $'($virtual_prefix)' }
83
+ })
84
+
85
+ $new_env | merge {
86
+ PROMPT_COMMAND : $new_prompt
87
+ VIRTUAL_PREFIX : $virtual_prefix
88
+ }
89
+ })
90
+
91
+ # Environment variables that will be loaded as the virtual env
92
+ load-env $new_env
93
+ }
94
+
95
+ export alias pydoc = python -m pydoc
96
+ export alias deactivate = overlay hide activate
axol/bin/activate.ps1 ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $script:THIS_PATH = $myinvocation.mycommand.path
2
+ $script:BASE_DIR = Split-Path (Resolve-Path "$THIS_PATH/..") -Parent
3
+
4
+ function global:deactivate([switch] $NonDestructive) {
5
+ if (Test-Path variable:_OLD_VIRTUAL_PATH) {
6
+ $env:PATH = $variable:_OLD_VIRTUAL_PATH
7
+ Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global
8
+ }
9
+
10
+ if (Test-Path function:_old_virtual_prompt) {
11
+ $function:prompt = $function:_old_virtual_prompt
12
+ Remove-Item function:\_old_virtual_prompt
13
+ }
14
+
15
+ if ($env:VIRTUAL_ENV) {
16
+ Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue
17
+ }
18
+
19
+ if ($env:VIRTUAL_ENV_PROMPT) {
20
+ Remove-Item env:VIRTUAL_ENV_PROMPT -ErrorAction SilentlyContinue
21
+ }
22
+
23
+ if (!$NonDestructive) {
24
+ # Self destruct!
25
+ Remove-Item function:deactivate
26
+ Remove-Item function:pydoc
27
+ }
28
+ }
29
+
30
+ function global:pydoc {
31
+ python -m pydoc $args
32
+ }
33
+
34
+ # unset irrelevant variables
35
+ deactivate -nondestructive
36
+
37
+ $VIRTUAL_ENV = $BASE_DIR
38
+ $env:VIRTUAL_ENV = $VIRTUAL_ENV
39
+
40
+ if ("" -ne "") {
41
+ $env:VIRTUAL_ENV_PROMPT = ""
42
+ }
43
+ else {
44
+ $env:VIRTUAL_ENV_PROMPT = $( Split-Path $env:VIRTUAL_ENV -Leaf )
45
+ }
46
+
47
+ New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH
48
+
49
+ $env:PATH = "$env:VIRTUAL_ENV/bin:" + $env:PATH
50
+ if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) {
51
+ function global:_old_virtual_prompt {
52
+ ""
53
+ }
54
+ $function:_old_virtual_prompt = $function:prompt
55
+
56
+ function global:prompt {
57
+ # Add the custom prefix to the existing prompt
58
+ $previous_prompt_value = & $function:_old_virtual_prompt
59
+ ("(" + $env:VIRTUAL_ENV_PROMPT + ") " + $previous_prompt_value)
60
+ }
61
+ }
axol/bin/activate_this.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Activate virtualenv for current interpreter:
3
+
4
+ Use exec(open(this_file).read(), {'__file__': this_file}).
5
+
6
+ This can be used when you must use an existing Python interpreter, not the virtualenv bin/python.
7
+ """ # noqa: D415
8
+
9
+ from __future__ import annotations
10
+
11
+ import os
12
+ import site
13
+ import sys
14
+
15
+ try:
16
+ abs_file = os.path.abspath(__file__)
17
+ except NameError as exc:
18
+ msg = "You must use exec(open(this_file).read(), {'__file__': this_file})"
19
+ raise AssertionError(msg) from exc
20
+
21
+ bin_dir = os.path.dirname(abs_file)
22
+ base = bin_dir[: -len("bin") - 1] # strip away the bin part from the __file__, plus the path separator
23
+
24
+ # prepend bin to PATH (this file is inside the bin directory)
25
+ os.environ["PATH"] = os.pathsep.join([bin_dir, *os.environ.get("PATH", "").split(os.pathsep)])
26
+ os.environ["VIRTUAL_ENV"] = base # virtual env is right above bin directory
27
+ os.environ["VIRTUAL_ENV_PROMPT"] = "" or os.path.basename(base) # noqa: SIM222
28
+
29
+ # add the virtual environments libraries to the host python import mechanism
30
+ prev_length = len(sys.path)
31
+ for lib in "../lib/python3.10/site-packages".split(os.pathsep):
32
+ path = os.path.realpath(os.path.join(bin_dir, lib))
33
+ site.addsitedir(path.decode("utf-8") if "" else path)
34
+ sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]
35
+
36
+ sys.real_prefix = sys.prefix
37
+ sys.prefix = base
axol/bin/pip ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/workspace/axolotl/axol/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
axol/bin/pip-3.10 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/workspace/axolotl/axol/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
axol/bin/pip3 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/workspace/axolotl/axol/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
axol/bin/pip3.10 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/workspace/axolotl/axol/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
axol/bin/python ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c37ac6a3327a3ef707c6e7df9888ed0b6713ccf4c1af3a7088aedbf87132d08a
3
+ size 17215080
axol/bin/python3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c37ac6a3327a3ef707c6e7df9888ed0b6713ccf4c1af3a7088aedbf87132d08a
3
+ size 17215080
axol/bin/python3.10 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c37ac6a3327a3ef707c6e7df9888ed0b6713ccf4c1af3a7088aedbf87132d08a
3
+ size 17215080
axol/bin/wheel ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/workspace/axolotl/axol/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from wheel.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
axol/bin/wheel-3.10 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/workspace/axolotl/axol/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from wheel.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
axol/bin/wheel3 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/workspace/axolotl/axol/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from wheel.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
axol/bin/wheel3.10 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/workspace/axolotl/axol/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from wheel.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
axol/pyvenv.cfg ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ home = /opt/conda/envs/axol/bin
2
+ implementation = CPython
3
+ version_info = 3.10.14.final.0
4
+ virtualenv = 20.25.1
5
+ include-system-site-packages = false
6
+ base-prefix = /opt/conda/envs/axol
7
+ base-exec-prefix = /opt/conda/envs/axol
8
+ base-executable = /opt/conda/envs/axol/bin/python3.10