Rahul2298 commited on
Commit
ff0cedd
·
verified ·
1 Parent(s): 99f294f

Upload 12 files

Browse files
Files changed (12) hide show
  1. .dockerignore +15 -0
  2. .gitignore +147 -0
  3. Dockerfile +83 -0
  4. Dockerfile.api +3 -0
  5. Dockerfile.app +2 -0
  6. LICENSE +202 -0
  7. Makefile +39 -0
  8. Manifest.in +2 -0
  9. README.md +133 -0
  10. requirements.txt +49 -0
  11. setup.cfg +26 -0
  12. setup.py +106 -0
.dockerignore ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ build/
2
+ dist/
3
+ logs/
4
+ output/
5
+ output2/
6
+ test/
7
+ test.py
8
+ .DS_Store
9
+ .vscode/
10
+ op*
11
+ op_*
12
+ .git
13
+ *.db
14
+ autotrain-data*
15
+ autotrain-*
.gitignore ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Local stuff
2
+ .DS_Store
3
+ .vscode/
4
+ test/
5
+ test.py
6
+ output/
7
+ output2/
8
+ logs/
9
+ op_*/
10
+ autotrain.db
11
+ autotrain.log
12
+ *.db
13
+ data/
14
+ # Byte-compiled / optimized / DLL files
15
+ __pycache__/
16
+ *.py[cod]
17
+ *$py.class
18
+ autotrain-data*
19
+ autotrain-*
20
+ op-*
21
+ # C extensions
22
+ *.so
23
+ test.yml
24
+ test.ipynb
25
+ output.png
26
+
27
+ # Distribution / packaging
28
+ .Python
29
+ build/
30
+ develop-eggs/
31
+ dist/
32
+ downloads/
33
+ eggs/
34
+ .eggs/
35
+ lib/
36
+ lib64/
37
+ parts/
38
+ sdist/
39
+ var/
40
+ wheels/
41
+ pip-wheel-metadata/
42
+ share/python-wheels/
43
+ *.egg-info/
44
+ .installed.cfg
45
+ *.egg
46
+ MANIFEST
47
+
48
+ # PyInstaller
49
+ # Usually these files are written by a python script from a template
50
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
51
+ *.manifest
52
+ *.spec
53
+
54
+ # Installer logs
55
+ pip-log.txt
56
+ pip-delete-this-directory.txt
57
+
58
+ # Unit test / coverage reports
59
+ htmlcov/
60
+ .tox/
61
+ .nox/
62
+ .coverage
63
+ .coverage.*
64
+ .cache
65
+ nosetests.xml
66
+ coverage.xml
67
+ *.cover
68
+ *.py,cover
69
+ .hypothesis/
70
+ .pytest_cache/
71
+
72
+ # Translations
73
+ *.mo
74
+ *.pot
75
+
76
+ # Django stuff:
77
+ *.log
78
+ local_settings.py
79
+ db.sqlite3
80
+ db.sqlite3-journal
81
+
82
+ # Flask stuff:
83
+ instance/
84
+ .webassets-cache
85
+
86
+ # Scrapy stuff:
87
+ .scrapy
88
+
89
+ # Sphinx documentation
90
+ docs/_build/
91
+
92
+ # PyBuilder
93
+ target/
94
+
95
+ # Jupyter Notebook
96
+ .ipynb_checkpoints
97
+
98
+ # IPython
99
+ profile_default/
100
+ ipython_config.py
101
+
102
+ # pyenv
103
+ .python-version
104
+
105
+ # pipenv
106
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
107
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
108
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
109
+ # install all needed dependencies.
110
+ #Pipfile.lock
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
Dockerfile ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive \
4
+ TZ=UTC \
5
+ HF_HUB_ENABLE_HF_TRANSFER=1
6
+
7
+ ENV PATH="${HOME}/miniconda3/bin:${PATH}"
8
+ ARG PATH="${HOME}/miniconda3/bin:${PATH}"
9
+ ENV PATH="/app/ngc-cli:${PATH}"
10
+ ARG PATH="/app/ngc-cli:${PATH}"
11
+
12
+ RUN mkdir -p /tmp/model && \
13
+ chown -R 1000:1000 /tmp/model && \
14
+ mkdir -p /tmp/data && \
15
+ chown -R 1000:1000 /tmp/data
16
+
17
+ RUN apt-get update && \
18
+ apt-get upgrade -y && \
19
+ apt-get install -y \
20
+ build-essential \
21
+ cmake \
22
+ curl \
23
+ ca-certificates \
24
+ gcc \
25
+ git \
26
+ locales \
27
+ net-tools \
28
+ wget \
29
+ libpq-dev \
30
+ libsndfile1-dev \
31
+ git \
32
+ git-lfs \
33
+ libgl1 \
34
+ unzip \
35
+ libjpeg-dev \
36
+ libpng-dev \
37
+ libgomp1 \
38
+ && rm -rf /var/lib/apt/lists/* && \
39
+ apt-get clean
40
+
41
+
42
+ RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
43
+ git lfs install
44
+
45
+ WORKDIR /app
46
+ RUN mkdir -p /app/.cache
47
+ ENV HF_HOME="/app/.cache"
48
+ RUN useradd -m -u 1000 user
49
+ RUN chown -R user:user /app
50
+ USER user
51
+ ENV HOME=/app
52
+
53
+ ENV PYTHONPATH=$HOME/app \
54
+ PYTHONUNBUFFERED=1 \
55
+ GRADIO_ALLOW_FLAGGING=never \
56
+ GRADIO_NUM_PORTS=1 \
57
+ GRADIO_SERVER_NAME=0.0.0.0 \
58
+ SYSTEM=spaces
59
+
60
+
61
+ RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
62
+ && sh Miniconda3-latest-Linux-x86_64.sh -b -p /app/miniconda \
63
+ && rm -f Miniconda3-latest-Linux-x86_64.sh
64
+ ENV PATH /app/miniconda/bin:$PATH
65
+
66
+ RUN conda create -p /app/env -y python=3.10
67
+
68
+ SHELL ["conda", "run","--no-capture-output", "-p","/app/env", "/bin/bash", "-c"]
69
+
70
+ RUN conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 pytorch-cuda=12.1 -c pytorch -c nvidia && \
71
+ conda clean -ya && \
72
+ conda install -c "nvidia/label/cuda-12.1.1" cuda-nvcc && conda clean -ya && \
73
+ conda install xformers -c xformers && conda clean -ya
74
+
75
+ COPY --chown=1000:1000 . /app/
76
+
77
+ RUN pip install -e . && \
78
+ python -m nltk.downloader punkt && \
79
+ pip install -U ninja && \
80
+ pip install -U flash-attn --no-build-isolation && \
81
+ pip install -U deepspeed && \
82
+ pip install --upgrade --force-reinstall --no-cache-dir "unsloth[cu121-ampere-torch230] @ git+https://github.com/unslothai/unsloth.git" --no-deps && \
83
+ pip cache purge
Dockerfile.api ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ FROM huggingface/autotrain-advanced:latest
2
+
3
+ CMD autotrain api --port 7860 --host 0.0.0.0
Dockerfile.app ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ FROM huggingface/autotrain-advanced:latest
2
+ CMD uvicorn autotrain.app:app --host 0.0.0.0 --port 7860 --reload --workers 4
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.
Makefile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .PHONY: quality style test
2
+
3
+ # Check that source code meets quality standards
4
+
5
+ quality:
6
+ black --check --line-length 119 --target-version py38 .
7
+ isort --check-only .
8
+ flake8 --max-line-length 119
9
+
10
+ # Format source code automatically
11
+
12
+ style:
13
+ black --line-length 119 --target-version py38 .
14
+ isort .
15
+
16
+ test:
17
+ pytest -sv ./src/
18
+
19
+ docker:
20
+ docker build -t autotrain-advanced:latest .
21
+ docker tag autotrain-advanced:latest huggingface/autotrain-advanced:latest
22
+ docker push huggingface/autotrain-advanced:latest
23
+
24
+ api:
25
+ docker build -t autotrain-advanced-api:latest -f Dockerfile.api .
26
+ docker tag autotrain-advanced-api:latest public.ecr.aws/z4c3o6n6/autotrain-api:latest
27
+ docker push public.ecr.aws/z4c3o6n6/autotrain-api:latest
28
+
29
+ ngc:
30
+ docker build -t autotrain-advanced:latest .
31
+ docker tag autotrain-advanced:latest nvcr.io/ycymhzotssoi/autotrain-advanced:latest
32
+ docker push nvcr.io/ycymhzotssoi/autotrain-advanced:latest
33
+
34
+ pip:
35
+ rm -rf build/
36
+ rm -rf dist/
37
+ make style && make quality
38
+ python setup.py sdist bdist_wheel
39
+ twine upload dist/* --verbose --repository autotrain-advanced
Manifest.in ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ recursive-include src/autotrain/static *
2
+ recursive-include src/autotrain/templates *
README.md ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🤗 AutoTrain Advanced
2
+
3
+ AutoTrain Advanced: faster and easier training and deployments of state-of-the-art machine learning models. AutoTrain Advanced is a no-code solution that allows you to train machine learning models in just a few clicks. Please note that you must upload data in correct format for project to be created. For help regarding proper data format and pricing, check out the documentation.
4
+
5
+ NOTE: AutoTrain is free! You only pay for the resources you use in case you decide to run AutoTrain on Hugging Face Spaces. When running locally, you only pay for the resources you use on your own infrastructure.
6
+
7
+ ## Supported Tasks
8
+
9
+ | Task | Status | Python Notebook | Example Configs |
10
+ | --- | --- | --- | --- |
11
+ | LLM SFT Finetuning | ✅ | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/autotrain-advanced/blob/main/notebooks/llm_finetuning.ipynb) | [llm_sft_finetune.yaml](https://github.com/huggingface/autotrain-advanced/blob/main/configs/llm_finetuning/smollm2.yml) |
12
+ | LLM ORPO Finetuning | ✅ | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/autotrain-advanced/blob/main/notebooks/llm_finetuning.ipynb) | [llm_orpo_finetune.yaml](https://github.com/huggingface/autotrain-advanced/blob/main/configs/llm_finetuning/llama3-8b-orpo.yml) |
13
+ | LLM DPO Finetuning | ✅ | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/autotrain-advanced/blob/main/notebooks/llm_finetuning.ipynb) | [llm_dpo_finetune.yaml](https://github.com/huggingface/autotrain-advanced/blob/main/configs/llm_finetuning/llama3-8b-dpo-qlora.yml) |
14
+ | LLM Reward Finetuning | ✅ | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/autotrain-advanced/blob/main/notebooks/llm_finetuning.ipynb) | [llm_reward_finetune.yaml](https://github.com/huggingface/autotrain-advanced/blob/main/configs/llm_finetuning/llama32-1b-sft.yml) |
15
+ | LLM Generic/Default Finetuning | ✅ | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/autotrain-advanced/blob/main/notebooks/llm_finetuning.ipynb) | [llm_generic_finetune.yaml](https://github.com/huggingface/autotrain-advanced/blob/main/configs/llm_finetuning/gpt2_sft.yml) |
16
+ | Text Classification | ✅ | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/autotrain-advanced/blob/main/notebooks/text_classification.ipynb) | [text_classification.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/text_classification) |
17
+ | Text Regression | ✅ | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/autotrain-advanced/blob/main/notebooks/text_regression.ipynb) | [text_regression.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/text_regression) |
18
+ | Token Classification | ✅ | Coming Soon | [token_classification.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/token_classification) |
19
+ | Seq2Seq | ✅ | Coming Soon | [seq2seq.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/seq2seq) |
20
+ | Extractive Question Answering | ✅ | Coming Soon | [extractive_qa.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/extractive_question_answering) |
21
+ | Image Classification | ✅ | Coming Soon | [image_classification.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/image_classification) |
22
+ | Image Scoring/Regression | ✅ | Coming Soon | [image_regression.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/image_scoring) |
23
+ | VLM | 🟥 | Coming Soon | [vlm.yaml](https://github.com/huggingface/autotrain-advanced/tree/main/configs/vlm) |
24
+
25
+
26
+ ## Running UI on Colab or Hugging Face Spaces
27
+
28
+ - Deploy AutoTrain on Hugging Face Spaces: [![Deploy on Spaces](https://huggingface.co/datasets/huggingface/badges/resolve/main/deploy-on-spaces-md.svg)](https://huggingface.co/login?next=%2Fspaces%2Fautotrain-projects%2Fautotrain-advanced%3Fduplicate%3Dtrue)
29
+
30
+
31
+ - Run AutoTrain UI on Colab via ngrok: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/autotrain-advanced/blob/main/colabs/AutoTrain_ngrok.ipynb)
32
+
33
+
34
+ ## Local Installation
35
+
36
+ You can Install AutoTrain-Advanced python package via PIP. Please note you will need python >= 3.10 for AutoTrain Advanced to work properly.
37
+
38
+ pip install autotrain-advanced
39
+
40
+ Please make sure that you have git lfs installed. Check out the instructions here: https://github.com/git-lfs/git-lfs/wiki/Installation
41
+
42
+ You also need to install torch, torchaudio and torchvision.
43
+
44
+ The best way to run autotrain is in a conda environment. You can create a new conda environment with the following command:
45
+
46
+ conda create -n autotrain python=3.10
47
+ conda activate autotrain
48
+ pip install autotrain-advanced
49
+ conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
50
+ conda install -c "nvidia/label/cuda-12.1.0" cuda-nvcc
51
+
52
+ Once done, you can start the application using:
53
+
54
+ autotrain app --port 8080 --host 127.0.0.1
55
+
56
+
57
+ If you are not fond of UI, you can use AutoTrain Configs to train using command line or simply AutoTrain CLI.
58
+
59
+ To use config file for training, you can use the following command:
60
+
61
+ autotrain --config <path_to_config_file>
62
+
63
+
64
+ You can find sample config files in the `configs` directory of this repository.
65
+
66
+ Example config file for finetuning SmolLM2:
67
+
68
+ ```yaml
69
+ task: llm-sft
70
+ base_model: HuggingFaceTB/SmolLM2-1.7B-Instruct
71
+ project_name: autotrain-smollm2-finetune
72
+ log: tensorboard
73
+ backend: local
74
+
75
+ data:
76
+ path: HuggingFaceH4/no_robots
77
+ train_split: train
78
+ valid_split: null
79
+ chat_template: tokenizer
80
+ column_mapping:
81
+ text_column: messages
82
+
83
+ params:
84
+ block_size: 2048
85
+ model_max_length: 4096
86
+ epochs: 2
87
+ batch_size: 1
88
+ lr: 1e-5
89
+ peft: true
90
+ quantization: int4
91
+ target_modules: all-linear
92
+ padding: right
93
+ optimizer: paged_adamw_8bit
94
+ scheduler: linear
95
+ gradient_accumulation: 8
96
+ mixed_precision: bf16
97
+ merge_adapter: true
98
+
99
+ hub:
100
+ username: ${HF_USERNAME}
101
+ token: ${HF_TOKEN}
102
+ push_to_hub: true
103
+ ```
104
+
105
+ To fine-tune a model using the config file above, you can use the following command:
106
+
107
+ ```bash
108
+ $ export HF_USERNAME=<your_hugging_face_username>
109
+ $ export HF_TOKEN=<your_hugging_face_write_token>
110
+ $ autotrain --config <path_to_config_file>
111
+ ```
112
+
113
+
114
+ ## Documentation
115
+
116
+ Documentation is available at https://hf.co/docs/autotrain/
117
+
118
+ ## Citation
119
+
120
+ ```
121
+ @inproceedings{thakur-2024-autotrain,
122
+ title = "{A}uto{T}rain: No-code training for state-of-the-art models",
123
+ author = "Thakur, Abhishek",
124
+ booktitle = "Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
125
+ month = nov,
126
+ year = "2024",
127
+ address = "Miami, Florida, USA",
128
+ publisher = "Association for Computational Linguistics",
129
+ url = "https://aclanthology.org/2024.emnlp-demo.44",
130
+ pages = "419--423",
131
+ abstract = "With the advancements in open-source models, training(or finetuning) models on custom datasets has become a crucial part of developing solutions which are tailored to specific industrial or open-source applications. Yet, there is no single tool which simplifies the process of training across different types of modalities or tasks.We introduce AutoTrain(aka AutoTrain Advanced){---}an open-source, no code tool/library which can be used to train (or finetune) models for different kinds of tasks such as: large language model (LLM) finetuning, text classification/regression, token classification, sequence-to-sequence task, finetuning of sentence transformers, visual language model (VLM) finetuning, image classification/regression and even classification and regression tasks on tabular data. AutoTrain Advanced is an open-source library providing best practices for training models on custom datasets. The library is available at https://github.com/huggingface/autotrain-advanced. AutoTrain can be used in fully local mode or on cloud machines and works with tens of thousands of models shared on Hugging Face Hub and their variations.",
132
+ }
133
+ ```
requirements.txt ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ albumentations==1.4.23
2
+ datasets[vision]~=3.2.0
3
+ evaluate==0.4.3
4
+ ipadic==1.0.0
5
+ jiwer==3.0.5
6
+ joblib==1.4.2
7
+ loguru==0.7.3
8
+ pandas==2.2.3
9
+ nltk==3.9.1
10
+ optuna==4.1.0
11
+ Pillow==11.0.0
12
+ sacremoses==0.1.1
13
+ scikit-learn==1.6.0
14
+ sentencepiece==0.2.0
15
+ tqdm==4.67.1
16
+ werkzeug==3.1.3
17
+ xgboost==2.1.3
18
+ huggingface_hub==0.27.0
19
+ requests==2.32.3
20
+ einops==0.8.0
21
+ packaging==24.2
22
+ cryptography==44.0.0
23
+ nvitop==1.3.2
24
+ # latest versions
25
+ tensorboard==2.18.0
26
+ peft==0.14.0
27
+ trl==0.13.0
28
+ tiktoken==0.8.0
29
+ transformers==4.48.0
30
+ accelerate==1.2.1
31
+ bitsandbytes==0.45.0
32
+ # extras
33
+ rouge_score==0.1.2
34
+ py7zr==0.22.0
35
+ fastapi==0.115.6
36
+ uvicorn==0.34.0
37
+ python-multipart==0.0.20
38
+ pydantic==2.10.4
39
+ hf-transfer
40
+ pyngrok==7.2.1
41
+ authlib==1.4.0
42
+ itsdangerous==2.2.0
43
+ seqeval==1.2.2
44
+ httpx==0.28.1
45
+ pyyaml==6.0.2
46
+ timm==1.0.12
47
+ torchmetrics==1.6.0
48
+ pycocotools==2.0.8
49
+ sentence-transformers==3.3.1
setup.cfg ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [metadata]
2
+ license_files = LICENSE
3
+ version = attr: autotrain.__version__
4
+
5
+ [isort]
6
+ ensure_newline_before_comments = True
7
+ force_grid_wrap = 0
8
+ include_trailing_comma = True
9
+ line_length = 119
10
+ lines_after_imports = 2
11
+ multi_line_output = 3
12
+ use_parentheses = True
13
+
14
+ [flake8]
15
+ ignore = E203, E501, W503
16
+ max-line-length = 119
17
+ per-file-ignores =
18
+ # imported but unused
19
+ __init__.py: F401, E402
20
+ src/autotrain/params.py: F401
21
+ exclude =
22
+ .git,
23
+ .venv,
24
+ __pycache__,
25
+ dist
26
+ build
setup.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Lint as: python3
2
+ """
3
+ HuggingFace / AutoTrain Advanced
4
+ """
5
+ import os
6
+
7
+ from setuptools import find_packages, setup
8
+
9
+
10
+ DOCLINES = __doc__.split("\n")
11
+
12
+ this_directory = os.path.abspath(os.path.dirname(__file__))
13
+ with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
14
+ LONG_DESCRIPTION = f.read()
15
+
16
+ # get INSTALL_REQUIRES from requirements.txt
17
+ INSTALL_REQUIRES = []
18
+ requirements_path = os.path.join(this_directory, "requirements.txt")
19
+ with open(requirements_path, encoding="utf-8") as f:
20
+ for line in f:
21
+ # Exclude 'bitsandbytes' if installing on macOS
22
+ if "bitsandbytes" in line:
23
+ line = line.strip() + " ; sys_platform == 'linux'"
24
+ INSTALL_REQUIRES.append(line.strip())
25
+ else:
26
+ INSTALL_REQUIRES.append(line.strip())
27
+
28
+ QUALITY_REQUIRE = [
29
+ "black",
30
+ "isort",
31
+ "flake8==3.7.9",
32
+ ]
33
+
34
+ TESTS_REQUIRE = ["pytest"]
35
+
36
+ CLIENT_REQUIRES = ["requests", "loguru"]
37
+
38
+
39
+ EXTRAS_REQUIRE = {
40
+ "base": INSTALL_REQUIRES,
41
+ "dev": INSTALL_REQUIRES + QUALITY_REQUIRE + TESTS_REQUIRE,
42
+ "quality": INSTALL_REQUIRES + QUALITY_REQUIRE,
43
+ "docs": INSTALL_REQUIRES
44
+ + [
45
+ "recommonmark",
46
+ "sphinx==3.1.2",
47
+ "sphinx-markdown-tables",
48
+ "sphinx-rtd-theme==0.4.3",
49
+ "sphinx-copybutton",
50
+ ],
51
+ "client": CLIENT_REQUIRES,
52
+ }
53
+
54
+ setup(
55
+ name="autotrain-advanced",
56
+ description=DOCLINES[0],
57
+ long_description=LONG_DESCRIPTION,
58
+ long_description_content_type="text/markdown",
59
+ author="HuggingFace Inc.",
60
+ author_email="autotrain@huggingface.co",
61
+ url="https://github.com/huggingface/autotrain-advanced",
62
+ download_url="https://github.com/huggingface/autotrain-advanced/tags",
63
+ license="Apache 2.0",
64
+ package_dir={"": "src"},
65
+ packages=find_packages("src"),
66
+ extras_require=EXTRAS_REQUIRE,
67
+ install_requires=INSTALL_REQUIRES,
68
+ entry_points={"console_scripts": ["autotrain=autotrain.cli.autotrain:main"]},
69
+ classifiers=[
70
+ "Development Status :: 5 - Production/Stable",
71
+ "Intended Audience :: Developers",
72
+ "Intended Audience :: Education",
73
+ "Intended Audience :: Science/Research",
74
+ "License :: OSI Approved :: Apache Software License",
75
+ "Operating System :: OS Independent",
76
+ "Programming Language :: Python :: 3.8",
77
+ "Programming Language :: Python :: 3.9",
78
+ "Programming Language :: Python :: 3.10",
79
+ "Programming Language :: Python :: 3.11",
80
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
81
+ ],
82
+ keywords="automl autonlp autotrain huggingface",
83
+ data_files=[
84
+ (
85
+ "static",
86
+ [
87
+ "src/autotrain/app/static/logo.png",
88
+ "src/autotrain/app/static/scripts/fetch_data_and_update_models.js",
89
+ "src/autotrain/app/static/scripts/listeners.js",
90
+ "src/autotrain/app/static/scripts/utils.js",
91
+ "src/autotrain/app/static/scripts/poll.js",
92
+ "src/autotrain/app/static/scripts/logs.js",
93
+ ],
94
+ ),
95
+ (
96
+ "templates",
97
+ [
98
+ "src/autotrain/app/templates/index.html",
99
+ "src/autotrain/app/templates/error.html",
100
+ "src/autotrain/app/templates/duplicate.html",
101
+ "src/autotrain/app/templates/login.html",
102
+ ],
103
+ ),
104
+ ],
105
+ include_package_data=True,
106
+ )