LLaMA-Factory-Mirror/setup.py

77 lines
2.7 KiB
Python
Raw Normal View History

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-05-08 16:37:54 +08:00
"deepspeed": ["deepspeed>=0.10.0,<=0.14.0"],
2024-05-06 21:47:00 +08:00
"bitsandbytes": ["bitsandbytes>=0.39.0"],
2024-06-03 18:38:36 +08:00
"vllm": ["vllm>=0.4.3"],
2024-04-03 21:56:43 +08:00
"galore": ["galore-torch"],
2024-04-16 17:10:02 +08:00
"badam": ["badam"],
2024-03-08 00:44:51 +08:00
"gptq": ["optimum>=1.16.0", "auto-gptq>=0.5.0"],
"awq": ["autoawq"],
2024-03-25 22:38:56 +08:00
"aqlm": ["aqlm[gpu]>=1.1.0"],
2024-06-05 16:56:54 +08:00
"qwen": ["transformers_stream_generator"],
2024-04-11 20:08:51 +08:00
"modelscope": ["modelscope"],
2024-03-09 00:14:48 +08:00
"quality": ["ruff"],
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()