Skip to content

Commit

Permalink
[install] chore: add pyproject.toml. make vllm default dependency (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-haibin-lin authored Dec 23, 2024
1 parent d46eb7d commit 86fa600
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 20 deletions.
17 changes: 8 additions & 9 deletions docs/start/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:

Expand All @@ -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.

Expand Down
78 changes: 78 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]" },
{ name = "Bytedance - Seed - MLSys", email = "[email protected]" },
]

# 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"
]
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -8,5 +6,6 @@ hydra-core
numpy
pybind11
ray==2.10
tensordict < 0.6
tensordict<0.6
transformers
vllm<=0.6.3
11 changes: 3 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -56,4 +51,4 @@
include_package_data=True,
long_description=long_description,
long_description_content_type='text/markdown'
)
)

0 comments on commit 86fa600

Please sign in to comment.