|
1 | 1 | #!/usr/bin/env python
|
2 | 2 | # Copyright (c) OpenMMLab. All rights reserved.
|
3 |
| -import os |
4 |
| -import os.path as osp |
5 |
| -import platform |
6 |
| -import shutil |
7 |
| -import sys |
8 |
| -import warnings |
9 | 3 | from setuptools import find_packages, setup
|
10 | 4 |
|
11 | 5 |
|
@@ -101,85 +95,38 @@ def gen_packages_items():
|
101 | 95 | return packages
|
102 | 96 |
|
103 | 97 |
|
104 |
| -def add_mim_extension(): |
105 |
| - """Add extra files that are required to support MIM into the package. |
106 |
| -
|
107 |
| - These files will be added by creating a symlink to the originals if the |
108 |
| - package is installed in `editable` mode (e.g. pip install -e .), or by |
109 |
| - copying from the originals otherwise. |
110 |
| - """ |
111 |
| - |
112 |
| - # parse installment mode |
113 |
| - if 'develop' in sys.argv: |
114 |
| - # installed by `pip install -e .` |
115 |
| - if platform.system() == 'Windows': |
116 |
| - # set `copy` mode here since symlink fails on Windows. |
117 |
| - mode = 'copy' |
118 |
| - else: |
119 |
| - mode = 'symlink' |
120 |
| - elif 'sdist' in sys.argv or 'bdist_wheel' in sys.argv: |
121 |
| - # installed by `pip install .` |
122 |
| - # or create source distribution by `python setup.py sdist` |
123 |
| - mode = 'copy' |
124 |
| - else: |
125 |
| - return |
126 |
| - |
127 |
| - filenames = ['tools', 'configs', 'demo', 'model-index.yml'] |
128 |
| - repo_path = osp.dirname(__file__) |
129 |
| - mim_path = osp.join(repo_path, 'xtuner', '.mim') |
130 |
| - os.makedirs(mim_path, exist_ok=True) |
131 |
| - |
132 |
| - for filename in filenames: |
133 |
| - if osp.exists(filename): |
134 |
| - src_path = osp.join(repo_path, filename) |
135 |
| - tar_path = osp.join(mim_path, filename) |
136 |
| - |
137 |
| - if osp.isfile(tar_path) or osp.islink(tar_path): |
138 |
| - os.remove(tar_path) |
139 |
| - elif osp.isdir(tar_path): |
140 |
| - shutil.rmtree(tar_path) |
141 |
| - |
142 |
| - if mode == 'symlink': |
143 |
| - src_relpath = osp.relpath(src_path, osp.dirname(tar_path)) |
144 |
| - os.symlink(src_relpath, tar_path) |
145 |
| - elif mode == 'copy': |
146 |
| - if osp.isfile(src_path): |
147 |
| - shutil.copyfile(src_path, tar_path) |
148 |
| - elif osp.isdir(src_path): |
149 |
| - shutil.copytree(src_path, tar_path) |
150 |
| - else: |
151 |
| - warnings.warn(f'Cannot copy file {src_path}.') |
152 |
| - else: |
153 |
| - raise ValueError(f'Invalid mode {mode}') |
154 |
| - |
155 |
| - |
156 | 98 | if __name__ == '__main__':
|
157 |
| - add_mim_extension() |
158 | 99 | setup(
|
159 | 100 | name='xtuner',
|
160 | 101 | version=get_version(),
|
161 |
| - description='xTuner', |
| 102 | + description='A toolkit for efficiently fine-tuning LLM', |
162 | 103 | long_description=readme(),
|
163 | 104 | long_description_content_type='text/markdown',
|
164 | 105 | author='{author name}',
|
165 | 106 | author_email='{your email}',
|
166 |
| - keywords='xtuner, template', |
167 |
| - url='https://github.com/user_name/xtuner', |
168 |
| - packages=find_packages(exclude=('configs', 'tools', 'demo')), |
| 107 | + keywords='large language model, parameter-efficient fine-tuning', |
| 108 | + url='https://github.com/InternLM/xtuner', |
| 109 | + packages=find_packages(), |
169 | 110 | include_package_data=True,
|
170 | 111 | classifiers=[
|
171 | 112 | 'Development Status :: 4 - Beta',
|
172 | 113 | 'License :: OSI Approved :: Apache Software License',
|
173 | 114 | 'Operating System :: OS Independent',
|
174 | 115 | 'Programming Language :: Python :: 3',
|
175 |
| - 'Programming Language :: Python :: 3.7', |
176 | 116 | 'Programming Language :: Python :: 3.8',
|
177 | 117 | 'Programming Language :: Python :: 3.9',
|
178 | 118 | 'Programming Language :: Python :: 3.10',
|
179 | 119 | 'Topic :: Utilities',
|
180 | 120 | ],
|
181 |
| - python_requires='>=3.7', |
| 121 | + python_requires='>=3.8', |
182 | 122 | license='Apache License 2.0',
|
183 |
| - install_requires=parse_requirements('requirements.txt'), |
| 123 | + install_requires=parse_requirements('requirements/runtime.txt'), |
| 124 | + extras_require={ |
| 125 | + 'all': |
| 126 | + parse_requirements('requirements.txt'), |
| 127 | + 'deepspeed': |
| 128 | + parse_requirements('requirements/runtime.txt') + |
| 129 | + parse_requirements('requirements/deepspeed.txt') |
| 130 | + }, |
184 | 131 | zip_safe=False,
|
185 | 132 | entry_points={'console_scripts': ['xtuner = xtuner:cli']})
|
0 commit comments