LLaMA-Factory-Mirror/setup.py

93 lines
3.3 KiB
Python
Raw Normal View History

2024-06-15 17:54:33 +08:00
# Copyright 2024 the LlamaFactory team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2023-07-15 16:54:28 +08:00
import os
import re
2024-03-09 00:14:48 +08:00
from setuptools import find_packages, setup
2023-07-15 16:54:28 +08:00
def get_version():
2024-06-06 01:39:02 +08:00
with open(os.path.join("src", "llamafactory", "extras", "env.py"), "r", encoding="utf-8") as f:
2023-07-15 16:54:28 +08:00
file_content = f.read()
2024-05-16 00:57:16 +08:00
pattern = r"{}\W*=\W*\"([^\"]+)\"".format("VERSION")
2024-03-09 00:14:48 +08:00
(version,) = re.findall(pattern, file_content)
2023-07-15 16:54:28 +08:00
return version
def get_requires():
with open("requirements.txt", "r", encoding="utf-8") as f:
file_content = f.read()
lines = [line.strip() for line in file_content.strip().split("\n") if not line.startswith("#")]
return lines
2024-03-08 00:44:51 +08:00
extra_require = {
2024-05-09 16:52:27 +08:00
"torch": ["torch>=1.13.1"],
2024-06-06 16:59:18 +08:00
"torch-npu": ["torch==2.1.0", "torch-npu==2.1.0.post3", "decorator"],
2024-03-08 00:44:51 +08:00
"metrics": ["nltk", "jieba", "rouge-chinese"],
2024-06-15 05:11:33 +08:00
"deepspeed": ["deepspeed>=0.10.0"],
2024-05-06 21:47:00 +08:00
"bitsandbytes": ["bitsandbytes>=0.39.0"],
2024-06-27 00:29:42 +08:00
"hqq": ["hqq"],
"eetq": ["eetq"],
2024-06-26 22:11:44 +08:00
"gptq": ["optimum>=1.17.0", "auto-gptq>=0.5.0"],
2024-03-08 00:44:51 +08:00
"awq": ["autoawq"],
2024-03-25 22:38:56 +08:00
"aqlm": ["aqlm[gpu]>=1.1.0"],
2024-06-27 00:29:42 +08:00
"vllm": ["vllm>=0.4.3"],
"galore": ["galore-torch"],
"badam": ["badam>=1.2.1"],
2024-06-05 16:56:54 +08:00
"qwen": ["transformers_stream_generator"],
2024-04-11 20:08:51 +08:00
"modelscope": ["modelscope"],
2024-06-08 01:57:36 +08:00
"dev": ["ruff", "pytest"],
2024-03-08 00:44:51 +08:00
}
2023-07-15 16:54:28 +08:00
def main():
setup(
2024-05-16 18:39:08 +08:00
name="llamafactory",
2023-07-15 16:54:28 +08:00
version=get_version(),
author="hiyouga",
author_email="hiyouga" "@" "buaa.edu.cn",
2023-10-13 13:53:43 +08:00
description="Easy-to-use LLM fine-tuning framework",
2023-07-15 16:54:28 +08:00
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
keywords=["LLaMA", "BLOOM", "Falcon", "LLM", "ChatGPT", "transformer", "pytorch", "deep learning"],
license="Apache 2.0 License",
2023-10-13 13:53:43 +08:00
url="https://github.com/hiyouga/LLaMA-Factory",
2023-07-15 16:54:28 +08:00
package_dir={"": "src"},
packages=find_packages("src"),
python_requires=">=3.8.0",
install_requires=get_requires(),
2024-03-08 00:44:51 +08:00
extras_require=extra_require,
2024-05-16 18:39:08 +08:00
entry_points={"console_scripts": ["llamafactory-cli = llamafactory.cli:main"]},
2023-07-15 16:54:28 +08:00
classifiers=[
2024-03-09 00:14:48 +08:00
"Development Status :: 4 - Beta",
2023-07-15 16:54:28 +08:00
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
2024-03-09 00:14:48 +08:00
"Programming Language :: Python :: 3.11",
2023-07-15 16:54:28 +08:00
"Topic :: Scientific/Engineering :: Artificial Intelligence",
2024-03-09 00:14:48 +08:00
],
2023-07-15 16:54:28 +08:00
)
if __name__ == "__main__":
main()