From 86fa600870a9c8ed3973f5a3ba522dd18b6ebe87 Mon Sep 17 00:00:00 2001 From: HL Date: Mon, 23 Dec 2024 16:52:33 -0700 Subject: [PATCH] [install] chore: add pyproject.toml. make vllm default dependency (#63) --- docs/start/quickstart.rst | 17 ++++----- pyproject.toml | 78 +++++++++++++++++++++++++++++++++++++++ requirements.txt | 5 +-- setup.py | 11 ++---- 4 files changed, 91 insertions(+), 20 deletions(-) create mode 100644 pyproject.toml diff --git a/docs/start/quickstart.rst b/docs/start/quickstart.rst index 87f2568..c4a0841 100644 --- a/docs/start/quickstart.rst +++ b/docs/start/quickstart.rst @@ -18,7 +18,7 @@ Prerequisite: - the latest version of ``verl`` and its dependencies installed following the installation guide. Using the docker image is recommended. -- an GPU with at least 32 GB memory +- an GPU with at least 24 GB HBM Dataset Introduction @@ -108,7 +108,7 @@ Set the ``data.train_files`` ,\ ``data.val_files``, ``actor_rollout_ref.model.pa trainer.nnodes=1 \ trainer.save_freq=10 \ trainer.test_freq=10 \ - trainer.total_epochs=15 $@ 2>&1 | tee verl_demo.log + trainer.total_epochs=15 2>&1 | tee verl_demo.log You are expected to see the following logs, indicating training in progress. The key metric ``val/test_score/openai/gsm8k`` is computed every ``trainer.test_freq`` steps: @@ -129,15 +129,14 @@ To enable ``wandb`` for experiment tracking, set the following configs: trainer.project_name=$YOUR_PROJECT_NAME \ trainer.experiment_name=$YOUR_RUN_NAME \ -If you encounter out of memory issues, enable the following configs would help: +If you encounter out of memory issues with HBM less than 32GB, enable the following configs would help: -- actor_rollout_ref.actor.ppo_micro_batch_size=1 \ - -- critic.ppo_micro_batch_size=1 \ - -- actor_rollout_ref.actor.fsdp_config.optimizer_offload=False \ +.. code-block:: bash -- critic.model.fsdp_config.optimizer_offload=False \ + actor_rollout_ref.actor.ppo_micro_batch_size=1 \ + critic.ppo_micro_batch_size=1 \ + actor_rollout_ref.actor.fsdp_config.optimizer_offload=True \ + critic.model.fsdp_config.optimizer_offload=True \ For the full set of configs, please refer to :ref:`config-explain-page` for detailed explaination and performance tuning. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..84192f1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,78 @@ +# ------------------------------- +# build-system +# ------------------------------- +[build-system] +requires = [ + "setuptools>=61.0", + "wheel" +] +build-backend = "setuptools.build_meta" + +# ------------------------------- +# project (PEP 621 metadata) +# ------------------------------- +[project] +name = "verl" +# We'll mark the version as "dynamic" because it's read from the file "verl/version/version" +# (PEP 621 calls this "dynamic version"). +# The actual version is specified in the [tool.setuptools.dynamic] section below. +dynamic = ["version"] + +description = "veRL: Volcano Engine Reinforcement Learning for LLM" +license = {file = "LICENSE"} # or "Apache-2.0", if you prefer an SPDX identifier +readme = {file = "README.md", content-type = "text/markdown"} +requires-python = ">=3.8" + +authors = [ + { name = "Bytedance - Seed - MLSys", email = "zhangchi.usc1992@bytedance.com" }, + { name = "Bytedance - Seed - MLSys", email = "gmsheng@connect.hku.hk" }, +] + +# Dependencies corresponding to install_requires in setup.py +dependencies = [ + "accelerate", + "codetiming", + "datasets", + "dill", + "hydra-core", + "numpy", + "pybind11", + "ray==2.10", + "tensordict", + "transformers", + "vllm<=0.6.3", +] + +# Optional dependencies (extras_require in setup.py) +[project.optional-dependencies] +test = [ + "pytest", "yapf" +] + +# URLs +[project.urls] +Homepage = "https://github.com/volcengine/verl" + +# ------------------------------- +# tool.setuptools - Additional config +# ------------------------------- +[tool.setuptools] +# True means `setuptools` will attempt to include all relevant files in package_data automatically. +# This corresponds to `include_package_data=True` in setup.py. +include-package-data = true + +# We read the version from a file in 'verl/version/version' +[tool.setuptools.dynamic] +version = {file = "verl/version/version"} + +# If you need to mimic `package_dir={'': '.'}`: +[tool.setuptools.package-dir] +"" = "." + +# If you need to include specific non-Python data (like YAML files or version file): +# This is the rough equivalent of package_data={'': ['version/*'], 'verl': ['trainer/config/*.yaml']} +[tool.setuptools.package-data] +verl = [ + "version/*", + "trainer/config/*.yaml" +] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index c2cb2dc..1167ba1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,3 @@ -# vllm==0.6.3 # vllm is installed in image building to avoid ray conflicts -# TODO: add version info to requirements accelerate codetiming datasets @@ -8,5 +6,6 @@ hydra-core numpy pybind11 ray==2.10 -tensordict < 0.6 +tensordict<0.6 transformers +vllm<=0.6.3 \ No newline at end of file diff --git a/setup.py b/setup.py index 8954ef2..9aab68a 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +# setup.py is the fallback installation script when pyproject.toml does not work from setuptools import setup, find_packages import os @@ -25,14 +26,8 @@ required = f.read().splitlines() install_requires = [item.strip() for item in required if item.strip()[0] != '#'] -install_optional = [ - 'vllm==0.6.3', - 'torch==2.4.0', # required by vllm -] - extras_require = { - 'single-controller': ['ray', 'kubernetes'], - 'test': ['pytest'] + 'test': ['pytest', 'yapf'] } from pathlib import Path @@ -56,4 +51,4 @@ include_package_data=True, long_description=long_description, long_description_content_type='text/markdown' -) +) \ No newline at end of file