diff --git a/MANIFEST.in b/MANIFEST.in index 8855af1a5a..595e7a1505 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,7 @@ include LICENSE include CONTRIBUTING.md include README.md -recursive-exclude * __pycache__ +include trl/accelerate_configs/*.yaml include trl/templates/*.md -include trl/accelerate_configs/*.yaml \ No newline at end of file +recursive-exclude * __pycache__ +prune tests diff --git a/pyproject.toml b/pyproject.toml index 8674324a4a..a0b6c1072a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,129 @@ +[build-system] +requires = ["setuptools >= 77.0.3"] +build-backend = "setuptools.build_meta" + +[project] +name = "trl" +description = "Train transformer language models with reinforcement learning." +authors = [ + { name = "Leandro von Werra", email = "leandro.vonwerra@gmail.com" } +] +readme = { file = "README.md", content-type = "text/markdown" } +license = "Apache-2.0" +license-files = ["LICENSE"] +keywords = [ + "transformers", "huggingface", "language modeling", "post-training", "rlhf", "sft", "dpo", "grpo" +] +classifiers = [ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13" +] +requires-python = ">=3.9" +dependencies = [ + "accelerate>=1.4.0", + "datasets>=3.0.0", + "transformers>=4.56.1", + "transformers!=4.57.0; python_version == '3.9'" +] +dynamic = ["version"] + +[project.urls] +Homepage = "https://github.com/huggingface/trl" + +[project.scripts] +trl = "trl.cli:main" + +[project.optional-dependencies] +bco = [ + "scikit-learn", + "joblib" +] +deepspeed = [ + "deepspeed>=0.14.4" +] +judges = [ + "openai>=1.23.2", + "llm-blender>=0.0.2" +] +liger = [ + "liger-kernel>=0.6.2" +] +peft = [ + "peft>=0.8.0" +] +quality = [ + "pre-commit", + "hf-doc-builder" +] +quantization = [ + "bitsandbytes" +] +scikit = [ + "scikit-learn" +] +test = [ + "parameterized", + "pytest-cov", + "pytest-rerunfailures==15.1", + "pytest-xdist", + "pytest" +] +vllm = [ + "vllm==0.10.2", + "fastapi", + "pydantic", + "requests", + "uvicorn" +] +vlm = [ + "Pillow", + "torchvision", + "num2words==0.5.14" +] +dev = [ + "scikit-learn", + "joblib", + "deepspeed>=0.14.4", + "openai>=1.23.2", + "llm-blender>=0.0.2", + "liger-kernel>=0.6.2", + "peft>=0.8.0", + "pre-commit", + "hf-doc-builder", + "bitsandbytes", + "parameterized", + "pytest-cov", + "pytest-rerunfailures==15.1", + "pytest-xdist", + "pytest", + "vllm==0.10.2", + "fastapi", + "pydantic", + "requests", + "uvicorn", + "Pillow", + "torchvision", + "num2words==0.5.14" +] + +[tool.setuptools] +package-dir = {"trl" = "trl"} + +[tool.setuptools.dynamic] +version = { file = "VERSION" } + +[tool.coverage.run] +branch = true + [tool.ruff] target-version = "py39" line-length = 119 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index a0dabfe090..0000000000 --- a/setup.cfg +++ /dev/null @@ -1,93 +0,0 @@ -[metadata] -name = trl -version = file: VERSION -description = Train transformer language models with reinforcement learning. -long_description = file: README.md -long_description_content_type = text/markdown -author = Leandro von Werra -author_email = leandro.vonwerra@gmail.com -url = https://github.com/huggingface/trl -keywords = transformers, huggingface, language modeling, post-training, rlhf, sft, dpo, grpo -license_file = LICENSE -classifiers = - Development Status :: 2 - Pre-Alpha - Intended Audience :: Developers - Intended Audience :: Science/Research - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Programming Language :: Python :: 3.13 - -[options] -packages = find_namespace: -python_requires = >=3.9 -include_package_data = True -install_requires = - accelerate>=1.4.0 - datasets>=3.0.0 - transformers>=4.56.1 - transformers!=4.57.0; python_version == "3.9" - -[options.packages.find] -exclude = - tests* - -[options.extras_require] -bco = - scikit-learn - joblib -deepspeed = - deepspeed>=0.14.4 -judges = - openai>=1.23.2 - llm-blender>=0.0.2 -liger = - liger-kernel>=0.6.2 -peft = - peft>=0.8.0 -quality = - pre-commit - hf-doc-builder -quantization = - bitsandbytes -scikit = - scikit-learn -test = - parameterized - pytest-cov - pytest-rerunfailures==15.1 - pytest-xdist - pytest -vllm = - vllm==0.10.2 - fastapi - pydantic - requests - uvicorn - -vlm = - Pillow - torchvision - num2words==0.5.14 -dev = - %(bco)s - %(deepspeed)s - %(judges)s - %(liger)s - %(peft)s - %(quality)s - %(quantization)s - %(scikit)s - %(test)s - %(vlm)s - -[options.entry_points] -console_scripts = - trl = trl.cli:main - -[coverage:run] -branch = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 26f52a2806..0000000000 --- a/setup.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2020-2025 The HuggingFace Team. All rights reserved. -# -# 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. - -from setuptools import setup - - -setup()