|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import re |
|
import shutil |
|
from pathlib import Path |
|
|
|
from setuptools import find_packages, setup |
|
|
|
|
|
|
|
stale_egg_info = Path(__file__).parent / "alignment.egg-info" |
|
if stale_egg_info.exists(): |
|
print( |
|
( |
|
"Warning: {} exists.\n\n" |
|
"If you recently updated alignment, this is expected,\n" |
|
"but it may prevent alignment from installing in editable mode.\n\n" |
|
"This directory is automatically generated by Python's packaging tools.\n" |
|
"I will remove it now.\n\n" |
|
"See https://github.com/pypa/pip/issues/5466 for details.\n" |
|
).format(stale_egg_info) |
|
) |
|
shutil.rmtree(stale_egg_info) |
|
|
|
|
|
|
|
|
|
_deps = [ |
|
"accelerate>=0.29.2", |
|
"bitsandbytes>=0.43.0", |
|
"black>=24.4.2", |
|
"datasets>=2.18.0", |
|
"deepspeed>=0.14.4", |
|
"einops>=0.6.1", |
|
"evaluate==0.4.0", |
|
"flake8>=6.0.0", |
|
"hf-doc-builder>=0.4.0", |
|
"hf_transfer>=0.1.4", |
|
"huggingface-hub>=0.19.2,<1.0", |
|
"isort>=5.12.0", |
|
"ninja>=1.11.1", |
|
"numpy>=1.24.2", |
|
"packaging>=23.0", |
|
"parameterized>=0.9.0", |
|
"peft>=0.9.0", |
|
"protobuf<=3.20.2", |
|
"pytest", |
|
"safetensors>=0.3.3", |
|
"sentencepiece>=0.1.99", |
|
"scipy", |
|
"tensorboard", |
|
"torch>=2.1.2", |
|
"transformers>=4.39.3", |
|
"trl>=0.9.6", |
|
"jinja2>=3.0.0", |
|
"tqdm>=4.64.1", |
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deps = {b: a for a, b in (re.findall(r"^(([^!=<>~ \[\]]+)(?:\[[^\]]+\])?(?:[!=<>~ ].*)?$)", x)[0] for x in _deps)} |
|
|
|
|
|
def deps_list(*pkgs): |
|
return [deps[pkg] for pkg in pkgs] |
|
|
|
|
|
extras = {} |
|
extras["tests"] = deps_list("pytest", "parameterized") |
|
extras["torch"] = deps_list("torch") |
|
extras["quality"] = deps_list("black", "isort", "flake8") |
|
extras["docs"] = deps_list("hf-doc-builder") |
|
extras["dev"] = extras["docs"] + extras["quality"] + extras["tests"] |
|
|
|
|
|
install_requires = [ |
|
deps["accelerate"], |
|
deps["bitsandbytes"], |
|
deps["einops"], |
|
deps["evaluate"], |
|
deps["datasets"], |
|
deps["deepspeed"], |
|
deps["hf_transfer"], |
|
deps["huggingface-hub"], |
|
deps["jinja2"], |
|
deps["ninja"], |
|
deps["numpy"], |
|
deps["packaging"], |
|
deps["peft"], |
|
deps["protobuf"], |
|
deps["safetensors"], |
|
deps["sentencepiece"], |
|
deps["scipy"], |
|
deps["tensorboard"], |
|
deps["tqdm"], |
|
deps["transformers"], |
|
deps["trl"], |
|
] |
|
|
|
setup( |
|
name="alignment-handbook", |
|
version="0.4.0.dev0", |
|
author="The Hugging Face team (past and future)", |
|
author_email="[email protected]", |
|
description="The Alignment Handbook", |
|
long_description=open("README.md", "r", encoding="utf-8").read(), |
|
long_description_content_type="text/markdown", |
|
keywords="nlp deep learning rlhf llm", |
|
license="Apache", |
|
url="https://github.com/huggingface/alignment-handbook", |
|
package_dir={"": "src"}, |
|
packages=find_packages("src"), |
|
zip_safe=False, |
|
extras_require=extras, |
|
python_requires=">=3.10.9", |
|
install_requires=install_requires, |
|
classifiers=[ |
|
"Development Status :: 3 - Alpha", |
|
"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.10", |
|
"Topic :: Scientific/Engineering :: Artificial Intelligence", |
|
], |
|
) |
|
|