qinfeng722 commited on
Commit
d0b8972
·
verified ·
1 Parent(s): 0f3bd7b

Upload 17 files

Browse files
Files changed (17) hide show
  1. .dockerignore +17 -0
  2. .flake8 +17 -0
  3. .gitignore +164 -0
  4. CODE_OF_CONDUCT.md +133 -0
  5. CONTRIBUTING.md +67 -0
  6. Dockerfile +92 -0
  7. LICENSE +191 -0
  8. Makefile +279 -0
  9. Pipfile +75 -0
  10. Pipfile.lock +0 -0
  11. README.md +303 -10
  12. about.md +5 -0
  13. app.toml.template +43 -0
  14. distributed_train.sh +4 -0
  15. entrypoint.sh +8 -0
  16. pyproject.toml +24 -0
  17. requirements.txt +187 -0
.dockerignore ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .git
2
+ .github
3
+ .mypy_cache
4
+ .neptune
5
+ bundles
6
+ wandb
7
+ .pytest_cache
8
+ data
9
+ documentation
10
+ jenkins
11
+ notebooks
12
+ output
13
+ reports
14
+ tests
15
+ .coverage
16
+ *.log
17
+ *.ipynb
.flake8 ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [flake8]
2
+ exclude=.cache, .local, server.wave, output, data, reports
3
+ max-line-length = 88
4
+ # E203, W503 - black-compatible config
5
+ extend-ignore = E203, W503
6
+ # E501 line too long (text for testing)
7
+ per-file-ignores =
8
+ */__init__.py: F401
9
+ train.py: E402
10
+ prompt.py: E402
11
+ train_wave.py: E402, I001, I003
12
+ app.py: E402
13
+ publish_to_hugging_face.py: E402
14
+ tests/src/datasets/test_text_dpo_modeling_ds.py: E501
15
+ tests/src/models/test_dpo_modeling_model.py: E501
16
+
17
+ inline-quotes = "
.gitignore ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Folder
2
+ bundles/
3
+ input/
4
+ notebooks/
5
+ demo_data/
6
+ output*/
7
+ tmp/
8
+ data/
9
+ examples/data_oasst2
10
+ examples/output_oasst2
11
+ data_old/
12
+ tests_tmp/
13
+ subs/
14
+ /datasets/
15
+ .idea/
16
+ .local/
17
+
18
+ output
19
+
20
+ # Byte-compiled / optimized / DLL files
21
+ __pycache__/
22
+ *.py[cod]
23
+ *$py.class
24
+
25
+ .neptune/
26
+ wandb/
27
+ .vscode/
28
+
29
+ # C extensions
30
+ *.so
31
+ *.c
32
+
33
+ # Distribution / packaging
34
+ .Python
35
+ build/
36
+ develop-eggs/
37
+ downloads/
38
+ eggs/
39
+ .eggs/
40
+ lib/
41
+ lib64/
42
+ parts/
43
+ sdist/
44
+ var/
45
+ wheels/
46
+ pip-wheel-metadata/
47
+ share/python-wheels/
48
+ *.egg-info/
49
+ .installed.cfg
50
+ *.egg
51
+ MANIFEST
52
+
53
+ # PyInstaller
54
+ # Usually these files are written by a python script from a template
55
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
56
+ *.manifest
57
+ *.spec
58
+
59
+ # Installer logs
60
+ pip-log.txt
61
+ pip-delete-this-directory.txt
62
+
63
+ # Unit test / coverage reports
64
+ htmlcov/
65
+ .tox/
66
+ .nox/
67
+ .coverage
68
+ .coverage.*
69
+ .cache
70
+ nosetests.xml
71
+ coverage.xml
72
+ *.cover
73
+ *.py,cover
74
+ .hypothesis/
75
+ .pytest_cache/
76
+ reports/
77
+
78
+ # Translations
79
+ *.mo
80
+ *.pot
81
+
82
+ # Django stuff:
83
+ *.log
84
+ local_settings.py
85
+ db.sqlite3
86
+ db.sqlite3-journal
87
+
88
+ # Flask stuff:
89
+ instance/
90
+ .webassets-cache
91
+
92
+ # Scrapy stuff:
93
+ .scrapy
94
+
95
+ # Documentation
96
+ node_modules
97
+ tmp
98
+ .docusaurus
99
+ .cach-loader
100
+
101
+ # PyBuilder
102
+ target/
103
+
104
+ # Jupyter Notebook
105
+ .ipynb_checkpoints
106
+ *.ipynb
107
+
108
+ # IPython
109
+ profile_default/
110
+ ipython_config.py
111
+
112
+ # pyenv
113
+ .python-version
114
+
115
+ # pipenv
116
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
117
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
118
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
119
+ # install all needed dependencies.
120
+ #Pipfile.lock
121
+
122
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
123
+ __pypackages__/
124
+
125
+ # Celery stuff
126
+ celerybeat-schedule
127
+ celerybeat.pid
128
+
129
+ # SageMath parsed files
130
+ *.sage.py
131
+
132
+ # Environments
133
+ .env
134
+ .venv
135
+ env/
136
+ venv/
137
+ ENV/
138
+ env.bak/
139
+ venv.bak/
140
+
141
+ # Spyder project settings
142
+ .spyderproject
143
+ .spyproject
144
+
145
+ # Rope project settings
146
+ .ropeproject
147
+
148
+
149
+
150
+ # mypy
151
+ .mypy_cache/
152
+ .dmypy.json
153
+ dmypy.json
154
+
155
+ # Pyre type checker
156
+ .pyre/
157
+ h2o_wave.state
158
+ .DS_Store
159
+
160
+ # IDE
161
+ .vscode
162
+
163
+ # playwright
164
+ test-results/
CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, caste, color, religion, or sexual identity
11
+ and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the
27
+ overall community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or
32
+ advances of any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ this repository.
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][v2.0].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
127
+ at [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
CONTRIBUTING.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to H2O LLM STUDIO
2
+
3
+ H2O LLM Studio is an open source project released under the Apache Software Licence v2. Open Source projects live by
4
+ their user and developer communities. We welcome and encourage your contributions of any kind!
5
+
6
+ ## Bug Reports and Feature Requests
7
+
8
+ Found a bug or have an idea for a new feature? Your feedback is invaluable! To ensure a smooth and collaborative
9
+ process, please follow these steps:
10
+
11
+ 1. Provide the full error message and stack trace, if applicable.
12
+ 2. Attach the model configuration yaml file if the error is related to model training.
13
+ 3. Specify the commit hash of the version you are using (running `git rev-parse HEAD`) in your report. If you are
14
+ pasting the UI error message, the commit hash will also be included in the error message.
15
+ 4. If the error is reproducible, kindly include the steps to reproduce it.
16
+ 5. If possible, attempt to reproduce the error using the default dataset.
17
+ 6. Please mention any other details that might be useful, e.g. if you are using LLM Studio in a Docker container, etc.
18
+
19
+ ## Pull Requests
20
+
21
+ You can contribute to the project by fixing bugs, adding new features, refactoring code, or enhancing documentation.
22
+ To ensure a smooth and collaborative process for everyone, please follow these guidelines:
23
+
24
+ 1. Check if the issue you plan to address is already [reported](https://github.com/h2oai/h2o-llmstudio/issues). If not,
25
+ please open a new issue
26
+ to discuss your proposed changes.
27
+ 2. Avoid duplicating work by commenting on the issue you're working on and feel free to seek assistance or ask
28
+ questions; our team is happy to help.
29
+ 3. Fork the repository and create a new branch from `main`. To develop, please follow the setup instructions below.
30
+ 4. Implement your changes and commit them to your branch.
31
+ 5. When you feel ready, open a pull request with your changes. You can also open the PR as a draft to receive early
32
+ feedback. To facilitate the review process, we have provided a PR checklist below.
33
+ 6. Our team will review your pull request and provide feedback. Once everything looks good, we will proceed to merge
34
+ your contribution.
35
+
36
+ ## Setting up your development environment
37
+
38
+ Follow the instructions in [README](https://github.com/h2oai/h2o-llmstudio/blob/main/README.md) to set up your
39
+ environment. Run `make setup-dev` instead of `make setup` to install the development dependencies.
40
+
41
+ ## Running linters and tests
42
+
43
+ Before submitting your pull request, ensure that your code passes the linters and tests.
44
+ To format your code, run `make format`. You can check for any style issues by running `make style`. To run the tests,
45
+ run `make test`.
46
+
47
+ ## PR checklist
48
+
49
+ Please make sure your pull request fulfills the following checklist:
50
+
51
+ ☐ The PR title should provide a clear summary of your contribution.
52
+ ☐ Link the related issue (e.g., closes #123) in your PR description.
53
+ ☐ If your contribution is still a work in progress, change the PR to draft mode.
54
+ ☐ Ensure that the existing tests pass by running `make test`.
55
+ ☐ Make sure `make style` passes to maintain consistent code style.
56
+
57
+ ## Installing custom packages
58
+
59
+ If you need to install additional Python packages into the environment, you can do so using pip after activating your virtual environment via ```make shell```. For example, to install flash-attention, you would use the following commands:
60
+
61
+ ```bash
62
+ make shell
63
+ pip install flash-attn --no-build-isolation
64
+ pip install git+https://github.com/HazyResearch/flash-attention.git#subdirectory=csrc/rotary
65
+ ```
66
+
67
+ For a PR, update the Pipfile and the Pipfile.lock via ```pipenv install package_name```.
Dockerfile ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.1.0-devel-ubuntu22.04
2
+
3
+ ARG DEBIAN_FRONTEND=noninteractive
4
+
5
+ # git is needed for flash-attention
6
+ # curl is needed to download get-pip.py
7
+ # software-properties-common is needed for add-apt-repository
8
+ # We get python 3.10 from the deadsnakes PPA to have the latest version
9
+ # We install pip from the get-pip.py script to have the latest version
10
+ RUN apt-get update \
11
+ && apt-get upgrade -y \
12
+ && apt-get install -y \
13
+ git \
14
+ curl \
15
+ software-properties-common \
16
+ && add-apt-repository ppa:deadsnakes/ppa \
17
+ && apt-get update \
18
+ && apt install -y \
19
+ python3.10 \
20
+ python3.10-distutils \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ # Pick an unusual UID for the llmstudio user.
24
+ # In particular, don't pick 1000, which is the default ubuntu user number.
25
+ # Force ourselves to test with UID mismatches in the common case.
26
+ RUN adduser --uid 1999 llmstudio
27
+ USER llmstudio
28
+ ENV HOME=/home/llmstudio
29
+
30
+ # Static application code lives in /workspace/
31
+ WORKDIR /workspace
32
+
33
+ ENV PATH=/home/llmstudio/.local/bin:$PATH
34
+ RUN \
35
+ curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 && \
36
+ chmod -R a+w /home/llmstudio
37
+ COPY Makefile Pipfile Pipfile.lock /workspace/
38
+
39
+ # Python virtualenv is installed in /workspace/.venv/
40
+ # give read and write permissions to the /workspace/.venv/ directory for all users to allow wave to write files
41
+ ENV PIPENV_VENV_IN_PROJECT=1
42
+ RUN make setup && chmod -R 777 /workspace/.venv
43
+
44
+ # Add the venv to the PATH
45
+ ENV PATH=/workspace/.venv/bin:$PATH
46
+
47
+ # We need to create a mount point for the user to mount their volume
48
+ # All persistent data lives in /home/llmstudio/mount
49
+ RUN mkdir -p /home/llmstudio/mount
50
+ ENV H2O_LLM_STUDIO_WORKDIR=/home/llmstudio/mount
51
+
52
+ # Download the demo datasets and place in the /workspace/demo directory
53
+ # Set the environment variable for the demo datasets
54
+ ENV H2O_LLM_STUDIO_DEMO_DATASETS=/workspace/demo
55
+ COPY llm_studio/download_default_datasets.py /workspace/
56
+ RUN python download_default_datasets.py
57
+
58
+ COPY . /workspace
59
+
60
+ # Remove unnecessary packages remove build packages again
61
+ # Prevent removal of cuda packages
62
+ USER root
63
+ RUN apt-get purge -y git curl python3.10-distutils software-properties-common \
64
+ && apt-get autoremove -y \
65
+ && rm -rf /var/lib/apt/lists/*
66
+
67
+ USER llmstudio
68
+
69
+ ENV HF_HUB_DISABLE_TELEMETRY=1
70
+ ENV DO_NOT_TRACK=1
71
+
72
+ # Set the environment variables for the wave server
73
+ ENV H2O_WAVE_APP_ADDRESS=http://127.0.0.1:8756
74
+ ENV H2O_WAVE_MAX_REQUEST_SIZE=25MB
75
+ ENV H2O_WAVE_NO_LOG=true
76
+ ENV H2O_WAVE_PRIVATE_DIR="/download/@/home/llmstudio/mount/output/download"
77
+
78
+ USER root
79
+
80
+ # Make all of the files in the llmstudio directory read & writable for all users so that the
81
+ # application can install other (non-persisted) new packages and other things
82
+ # if it wants to. e.g. triton uses /home/llmstudio/.triton as a cache directory.
83
+ RUN chmod -R 777 /home/llmstudio
84
+
85
+ # Make the entrypoint.sh script executable by all users
86
+ RUN chmod 755 /workspace/entrypoint.sh
87
+
88
+ USER llmstudio
89
+
90
+ EXPOSE 10101
91
+
92
+ ENTRYPOINT [ "/workspace/entrypoint.sh" ]
LICENSE ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ Copyright 2023 H2O.ai, Inc.
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this repository except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
Makefile ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SHELL := /bin/bash
2
+
3
+ PYTHON_VERSION ?= 3.10
4
+ PYTHON ?= python$(PYTHON_VERSION)
5
+ PIP ?= $(PYTHON) -m pip
6
+ PIPENV ?= $(PYTHON) -m pipenv
7
+ PIPENV_PYTHON = $(PIPENV) run python
8
+ PIPENV_PIP = $(PIPENV_PYTHON) -m pip
9
+ PWD = $(shell pwd)
10
+ DOCKER_IMAGE ?= gcr.io/vorvan/h2oai/h2o-llmstudio:nightly
11
+ APP_VERSION=$(shell sed -n 's/^version = //p' pyproject.toml | tr -d '"')
12
+
13
+ ifeq ($(origin H2O_LLM_STUDIO_WORKDIR), environment)
14
+ WORKDIR := $(H2O_LLM_STUDIO_WORKDIR)
15
+ else
16
+ WORKDIR := $(shell pwd)
17
+ endif
18
+
19
+ ifeq ($(LOG_LEVEL), $(filter $(LOG_LEVEL), debug trace))
20
+ PW_DEBUG = DEBUG=pw:api
21
+ else
22
+ PW_DEBUG =
23
+ endif
24
+
25
+ .PHONY: pipenv
26
+ pipenv:
27
+ $(PIP) install pip==24.2
28
+ $(PIP) install pipenv==2024.0.1
29
+
30
+ .PHONY: setup
31
+ setup: pipenv
32
+ $(PIPENV) install --verbose --python $(PYTHON_VERSION)
33
+ -$(PIPENV_PIP) install flash-attn==2.6.1 --no-build-isolation --upgrade --no-cache-dir
34
+
35
+ .PHONY: setup-dev
36
+ setup-dev: pipenv
37
+ $(PIPENV) install --verbose --dev --python $(PYTHON_VERSION)
38
+ -$(PIPENV_PIP) install flash-attn==2.6.1 --no-build-isolation --upgrade --no-cache-dir
39
+ $(PIPENV) run playwright install
40
+
41
+ .PHONY: setup-no-flash
42
+ setup-no-flash: pipenv
43
+ $(PIPENV) install --verbose --python $(PYTHON_VERSION)
44
+
45
+ .PHONY: setup-conda-nightly
46
+ setup-conda:
47
+ @bash -c '\
48
+ set -e; \
49
+ source $$(conda info --base)/etc/profile.d/conda.sh; \
50
+ conda deactivate; \
51
+ conda create -n llmstudio python=3.10 -y; \
52
+ conda activate llmstudio; \
53
+ conda install -c nvidia/label/cuda-12.4.0 cuda-toolkit -y; \
54
+ conda install pytorch pytorch-cuda=12.4 -c pytorch-nightly -c nvidia -y; \
55
+ grep -v "nvidia" requirements.txt | grep -v "torch" | python -m pip install -r /dev/stdin; \
56
+ python -m pip install flash-attn==2.6.1 --no-build-isolation --upgrade --no-cache-dir; \
57
+ '
58
+
59
+ .PHONY: setup-ui
60
+ setup-ui: pipenv
61
+ $(PIPENV) install --verbose --categories=dev-packages --python $(PYTHON_VERSION)
62
+ $(PIPENV) run playwright install
63
+
64
+ .PHONY: export-requirements
65
+ export-requirements: pipenv
66
+ $(PIPENV) requirements > requirements.txt
67
+
68
+ clean-env:
69
+ $(PIPENV) --rm
70
+
71
+ clean-data:
72
+ rm -rf data
73
+
74
+ clean-output:
75
+ rm -rf output
76
+
77
+ reports:
78
+ mkdir -p reports
79
+
80
+ .PHONY: style
81
+ style: reports pipenv
82
+ @echo -n > reports/flake8_errors.log
83
+ @echo -n > reports/mypy_errors.log
84
+ @echo -n > reports/mypy.log
85
+ @echo
86
+
87
+ -$(PIPENV) run flake8 | tee -a reports/flake8_errors.log
88
+ @if [ -s reports/flake8_errors.log ]; then exit 1; fi
89
+
90
+ -$(PIPENV) run mypy . --check-untyped-defs | tee -a reports/mypy.log
91
+ @if ! grep -Eq "Success: no issues found in [0-9]+ source files" reports/mypy.log ; then exit 1; fi
92
+
93
+ .PHONY: format
94
+ format: pipenv
95
+ $(PIPENV) run isort .
96
+ $(PIPENV) run black .
97
+
98
+ .PHONY: isort
99
+ isort: pipenv
100
+ $(PIPENV) run isort .
101
+
102
+ .PHONY: black
103
+ black: pipenv
104
+ $(PIPENV) run black .
105
+
106
+ .PHONY: test
107
+ test: reports
108
+ @bash -c 'set -o pipefail; export PYTHONPATH=$(PWD); \
109
+ $(PIPENV) run pytest -v --junitxml=reports/junit.xml \
110
+ --import-mode importlib \
111
+ --html=./reports/pytest.html \
112
+ --cov=llm_studio \
113
+ --cov-report term \
114
+ --cov-report html:./reports/coverage.html \
115
+ -o log_cli=true -o log_level=INFO -o log_file=reports/tests.log \
116
+ tests/* 2>&1 | tee reports/tests.log'
117
+
118
+ # Use to quickly run a single test (e.g. make test-debug test=test_encode)
119
+ .PHONY: test-debug
120
+ test-debug: reports
121
+ @bash -c 'set -o pipefail; export PYTHONPATH=$(PWD); \
122
+ $(PIPENV) run pytest -v --junitxml=reports/junit.xml \
123
+ --import-mode importlib \
124
+ --html=./reports/pytest.html \
125
+ -k $(test) \
126
+ -s \
127
+ -o log_cli=false -o log_level=WARNING -o log_file=/dev/null \
128
+ tests/*'
129
+
130
+ # Only run the unit-tests (src)
131
+ .PHONY: test-unit
132
+ test-unit: reports
133
+ @bash -c 'set -o pipefail; export PYTHONPATH=$(PWD); \
134
+ $(PIPENV) run pytest -v --junitxml=reports/junit.xml \
135
+ --import-mode importlib \
136
+ --html=./reports/pytest.html \
137
+ -k src \
138
+ --cov=llm_studio/src \
139
+ --cov-report term \
140
+ --cov-report html:./reports/coverage.html \
141
+ -o log_cli=true -o log_level=INFO -o log_file=reports/tests.log \
142
+ tests/* 2>&1 | tee reports/tests.log'
143
+
144
+ .PHONY: test-ui
145
+ test-ui: reports setup-ui
146
+ @bash -c 'set -o pipefail; \
147
+ $(PW_DEBUG) $(PIPENV) run pytest \
148
+ -v \
149
+ --junitxml=reports/junit_ui.xml \
150
+ --html=./reports/pytest_ui.html \
151
+ -o log_cli=true \
152
+ -o log_level=$(LOG_LEVEL) \
153
+ -o log_file=reports/tests_ui.log \
154
+ tests/ui/test.py 2>&1 | tee reports/tests_ui.log'
155
+
156
+ .PHONY: test-ui-headed
157
+ test-ui-headed: setup-ui
158
+ $(PW_DEBUG) $(PIPENV) run pytest \
159
+ -vvs \
160
+ -s \
161
+ --headed \
162
+ --video=on \
163
+ --screenshot=on \
164
+ --slowmo=1000 \
165
+ tests/ui/test.py 2>&1 | tee reports/tests.log
166
+
167
+ .PHONY: test-ui-github-actions # Run UI tests in GitHub Actions. Starts the Wave server and runs the tests locally.
168
+ test-ui-github-actions: reports setup-ui
169
+ @echo "Starting the server..."
170
+ make llmstudio &
171
+ @echo "Server started in background."
172
+ @echo "Waiting 10s for the server to start..."
173
+ sleep 10
174
+ @echo "Running the tests..."
175
+ LOCAL_LOGIN=True \
176
+ PYTEST_BASE_URL=localhost:10101 \
177
+ make test-ui
178
+ @echo "Stopping the server..."
179
+ make stop-llmstudio
180
+ @echo "Server stopped."
181
+
182
+ .PHONY: wave
183
+ wave:
184
+ HF_HUB_DISABLE_TELEMETRY=1 \
185
+ H2O_WAVE_APP_ACCESS_KEY_ID=dev \
186
+ H2O_WAVE_APP_ACCESS_KEY_SECRET=dev \
187
+ H2O_WAVE_MAX_REQUEST_SIZE=25MB \
188
+ H2O_WAVE_NO_LOG=true \
189
+ H2O_WAVE_PRIVATE_DIR="/download/@$(WORKDIR)/output/download" \
190
+ $(PIPENV) run wave run llm_studio.app
191
+
192
+ .PHONY: llmstudio
193
+ llmstudio:
194
+ nvidia-smi && \
195
+ HF_HUB_DISABLE_TELEMETRY=1 \
196
+ H2O_WAVE_MAX_REQUEST_SIZE=25MB \
197
+ H2O_WAVE_NO_LOG=true \
198
+ H2O_WAVE_PRIVATE_DIR="/download/@$(WORKDIR)/output/download" \
199
+ $(PIPENV) run wave run --no-reload llm_studio.app
200
+
201
+ .PHONY: llmstudio-conda
202
+ llmstudio-conda:
203
+ CONDA_ACTIVATE="source $$(conda info --base)/etc/profile.d/conda.sh ; conda activate llmstudio" && \
204
+ bash -c "$$CONDA_ACTIVATE && \
205
+ nvidia-smi && \
206
+ HF_HUB_DISABLE_TELEMETRY=1 \
207
+ H2O_WAVE_MAX_REQUEST_SIZE=25MB \
208
+ H2O_WAVE_NO_LOG=true \
209
+ H2O_WAVE_PRIVATE_DIR="/download/@$(WORKDIR)/output/download" \
210
+ wave run --no-reload llm_studio.app"
211
+
212
+ .PHONY: stop-llmstudio
213
+ stop-llmstudio:
214
+ @kill $$(lsof -ti :10101)
215
+
216
+ .PHONY: docker-build-nightly
217
+ docker-build-nightly:
218
+ docker build -t $(DOCKER_IMAGE) .
219
+
220
+ # Run the Docker container with the nightly image
221
+ # Uses the local `llmstudio_mnt` directory as the mount point for the container
222
+ .PHONY: docker-run-nightly
223
+ docker-run-nightly:
224
+ ifeq (,$(wildcard ./llmstudio_mnt))
225
+ mkdir llmstudio_mnt
226
+ endif
227
+ docker run \
228
+ --runtime=nvidia \
229
+ --shm-size=64g \
230
+ --init \
231
+ --rm \
232
+ -it \
233
+ -u `id -u`:`id -g` \
234
+ -p 10101:10101 \
235
+ -v `pwd`/llmstudio_mnt:/home/llmstudio/mount \
236
+ $(DOCKER_IMAGE)
237
+
238
+ # Perform a local Trivy scan for CVEs
239
+ # Get Trivy from https://aquasecurity.github.io/trivy/v0.53/getting-started/installation/
240
+ .PHONY: trivy-local
241
+ trivy-local: docker-build-nightly
242
+ trivy image --scanners vuln --severity CRITICAL,HIGH --timeout 60m $(DOCKER_IMAGE)
243
+
244
+ .PHONY: docker-clean-all
245
+ docker-clean-all:
246
+ @CONTAINERS=$$(docker ps -a -q --filter ancestor=$(DOCKER_IMAGE)); \
247
+ if [ -n "$$CONTAINERS" ]; then \
248
+ docker stop $$CONTAINERS; \
249
+ docker rm $$CONTAINERS; \
250
+ fi
251
+ docker rmi $(DOCKER_IMAGE)
252
+
253
+ .PHONY: bundles
254
+ bundles:
255
+ rm -f -r bundles
256
+ mkdir -p bundles
257
+ cp -r static about.md bundles/
258
+ sed 's/{{VERSION}}/${APP_VERSION}/g' app.toml.template > bundles/app.toml
259
+ cd bundles && zip -r ai.h2o.llmstudio.${APP_VERSION}.wave *
260
+
261
+ .PHONY: shell
262
+ shell:
263
+ $(PIPENV) shell
264
+
265
+ setup-doc: # Install documentation dependencies
266
+ cd documentation && npm install
267
+
268
+ run-doc: # Run the doc locally
269
+ cd documentation && npm start
270
+
271
+ update-documentation-infrastructure:
272
+ cd documentation && npm update @h2oai/makersaurus
273
+ cd documentation && npm ls
274
+
275
+ build-doc-locally: # Bundles your website into static files for production
276
+ cd documentation && npm run build
277
+
278
+ serve-doc-locally: # Serves the built website locally
279
+ cd documentation && npm run serve
Pipfile ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [[source]]
2
+ name = "pypi"
3
+ url = "https://pypi.org/simple"
4
+ verify_ssl = true
5
+
6
+ [[source]]
7
+ name = "pytorch"
8
+ url = "https://download.pytorch.org/whl/cu121"
9
+ verify_ssl = false
10
+
11
+ [requires]
12
+ python_version = "3.10"
13
+
14
+ [packages]
15
+ torch = {index = "pytorch", version = "==2.4.0+cu121"}
16
+ tqdm = ">=4.65.0, <5.0.0"
17
+ transformers = "==4.45.0"
18
+ numpy = ">=1.26.0, <2.0.0"
19
+ pandas = ">=2.2.0, <3.0.0"
20
+ scikit-learn = ">=1.5.1, <2.0.0"
21
+ boto3 = ">=1.20.24, <2.0.0"
22
+ SQLAlchemy = ">=2.0.25, <3.0.0"
23
+ dill = ">=0.3.8, <0.4.0"
24
+ pyarrow = ">=14.0.1"
25
+ kaggle = ">=1.6.14, <2.0.0, !=1.6.15"
26
+ coolname = ">=2.2.0, <3.0.0"
27
+ bokeh = ">=3.5.0, <4.0.0"
28
+ beautifulsoup4 = ">=4.11.1, <5.0.0"
29
+ sqlitedict = "==1.7.0"
30
+ sentencepiece = ">=0.1.96, <0.2.0"
31
+ sacrebleu = "==2.0.0"
32
+ toml = ">=0.10.2, <0.11.0"
33
+ pyyaml = ">=6.0.0, <7.0.0"
34
+ protobuf = "==3.20.3"
35
+ fastparquet = ">=2023.7.0"
36
+ gputil = ">=1.4.0, <2.0.0"
37
+ huggingface-hub = "==0.24.6"
38
+ bitsandbytes = "==0.43.3"
39
+ accelerate = "==0.34.2"
40
+ openai = ">=1.12.0, <2.0.0"
41
+ einops = "==0.8.0"
42
+ datasets = ">=2.20.0, <3.0.0"
43
+ neptune = "==1.10.4, <2.0.0"
44
+ wandb = ">=0.17.5, <1.0.0"
45
+ Jinja2 = ">=3.1.3, <4.0.0"
46
+ h2o-drive = ">=3.0.0, <4.0.0"
47
+ h2o-wave = ">=1.4.0, <2.0.0"
48
+ tiktoken = "==0.7.0"
49
+ hf-transfer = "==0.1.8"
50
+ peft = "==0.12.0"
51
+ azure-storage-file-datalake = ">=12.12.0"
52
+ deepspeed = "==0.14.4"
53
+ keyring = ">=25.2.1, <26.0.0"
54
+ pydantic = ">=2.8.2, <3.0.0"
55
+
56
+ [dev-packages]
57
+ black = "==24.4.2"
58
+ coverage = "==7.5.1"
59
+ flake8 = "==7.0.0"
60
+ flake8-black = "==0.3.6"
61
+ flake8-isort = "==6.1.1"
62
+ isort = "==5.13.2"
63
+ mypy = "==1.10.0"
64
+ pytest = "==8.2.0"
65
+ pytest-cov = "==5.0.0"
66
+ pytest-dependency = "==0.6.0"
67
+ pytest-html = ">=4.1.1, <5.0.0"
68
+ types-pyyaml = ">=6.0"
69
+ types-requests = ">=2.31"
70
+ types-toml = ">=0.10"
71
+ wheel = "==0.43.0"
72
+ pytest-bdd = "==7.1.2"
73
+ hac-playwright = { file = "http://h2o-public-test-data.s3.amazonaws.com/e2e-testing/hac_playwright-1.45.0-py3-none-any.whl" }
74
+ pytest-base-url = "==2.1.0"
75
+ pytest-mock = "==3.14.0"
Pipfile.lock ADDED
The diff for this file is too large to render. See raw diff
 
README.md CHANGED
@@ -1,10 +1,303 @@
1
- ---
2
- title: Llm Studio
3
- emoji: ⚡
4
- colorFrom: pink
5
- colorTo: green
6
- sdk: docker
7
- pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p align="center"><img src="llm_studio/app_utils/static/llm-studio-logo-light.png#gh-dark-mode-only"></p>
2
+ <p align="center"><img src="llm_studio/app_utils/static/llm-studio-logo.png#gh-light-mode-only"></p>
3
+
4
+ <h3 align="center">
5
+ <p>Welcome to H2O LLM Studio, a framework and no-code GUI designed for<br />
6
+ fine-tuning state-of-the-art large language models (LLMs).
7
+ </p>
8
+ </h3>
9
+
10
+ <a href="https://user-images.githubusercontent.com/1069138/233859311-32aa1f8c-4d68-47ac-8cd9-9313171ff9f9.png"><img width="50%" alt="home" src="https://user-images.githubusercontent.com/1069138/233859311-32aa1f8c-4d68-47ac-8cd9-9313171ff9f9.png"></a><a href="https://user-images.githubusercontent.com/1069138/233859315-e6928aa7-28d2-420b-8366-bc7323c368ca.png"><img width="50%" alt="logs" src="https://user-images.githubusercontent.com/1069138/233859315-e6928aa7-28d2-420b-8366-bc7323c368ca.png"></a>
11
+
12
+ ## Jump to
13
+
14
+ - [With H2O LLM Studio, you can](#with-h2o-llm-studio-you-can)
15
+ - [Quickstart](#quickstart)
16
+ - [What's New](#whats-new)
17
+ - [Setup](#setup)
18
+ - [Recommended Install](#recommended-install)
19
+ - [Virtual Environments](#virtual-environments)
20
+ - [Run H2O LLM Studio GUI](#run-h2o-llm-studio-gui)
21
+ - [Run H2O LLM Studio GUI using Docker](#run-h2o-llm-studio-gui-using-docker)
22
+ - [Run H2O LLM Studio with command line interface (CLI)](#run-h2o-llm-studio-with-command-line-interface-cli)
23
+ - [Troubleshooting](#troubleshooting)
24
+ - [Data format and example data](#data-format-and-example-data)
25
+ - [Training your model](#training-your-model)
26
+ - [Example: Run on OASST data via CLI](#example-run-on-oasst-data-via-cli)
27
+ - [Model checkpoints](#model-checkpoints)
28
+ - [Documentation](#documentation)
29
+ - [Contributing](#contributing)
30
+ - [License](#license)
31
+
32
+ ## With H2O LLM Studio, you can
33
+
34
+ - easily and effectively fine-tune LLMs **without the need for any coding experience**.
35
+ - use a **graphic user interface (GUI)** specially designed for large language models.
36
+ - finetune any LLM using a large variety of hyperparameters.
37
+ - use recent finetuning techniques such as [Low-Rank Adaptation (LoRA)](https://arxiv.org/abs/2106.09685) and 8-bit model training with a low memory footprint.
38
+ - use Reinforcement Learning (RL) to finetune your model (experimental)
39
+ - use advanced evaluation metrics to judge generated answers by the model.
40
+ - track and compare your model performance visually. In addition, [Neptune](https://neptune.ai/) and [W&B](https://wandb.ai/) integration can be used.
41
+ - chat with your model and get instant feedback on your model performance.
42
+ - easily export your model to the [Hugging Face Hub](https://huggingface.co/) and share it with the community.
43
+
44
+ ## Quickstart
45
+
46
+ For questions, discussing, or just hanging out, come and join our [Discord](https://discord.gg/WKhYMWcVbq)!
47
+
48
+ Use cloud-based runpod.io instance to run the H2O LLM Studio GUI.
49
+
50
+ [![open_in_runpod](https://github.com/user-attachments/assets/0dffd945-0be0-4ef0-85cd-4e6f260d4e6c)](https://www.runpod.io/console/deploy?template=3oh3easrlu)
51
+
52
+ Using CLI for fine-tuning LLMs:
53
+
54
+ [![Kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://www.kaggle.com/code/ilu000/h2o-llm-studio-cli/) [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1soqfJjwDJwjjH-VzZYO_pUeLx5xY4N1K?usp=sharing)
55
+
56
+ ## What's New
57
+
58
+ - [PR 788](https://github.com/h2oai/h2o-llmstudio/pull/788) New problem type for Causal Regression Modeling allows to train single target regression data using LLMs.
59
+ - [PR 747](https://github.com/h2oai/h2o-llmstudio/pull/747) Fully removed RLHF in favor of DPO/IPO/KTO optimization.
60
+ - [PR 741](https://github.com/h2oai/h2o-llmstudio/pull/741) Removing separate max length settings for prompt and answer in favor of a single `max_length` settings better resembling `chat_template` functionality from `transformers`.
61
+ - [PR 592](https://github.com/h2oai/h2o-llmstudio/pull/599) Added `KTOPairLoss` for DPO modeling allowing to train models with simple preference data. Data currently needs to be manually prepared by randomly matching positive and negative examples as pairs.
62
+ - [PR 592](https://github.com/h2oai/h2o-llmstudio/pull/592) Starting to deprecate RLHF in favor of DPO/IPO optimization. Training is disabled, but old experiments are still viewable. RLHF will be fully removed in a future release.
63
+ - [PR 530](https://github.com/h2oai/h2o-llmstudio/pull/530) Introduced a new problem type for DPO/IPO optimization. This optimization technique can be used as an alternative to RLHF.
64
+ - [PR 288](https://github.com/h2oai/h2o-llmstudio/pull/288) Introduced Deepspeed for sharded training allowing to train larger models on machines with multiple GPUs. Requires NVLink. This feature replaces FSDP and offers more flexibility. Deepspeed requires a system installation of cudatoolkit and we recommend using version 12.1. See [Recommended Install](#recommended-install).
65
+ - [PR 449](https://github.com/h2oai/h2o-llmstudio/pull/449) New problem type for Causal Classification Modeling allows to train binary and multiclass models using LLMs.
66
+ - [PR 364](https://github.com/h2oai/h2o-llmstudio/pull/364) User secrets are now handled more securely and flexible. Support for handling secrets using the 'keyring' library was added. User settings are tried to be migrated automatically.
67
+
68
+ Please note that due to current rapid development we cannot guarantee full backwards compatibility of new functionality. We thus recommend to pin the version of the framework to the one you used for your experiments. For resetting, please delete/backup your `data` and `output` folders.
69
+
70
+ ## Setup
71
+
72
+ H2O LLM Studio requires a machine with Ubuntu 16.04+ and at least one recent Nvidia GPU with Nvidia drivers version >= 470.57.02. For larger models, we recommend at least 24GB of GPU memory.
73
+
74
+ For more information about installation prerequisites, see the [Set up H2O LLM Studio](https://docs.h2o.ai/h2o-llmstudio/get-started/set-up-llm-studio#prerequisites) guide in the documentation.
75
+
76
+ For a performance comparison of different GPUs, see the [H2O LLM Studio performance](https://h2oai.github.io/h2o-llmstudio/get-started/llm-studio-performance) guide in the documentation.
77
+
78
+ ### Recommended Install
79
+
80
+ The recommended way to install H2O LLM Studio is using pipenv with Python 3.10. To install Python 3.10 on Ubuntu 16.04+, execute the following commands:
81
+
82
+ #### System installs (Python 3.10)
83
+
84
+ ```bash
85
+ sudo add-apt-repository ppa:deadsnakes/ppa
86
+ sudo apt install python3.10
87
+ sudo apt-get install python3.10-distutils
88
+ curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
89
+ ```
90
+
91
+ #### Installing NVIDIA Drivers (if required)
92
+
93
+ If deploying on a 'bare metal' machine running Ubuntu, one may need to install the required Nvidia drivers and CUDA. The following commands show how to retrieve the latest drivers for a machine running Ubuntu 20.04 as an example. One can update the following based on their OS.
94
+
95
+ ```bash
96
+ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
97
+ sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
98
+ wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda-repo-ubuntu2004-12-1-local_12.1.0-530.30.02-1_amd64.deb
99
+ sudo dpkg -i cuda-repo-ubuntu2004-12-1-local_12.1.0-530.30.02-1_amd64.deb
100
+ sudo cp /var/cuda-repo-ubuntu2004-12-1-local/cuda-*-keyring.gpg /usr/share/keyrings/
101
+ sudo apt-get update
102
+ sudo apt-get -y install cuda
103
+ ```
104
+
105
+ alternatively, one can install cudatoolkits in a conda environment:
106
+
107
+ ```bash
108
+ conda create -n llmstudio python=3.10
109
+ conda activate llmstudio
110
+ conda install -c "nvidia/label/cuda-12.1.0" cuda-toolkit
111
+ ```
112
+
113
+ ### Virtual environments
114
+
115
+ We offer various ways of setting up the necessary python environment.
116
+
117
+ #### Pipenv virtual environment
118
+
119
+ The following command will create a virtual environment using pipenv and will install the dependencies using pipenv:
120
+
121
+ ```bash
122
+ make setup
123
+ ```
124
+
125
+ If you are having troubles installing the flash_attn package, consider running
126
+
127
+ ```bash
128
+ make setup-no-flash
129
+ ```
130
+
131
+ instead. This will install the dependencies without the flash_attn package. Note that this will disable the use of Flash Attention 2 and model training will be slower and consume more memory.
132
+
133
+ #### Nightly Conda virtual environment
134
+
135
+ You can also setup a conda virtual environment that can also deviate from the recommended setup. The ```Makefile``` contains a command ```setup-conda-nightly``` that installs a fresh conda environment with CUDA 12.4 and current nightly PyTorch.
136
+
137
+ #### Using requirements.txt
138
+
139
+ If you wish to use another virtual environment, you can also install the dependencies using the requirements.txt file:
140
+
141
+ ```bash
142
+ pip install -r requirements.txt
143
+ pip install flash-attn==2.6.1 --no-build-isolation # optional for Flash Attention 2
144
+ ```
145
+
146
+ ## Run H2O LLM Studio GUI
147
+
148
+ You can start H2O LLM Studio using the following command:
149
+
150
+ ```bash
151
+ make llmstudio
152
+ ```
153
+
154
+ This command will start the [H2O wave](https://github.com/h2oai/wave) server and app.
155
+ Navigate to <http://localhost:10101/> (we recommend using Chrome) to access H2O LLM Studio and start fine-tuning your models!
156
+
157
+ If you are running H2O LLM Studio with a custom environment other than Pipenv, you need to start the app as follows:
158
+
159
+ ```bash
160
+ H2O_WAVE_MAX_REQUEST_SIZE=25MB \
161
+ H2O_WAVE_NO_LOG=true \
162
+ H2O_WAVE_PRIVATE_DIR="/download/@output/download" \
163
+ wave run llm_studio.app
164
+ ```
165
+
166
+ If you are using the [nightly conda environment](#nightly-conda-virtual-environment), you can run ```make llmstudio-conda```.
167
+
168
+ ## Run H2O LLM Studio GUI using Docker
169
+
170
+ Install Docker first by following instructions from [NVIDIA Containers](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker). Make sure to have `nvidia-container-toolkit` installed on your machine as outlined in the instructions.
171
+
172
+ H2O LLM Studio images are stored in the h2oai dockerhub container repository.
173
+
174
+ ```bash
175
+ mkdir -p `pwd`/llmstudio_mnt
176
+
177
+ # make sure to pull latest image if you still have a prior version cached
178
+ docker pull h2oairelease/h2oai-llmstudio-app:latest
179
+
180
+ # run the container
181
+ docker run \
182
+ --runtime=nvidia \
183
+ --shm-size=64g \
184
+ --init \
185
+ --rm \
186
+ -it \
187
+ -u `id -u`:`id -g` \
188
+ -p 10101:10101 \
189
+ -v `pwd`/llmstudio_mnt:/home/llmstudio/mount \
190
+ -v ~/.cache:/home/llmstudio/.cache \
191
+ h2oairelease/h2oai-llmstudio-app:latest
192
+ ```
193
+
194
+ Navigate to <http://localhost:10101/> (we recommend using Chrome) to access H2O LLM Studio and start fine-tuning your models!
195
+
196
+ (Note other helpful docker commands are `docker ps` and `docker kill`.)
197
+
198
+ If you prefer to build your own Docker image from source, follow the instructions below.
199
+
200
+ ```bash
201
+ docker build -t h2o-llmstudio .
202
+
203
+ mkdir -p `pwd`/llmstudio_mnt
204
+
205
+ docker run \
206
+ --runtime=nvidia \
207
+ --shm-size=64g \
208
+ --init \
209
+ --rm \
210
+ -it \
211
+ -u `id -u`:`id -g` \
212
+ -p 10101:10101 \
213
+ -v `pwd`/llmstudio_mnt:/home/llmstudio/mount \
214
+ -v ~/.cache:/home/llmstudio/.cache \
215
+ h2o-llmstudio
216
+ ```
217
+
218
+ ## Run H2O LLM Studio with command line interface (CLI)
219
+
220
+ You can also use H2O LLM Studio with the command line interface (CLI) and specify the configuration .yaml file that contains all the experiment parameters. To finetune using H2O LLM Studio with CLI, activate the pipenv environment by running `make shell`, and then use the following command:
221
+
222
+ ```bash
223
+ python llm_studio/train.py -Y {path_to_config_yaml_file}
224
+ ```
225
+
226
+ To run on multiple GPUs in DDP mode, run the following command:
227
+
228
+ ```bash
229
+ bash distributed_train.sh {NR_OF_GPUS} -Y {path_to_config_yaml_file}
230
+ ```
231
+
232
+ By default, the framework will run on the first `k` GPUs. If you want to specify specific GPUs to run on, use the `CUDA_VISIBLE_DEVICES` environment variable before the command.
233
+
234
+ To start an interactive chat with your trained model, use the following command:
235
+
236
+ ```bash
237
+ python llm_studio/prompt.py -e {experiment_name}
238
+ ```
239
+
240
+ where `experiment_name` is the output folder of the experiment you want to chat with (see configuration).
241
+ The interactive chat will also work with model that were finetuned using the UI.
242
+
243
+ To publish the model to Hugging Face, use the following command:
244
+
245
+ ```bash
246
+ make shell
247
+
248
+ python llm_studio/publish_to_hugging_face.py -p {path_to_experiment} -d {device} -a {api_key} -u {user_id} -m {model_name} -s {safe_serialization}
249
+ ```
250
+
251
+ `path_to_experiment` is the output folder of the experiment.
252
+ `device` is the target device for running the model, either 'cpu' or 'cuda:0'. Default is 'cuda:0'.
253
+ `api_key` is the Hugging Face API Key. If user logged in, it can be omitted.
254
+ `user_id` is the Hugging Face user ID. If user logged in, it can be omitted.
255
+ `model_name` is the name of the model to be published on Hugging Face. It can be omitted.
256
+ `safe_serialization` is a flag indicating whether safe serialization should be used. Default is True.
257
+
258
+ ## Troubleshooting
259
+
260
+ If running on cloud based machines such as runpod, you may need to set the following environment variable to allow the H2O Wave server to accept connections from the proxy:
261
+
262
+ ```bash
263
+ H2O_WAVE_ALLOWED_ORIGINS="*"
264
+ ```
265
+
266
+ If you are experiencing timeouts when running the H2O Wave server remotely, you can increase the timeout by setting the following environment variables:
267
+
268
+ ```bash
269
+ H2O_WAVE_APP_CONNECT_TIMEOUT="15"
270
+ H2O_WAVE_APP_WRITE_TIMEOUT="15"
271
+ H2O_WAVE_APP_READ_TIMEOUT="15"
272
+ H2O_WAVE_APP_POOL_TIMEOUT="15"
273
+ ```
274
+
275
+ All default to 5 (seconds). Increase them if you are experiencing timeouts. Use -1 to disable the timeout.
276
+
277
+ ## Data format and example data
278
+
279
+ For details on the data format required when importing your data or example data that you can use to try out H2O LLM Studio, see [Data format](https://docs.h2o.ai/h2o-llmstudio/guide/datasets/data-connectors-format#data-format) in the H2O LLM Studio documentation.
280
+
281
+ ## Training your model
282
+
283
+ With H2O LLM Studio, training your large language model is easy and intuitive. First, upload your dataset and then start training your model. Start by [creating an experiment](https://docs.h2o.ai/h2o-llmstudio/guide/experiments/create-an-experiment). You can then [monitor and manage your experiment](https://docs.h2o.ai/h2o-llmstudio/guide/experiments/view-an-experiment), [compare experiments](https://docs.h2o.ai/h2o-llmstudio/guide/experiments/compare-experiments), or [push the model to Hugging Face](https://docs.h2o.ai/h2o-llmstudio/guide/experiments/export-trained-model) to share it with the community.
284
+
285
+ ## Example: Run on OASST data via CLI
286
+
287
+ As an example, you can run an experiment on the OASST data via CLI. For instructions, see [Run an experiment on the OASST data](https://docs.h2o.ai/h2o-llmstudio/guide/experiments/create-an-experiment#run-an-experiment-on-the-oasst-data-via-cli) guide in the H2O LLM Studio documentation.
288
+
289
+ ## Model checkpoints
290
+
291
+ All open-source datasets and models are posted on [H2O.ai's Hugging Face page](https://huggingface.co/h2oai/) and our [H2OGPT](https://github.com/h2oai/h2ogpt) repository.
292
+
293
+ ## Documentation
294
+
295
+ Detailed documentation and frequently asked questions (FAQs) for H2O LLM Studio can be found at <https://docs.h2o.ai/h2o-llmstudio/>. If you wish to contribute to the docs, navigate to the `/documentation` folder of this repo and refer to the [README.md](documentation/README.md) for more information.
296
+
297
+ ## Contributing
298
+
299
+ We are happy to accept contributions to the H2O LLM Studio project. Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.
300
+
301
+ ## License
302
+
303
+ H2O LLM Studio is licensed under the Apache 2.0 license. Please see the [LICENSE](LICENSE) file for more information.
about.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # H2O LLM Studio
2
+
3
+ Launch H2O LLM Studio, your go-to tool for fine-tuning large language models without writing a single line of code. With an easy-to-use GUI, you can tweak tons of hyperparameters and take advantage of the latest techniques like Low-Rank Adaptation (LoRA) and 4-bit model training. Check out how your model's doing with advanced evaluation metrics, visually track and compare performance, and even chat with your model for instant feedback. Fine-tuning LLMs has never been this simple and rewarding!
4
+
5
+ To learn more, see [H2O LLM Studio | Docs](https://docs.h2o.ai/h2o-llmstudio/).
app.toml.template ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [App]
2
+ name = "ai.h2o.llmstudio"
3
+ Version = "{{VERSION}}"
4
+ Title = "H2O LLM Studio"
5
+ Description = "A framework and no-code GUI designed for fine-tuning state-of-the-art large language models (LLMs)"
6
+ LongDescription = "about.md"
7
+ Tags = ["GENERATIVE_AI", "NLP", "DATA_SCIENCE"]
8
+
9
+ [Runtime]
10
+ # Must be installed in the server config
11
+ RuntimeVersion = "base_runtime"
12
+ AppMode = "container"
13
+ Port = 10101
14
+ CPUReservation = "10"
15
+ MemoryReservation = "118Gi"
16
+ MemoryLimit = "118Gi"
17
+ GPUCount = 1
18
+ VolumeMount = "/home/llmstudio/mount"
19
+ VolumeSize = "1Ti"
20
+ ResourceVolumeSize = "1Ti"
21
+ EnableSHM = true
22
+ EnableOIDC = true
23
+ RoutingMode = "BASE_URL"
24
+
25
+ [[Env]]
26
+ Name = "H2O_LLM_STUDIO_WORKDIR"
27
+ Value = "/home/llmstudio/mount"
28
+
29
+ [[Env]]
30
+ Name = "HOME"
31
+ Value = "/home/llmstudio"
32
+
33
+ [[Env]]
34
+ Name = "H2O_LLM_STUDIO_ENABLE_HEAP"
35
+ Value = "True"
36
+
37
+ [[Env]]
38
+ Name = "H2O_WAVE_PRIVATE_DIR"
39
+ Value = "/download/@/home/llmstudio/mount/output/download"
40
+
41
+ [[Env]]
42
+ Name = "HF_HUB_ENABLE_HF_TRANSFER"
43
+ Value = "0"
distributed_train.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ NUM_PROC=$1
3
+ shift
4
+ torchrun --nproc_per_node=$NUM_PROC llm_studio/train.py "$@"
entrypoint.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ nvidia-smi
5
+
6
+ echo "Starting H2O LLM Studio..."
7
+
8
+ wave run --no-reload llm_studio.app
pyproject.toml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "h2o-llmstudio"
3
+ version = "1.14.0-dev"
4
+ readme = "README.md"
5
+ license = {file = "LICENSE"}
6
+
7
+ [tool.black]
8
+ line-length = 88
9
+ target-version = ["py310"]
10
+ exclude = "(.eggs|.git|.hg|.mypy_cache|.nox|.tox|.venv|.svn|_build|buck-out|build/|dist/|output/|data/)"
11
+
12
+ [tool.isort]
13
+ multi_line_output = 3
14
+ include_trailing_comma = true
15
+ force_grid_wrap = 0
16
+ use_parentheses = true
17
+ ensure_newline_before_comments = true
18
+ line_length = 88
19
+
20
+ [tool.mypy]
21
+ ignore_missing_imports = true
22
+ allow_redefinition = true
23
+ strict_optional = false
24
+ exclude = "(build|output|data|tests)"
requirements.txt ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -i https://pypi.org/simple
2
+ --extra-index-url https://download.pytorch.org/whl/cu121
3
+ accelerate==0.34.2; python_full_version >= '3.8.0'
4
+ aioboto3==13.1.1; python_version >= '3.8' and python_version < '4.0'
5
+ aiobotocore[boto3]==2.13.1; python_version >= '3.8'
6
+ aiofiles==24.1.0; python_version >= '3.8'
7
+ aiohappyeyeballs==2.4.0; python_version >= '3.8'
8
+ aiohttp==3.10.6; python_version >= '3.8'
9
+ aioitertools==0.12.0; python_version >= '3.8'
10
+ aiosignal==1.3.1; python_version >= '3.7'
11
+ annotated-types==0.7.0; python_version >= '3.8'
12
+ anyio==4.6.0; python_version >= '3.9'
13
+ arrow==1.3.0; python_version >= '3.8'
14
+ async-timeout==4.0.3; python_version < '3.11'
15
+ attrs==24.2.0; python_version >= '3.7'
16
+ azure-core==1.31.0; python_version >= '3.8'
17
+ azure-storage-blob==12.23.0; python_version >= '3.8'
18
+ azure-storage-file-datalake==12.17.0; python_version >= '3.8'
19
+ backports.tarfile==1.2.0; python_version < '3.12'
20
+ beautifulsoup4==4.12.3; python_full_version >= '3.6.0'
21
+ bitsandbytes==0.43.3
22
+ bleach==6.1.0; python_version >= '3.8'
23
+ blessed==1.20.0; python_version >= '2.7'
24
+ bokeh==3.5.2; python_version >= '3.10'
25
+ boto3==1.34.131; python_version >= '3.8'
26
+ botocore==1.34.131; python_version >= '3.8'
27
+ bravado==11.0.3; python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_full_version != '3.5.0'
28
+ bravado-core==6.1.1; python_version >= '3.7'
29
+ certifi==2024.8.30; python_version >= '3.6'
30
+ cffi==1.17.1; platform_python_implementation != 'PyPy'
31
+ charset-normalizer==3.3.2; python_full_version >= '3.7.0'
32
+ click==8.1.7; python_version >= '3.7'
33
+ colorama==0.4.6; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
34
+ contourpy==1.3.0; python_version >= '3.9'
35
+ coolname==2.2.0
36
+ cramjam==2.8.4; python_version >= '3.8'
37
+ cryptography==43.0.1; python_version >= '3.7'
38
+ datasets==2.21.0; python_full_version >= '3.8.0'
39
+ deepspeed==0.14.4
40
+ dill==0.3.8; python_version >= '3.8'
41
+ distro==1.9.0; python_version >= '3.6'
42
+ docker-pycreds==0.4.0
43
+ editor==1.6.6; python_version >= '3.8'
44
+ einops==0.8.0; python_version >= '3.8'
45
+ exceptiongroup==1.2.2; python_version < '3.11'
46
+ fastparquet==2024.5.0; python_version >= '3.9'
47
+ filelock==3.16.1; python_version >= '3.8'
48
+ fqdn==1.5.1
49
+ frozenlist==1.4.1; python_version >= '3.8'
50
+ fsspec[http]==2024.6.1; python_version >= '3.8'
51
+ future==1.0.0; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
52
+ gitdb==4.0.11; python_version >= '3.7'
53
+ gitpython==3.1.43; python_version >= '3.7'
54
+ gputil==1.4.0
55
+ greenlet==3.1.1; python_version < '3.13' and platform_machine == 'aarch64' or (platform_machine == 'ppc64le' or (platform_machine == 'x86_64' or (platform_machine == 'amd64' or (platform_machine == 'AMD64' or (platform_machine == 'win32' or platform_machine == 'WIN32')))))
56
+ h11==0.14.0; python_version >= '3.7'
57
+ h2o-authn[discovery]==2.1.0; python_version >= '3.8'
58
+ h2o-cloud-discovery==2.1.0; python_version >= '3.8'
59
+ h2o-drive==3.0.0; python_version >= '3.8' and python_version < '4.0'
60
+ h2o-wave==1.5.1; python_version >= '3.8'
61
+ hf-transfer==0.1.8; python_version >= '3.7'
62
+ hjson==3.1.0
63
+ httpcore==1.0.5; python_version >= '3.8'
64
+ httpx==0.27.2; python_version >= '3.8'
65
+ huggingface-hub==0.24.6; python_full_version >= '3.8.0'
66
+ idna==3.10; python_version >= '3.6'
67
+ importlib-metadata==8.5.0; python_version < '3.12'
68
+ importlib-resources==6.4.5; python_version >= '3.8'
69
+ inquirer==3.4.0; python_full_version >= '3.8.1'
70
+ isodate==0.6.1
71
+ isoduration==20.11.0
72
+ jaraco.classes==3.4.0; python_version >= '3.8'
73
+ jaraco.context==6.0.1; python_version >= '3.8'
74
+ jaraco.functools==4.0.2; python_version >= '3.8'
75
+ jeepney==0.8.0; sys_platform == 'linux'
76
+ jinja2==3.1.4; python_version >= '3.7'
77
+ jiter==0.5.0; python_version >= '3.8'
78
+ jmespath==1.0.1; python_version >= '3.7'
79
+ joblib==1.4.2; python_version >= '3.8'
80
+ jsonpointer==3.0.0
81
+ jsonref==1.1.0; python_version >= '3.7'
82
+ jsonschema[format-nongpl]==4.23.0; python_version >= '3.8'
83
+ jsonschema-specifications==2023.12.1; python_version >= '3.8'
84
+ kaggle==1.6.17
85
+ keyring==25.4.1; python_version >= '3.8'
86
+ markupsafe==2.1.5; python_version >= '3.7'
87
+ monotonic==1.6
88
+ more-itertools==10.5.0; python_version >= '3.8'
89
+ mpmath==1.3.0
90
+ msgpack==1.1.0; python_version >= '3.8'
91
+ multidict==6.1.0; python_version >= '3.8'
92
+ multiprocess==0.70.16; python_version >= '3.8'
93
+ neptune==1.10.4; python_version >= '3.7' and python_version < '4.0'
94
+ networkx==3.3; python_version >= '3.10'
95
+ ninja==1.11.1.1
96
+ numpy==1.26.4; python_version >= '3.9'
97
+ nvidia-cublas-cu12==12.1.3.1; platform_system == 'Linux' and platform_machine == 'x86_64'
98
+ nvidia-cuda-cupti-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64'
99
+ nvidia-cuda-nvrtc-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64'
100
+ nvidia-cuda-runtime-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64'
101
+ nvidia-cudnn-cu12==9.1.0.70; platform_system == 'Linux' and platform_machine == 'x86_64'
102
+ nvidia-cufft-cu12==11.0.2.54; platform_system == 'Linux' and platform_machine == 'x86_64'
103
+ nvidia-curand-cu12==10.3.2.106; platform_system == 'Linux' and platform_machine == 'x86_64'
104
+ nvidia-cusolver-cu12==11.4.5.107; platform_system == 'Linux' and platform_machine == 'x86_64'
105
+ nvidia-cusparse-cu12==12.1.0.106; platform_system == 'Linux' and platform_machine == 'x86_64'
106
+ nvidia-ml-py==12.560.30
107
+ nvidia-nccl-cu12==2.20.5; platform_system == 'Linux' and platform_machine == 'x86_64'
108
+ nvidia-nvjitlink-cu12==12.6.68; python_version >= '3'
109
+ nvidia-nvtx-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64'
110
+ oauthlib==3.2.2; python_version >= '3.6'
111
+ openai==1.48.0; python_full_version >= '3.7.1'
112
+ packaging==24.1; python_version >= '3.8'
113
+ pandas==2.2.3; python_version >= '3.9'
114
+ peft==0.12.0; python_full_version >= '3.8.0'
115
+ pillow==10.4.0; python_version >= '3.8'
116
+ platformdirs==4.3.6; python_version >= '3.8'
117
+ portalocker==2.10.1; python_version >= '3.8'
118
+ protobuf==3.20.3; python_version >= '3.7'
119
+ psutil==6.0.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
120
+ py-cpuinfo==9.0.0
121
+ pyarrow==17.0.0; python_version >= '3.8'
122
+ pycparser==2.22; python_version >= '3.8'
123
+ pydantic==2.9.2; python_version >= '3.8'
124
+ pydantic-core==2.23.4; python_version >= '3.8'
125
+ pyjwt==2.9.0; python_version >= '3.8'
126
+ python-dateutil==2.9.0.post0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
127
+ python-slugify==8.0.4; python_version >= '3.7'
128
+ pytz==2024.2
129
+ pyyaml==6.0.2; python_version >= '3.8'
130
+ readchar==4.2.0; python_version >= '3.8'
131
+ referencing==0.35.1; python_version >= '3.8'
132
+ regex==2024.9.11; python_version >= '3.8'
133
+ requests==2.32.3; python_version >= '3.8'
134
+ requests-oauthlib==2.0.0; python_version >= '3.4'
135
+ rfc3339-validator==0.1.4
136
+ rfc3986-validator==0.1.1
137
+ rpds-py==0.20.0; python_version >= '3.8'
138
+ runs==1.2.2; python_version >= '3.8'
139
+ s3transfer==0.10.2; python_version >= '3.8'
140
+ sacrebleu==2.0.0; python_version >= '3.6'
141
+ safetensors==0.4.5; python_version >= '3.7'
142
+ scikit-learn==1.5.2; python_version >= '3.9'
143
+ scipy==1.14.1; python_version >= '3.10'
144
+ secretstorage==3.3.3; sys_platform == 'linux'
145
+ sentencepiece==0.1.99
146
+ sentry-sdk==2.14.0; python_version >= '3.6'
147
+ setproctitle==1.3.3; python_version >= '3.7'
148
+ setuptools==75.1.0; python_version >= '3.8'
149
+ simplejson==3.19.3; python_version >= '2.5' and python_version not in '3.0, 3.1, 3.2, 3.3'
150
+ six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
151
+ smmap==5.0.1; python_version >= '3.7'
152
+ sniffio==1.3.1; python_version >= '3.7'
153
+ soupsieve==2.6; python_version >= '3.8'
154
+ sqlalchemy==2.0.35; python_version >= '3.7'
155
+ sqlitedict==1.7.0
156
+ starlette==0.39.1; python_version >= '3.8'
157
+ swagger-spec-validator==3.0.4; python_version >= '3.8'
158
+ sympy==1.13.3; python_version >= '3.8'
159
+ tabulate==0.9.0; python_version >= '3.7'
160
+ text-unidecode==1.3
161
+ threadpoolctl==3.5.0; python_version >= '3.8'
162
+ tiktoken==0.7.0; python_version >= '3.8'
163
+ tokenizers==0.20.0; python_version >= '3.7'
164
+ toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
165
+ tomli==2.0.1; python_version < '3.11'
166
+ torch==2.4.0+cu121
167
+ tornado==6.4.1; python_version >= '3.8'
168
+ tqdm==4.66.5; python_version >= '3.7'
169
+ transformers==4.45.0; python_full_version >= '3.8.0'
170
+ triton==3.0.0; python_version < '3.13' and platform_system == 'Linux' and platform_machine == 'x86_64'
171
+ types-python-dateutil==2.9.0.20240906; python_version >= '3.8'
172
+ typing-extensions==4.12.2; python_version >= '3.8'
173
+ tzdata==2024.2; python_version >= '2'
174
+ uri-template==1.3.0
175
+ urllib3==2.2.3; python_version >= '3.8'
176
+ uvicorn==0.30.6; python_version >= '3.8'
177
+ wandb==0.18.1; python_version >= '3.7'
178
+ wcwidth==0.2.13
179
+ webcolors==24.8.0
180
+ webencodings==0.5.1
181
+ websocket-client==1.8.0; python_version >= '3.8'
182
+ wrapt==1.16.0; python_version >= '3.6'
183
+ xmod==1.8.1; python_version >= '3.8'
184
+ xxhash==3.5.0; python_version >= '3.7'
185
+ xyzservices==2024.9.0; python_version >= '3.8'
186
+ yarl==1.12.1; python_version >= '3.8'
187
+ zipp==3.20.2; python_version >= '3.8'