Skip to content

Commit

Permalink
Merge pull request #5 from openpsi-project/opensource
Browse files Browse the repository at this point in the history
Testing before open-source
  • Loading branch information
garrett4wade authored Jun 20, 2024
2 parents 820b586 + 1c0e66a commit a6daf41
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 7 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Python Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Specify the Python version you need

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
- name: Build package
run: python3 -m build -n --sdist

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PIP_TOKEN }}
run: |
python3 -m pip install twine
twine upload dist/*
17 changes: 16 additions & 1 deletion docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,22 @@ If you prefer not to use Docker, you can also install ReaL from PyPI or from the

We don't upload a pre-built wheel to PyPI, so the installation will require compiling the C++ and CUDA extensions. If CUDA is not available on your machine, only the C++ extension will be installed.

Install from PyPI:
First, clone the repository and install all dependencies:

.. code-block:: console
$ git clone https://github.com/openpsi-project/ReaLHF
$ cd ReaLHF
$ python3 -m pip install -r requirements.txt
On a GPU machine, also install the requirement CUDA runtime packages:

.. code-block:: console
$ python3 -m pip install git+https://github.com/NVIDIA/[email protected] --no-deps
$ python3 -m pip install flash_attn --no-build-isolation
Install ReaLHF from PyPI:

.. code-block:: console
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "realhf"
description = "ReaL: Efficient RLHF Training of Large Language Models with Parameter Reallocation"
readme = "README.md"
requires-python = ">=3.10"
requires-python = ">=3.10,<3.12"
dynamic = ["version"]
authors = [
{ name = "Zhiyu Mei", email = "[email protected]" },
Expand Down
2 changes: 1 addition & 1 deletion realhf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
OptimizerConfig,
ParallelismConfig,
)
from .base.namedarray import NamedArray
from .experiments.common.common import CommonExperimentConfig
from .experiments.common.dpo_exp import DPOConfig
from .experiments.common.ppo_exp import PPOConfig, PPOHyperparameters
from .experiments.common.rw_exp import RWConfig
from .experiments.common.sft_exp import SFTConfig
from .base.namedarray import NamedArray

__version__ = "0.1.0"
4 changes: 0 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ def get_torch_arch_list() -> Set[str]:
with contextlib.suppress(ValueError):
torch_cpp_ext.COMMON_NVCC_FLAGS.remove(flag)

with open("requirements.txt", "r") as f:
dependencies = f.read().splitlines()

os.makedirs(os.path.join(ROOT_DIR, "realhf", "_C"), exist_ok=True)
if _is_cuda():
cr_extension = CUDAExtension(
Expand Down Expand Up @@ -291,5 +288,4 @@ def get_torch_arch_list() -> Set[str]:
ext_modules=ext_modules,
cmdclass={"build_ext": BuildExtension},
packages=setuptools.find_packages(),
install_requires=dependencies,
)

0 comments on commit a6daf41

Please sign in to comment.