Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
93 changes: 92 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,95 @@ tensorboard_log/
*.db

# uv lock files
uv.lock
uv.lock

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
uv.lock

# PyInstaller
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Jupyter Notebook
.ipynb_checkpoints

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# MkDocs build output
site/

# IDEs and editors
.idea/
.vscode/

# OS generated files
.DS_Store
Thumbs.db

# Hydra outputs
outputs/

# Local artifacts
tinker.db
uv.lock

# Alembic - don't track pycache
tx/tinker/alembic/__pycache__/

# SQLite databases (tracked in git by default, but ignore if created locally)
*.db
*.db-journal
*.db-wal
*.db-shm
Comment on lines +51 to +140
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block adds many standard Python .gitignore entries, which is great. However, there are a few duplicated entries that should be removed to keep the file clean:

  • uv.lock is defined on line 49, but also on lines 79 and 131.
  • *.db is defined on line 46, but also on line 137.

Please remove the redundant entries on lines 79, 131, and 137.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
248 changes: 241 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,247 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
include = ["skyrl*"]

[project]
name = "skyrl"
version = "0.1.0"
description = "A Post-Training Stack for LLMs"
authors = [
{ name = "NovaSkyAI Team"}
]
license = { text = "MIT" }
dynamic = ["version"]
description = "Unified API for training and inference"
readme = "README.md"
requires-python = "==3.12.*"
requires-python = ">=3.11"
dependencies = [
"datasets>=4.0.0",
"pillow>=11.3.0",
"rich>=14.1.0",
"safetensors>=0.6.2",
"tokenizers>=0.21.2",
"transformers>=4.56.1,<5",
"typer>=0.17.4",
# "wandb>=0.22.0",
"peft",
"hf_transfer",
"cloudpathlib>=0.23.0",
]

[project.optional-dependencies]
gpu = [
"jax[cuda12]>=0.7.2; sys_platform == 'linux'",
]

tpu = [
"jax[tpu]>=0.7.2; sys_platform == 'linux'",
]

tinker = [
"tinker>=0.3.0",
"fastapi[standard]",
"sqlmodel",
"sqlalchemy[asyncio]",
"aiosqlite",
"asyncpg",
"psycopg2-binary",
]

aws = [
"cloudpathlib[s3]",
]

gcp = [
"cloudpathlib[gs]",
]

azure = [
"cloudpathlib[azure]",
]

# The extras "jax", "fsdp", and "megatron" are the dependencies the
# engine needs for --backend="jax", --backend="fsdp", and --backend="megatron",
# respectively.

jax = [
"jax>=0.8,<1.0",
"jax[cuda12]>=0.7.2; sys_platform == 'linux'",
"flax>=0.12.2",
"optax>=0.2.5",
]

skyrl-train = [
"loguru",
"tqdm",
"ninja",
"tensorboard",
"func_timeout",
"transformers>=4.51.0",
"hydra-core==1.3.2",
"accelerate",
"torchdata",
"omegaconf",
"ray==2.51.1",
"peft",
"debugpy==1.8.0",
"hf_transfer",
"wandb",
"datasets>=4.0.0",
"tensordict",
"jaxtyping",
"skyrl-gym",
"flash-attn; sys_platform == 'linux'",
"polars",
"s3fs",
"fastapi",
"uvicorn",
"pybind11",
"setuptools",
]

fsdp = [
"skyrl[skyrl-train]",
"vllm==0.13.0; sys_platform == 'linux'",
"flash-attn==2.8.3; sys_platform == 'linux'",
"torch==2.9.0; sys_platform == 'linux'",
"flashinfer-python; sys_platform == 'linux' and platform_machine == 'x86_64'",
"flashinfer-jit-cache==0.5.3; sys_platform == 'linux' and platform_machine == 'x86_64'",
"torchvision; sys_platform == 'linux'",
]

# megatron is pinned to python 3.12 due to ml-dtypes needing to be >= 0.5.0
# potentially loosen this restriction if this error can be root caused.
megatron = [
"skyrl[skyrl-train]; python_version == '3.12'",
"transformer-engine[pytorch]==2.10.0; sys_platform == 'linux' and python_version == '3.12'",
"flash-attn==2.8.1; sys_platform == 'linux' and python_version == '3.12'",
"vllm==0.13.0; sys_platform == 'linux' and python_version == '3.12'",
"torch==2.9.0; sys_platform == 'linux' and python_version == '3.12'",
"flashinfer-python==0.5.3; sys_platform == 'linux' and platform_machine == 'x86_64' and python_version == '3.12'",
"torchvision; sys_platform == 'linux' and python_version == '3.12'",
"megatron-bridge; sys_platform == 'linux' and python_version == '3.12'",
"megatron-core==0.15.0; sys_platform == 'linux' and python_version == '3.12'",
"flashinfer-jit-cache==0.5.3; sys_platform == 'linux' and platform_machine == 'x86_64' and python_version == '3.12'",
"nvidia-modelopt; sys_platform == 'linux' and python_version == '3.12'",
]
Comment on lines +111 to +123
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Pinning the entire megatron extra to python_version == '3.12' is quite restrictive. It prevents users on other Python versions (like 3.11, which is supported by the project) from installing and using this functionality. The comment mentions this is due to ml-dtypes. Have you considered addressing the dependency conflict more granularly, for example by using an override for ml-dtypes in [tool.uv.override-dependencies]? This would make the project more flexible for users on different Python versions.


flashrl = [
"skyrl[skyrl-train]",
# NOTE: Custom vLLM wheel must be installed separately.
# See examples/flash_rl/README.md for installation instructions.
"flash-attn==2.8.3; sys_platform == 'linux'",
"torch==2.7.0; sys_platform == 'linux'",
"flashinfer-python; sys_platform == 'linux'",
"torchvision; sys_platform == 'linux'",
]
miniswe = [
"skyrl[skyrl-train]",
# NOTE (sumanthrh): Needs to be a commit after https://github.com/SWE-agent/mini-swe-agent/commit/4f5d445e99d13b5482478c23508bf2fbf7c0670c
"mini-swe-agent>=1.12.0",
"litellm",
]

dev = [
"mkdocs",
"mkdocs-material",
"pytest",
"pytest-forked",
"pytest-asyncio",
"pre-commit",
"litellm",
"torch",
"ty",
"cloudpathlib[s3]",
"alembic",
]

[tool.setuptools]
include-package-data = true

[tool.setuptools.dynamic]
version = {attr = "skyrl.__version__"}

[project.scripts]
# The following is for supporting the skyrl-train dependency
Comment on lines +161 to +162
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The [project.scripts] section is empty, and the accompanying comment "# The following is for supporting the skyrl-train dependency" is a bit unclear. If there are no scripts to be installed, it would be cleaner to remove this section entirely. If it's a placeholder for future use, a more descriptive comment explaining its purpose would be helpful for future maintainers.


[tool.uv]
# Resolve for both Linux (production) and macOS (dev)
required-environments = [
"sys_platform == 'linux'",
"sys_platform == 'darwin' and platform_machine == 'arm64'",
]

constraint-dependencies = [
"flashinfer-jit-cache==0.5.3",
]
# each backend should have separate dependencies that can potentially clash
# megatron also clashes with the jax dependency from gpu and tpu extras
conflicts = [
[
{ extra = "jax" },
{ extra = "megatron" },
{ extra = "fsdp" },
{ extra = "flashrl" },
],
[
{ extra = "megatron" },
{ extra = "gpu" },
{ extra = "tpu" },
{ extra = "flashrl" },
{ extra = "miniswe" },
]
]
# disable build isolation for megatron related dependencies
no-build-isolation-package = [
"transformer-engine-torch",
"transformer-engine",
"nv-grouped-gemm",
]
# override unnecessary dependencies and pin versions to override Megatron-Bridge
# unppinned dependencies
override-dependencies = [
"nvidia-resiliency-ext; sys_platform == 'never'",
"mamba-ssm; sys_platform == 'never'",
"causal-conv1d; sys_platform == 'never'",
"transformer-engine[pytorch]==2.10.0; sys_platform == 'linux'",
"megatron-core==0.15.0; sys_platform == 'linux'",
]

[tool.uv.extra-build-dependencies]
flash-attn = [{requirement = "torch", match-runtime = true}]
transformer-engine = [{requirement = "torch", match-runtime = true}, "build_tools", "ninja"]
transformer-engine-torch = [{requirement = "torch", match-runtime = true}, "build_tools", "ninja"]

[tool.uv.extra-build-variables]
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Setting FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" is concerning. This will likely prevent flash-attn's CUDA extensions from being built, causing it to fall back to a much slower pure Python implementation and negating its performance benefits. If the goal is to use pre-built wheels, that should be configured through [tool.uv.sources] or by pinning to a specific wheel URL. Could you clarify the reasoning for this build variable? Without the CUDA extensions, there could be a significant performance regression.


[[tool.uv.index]]
name = "pytorch-cu128"
url = "https://download.pytorch.org/whl/cu128"
explicit = true

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[[tool.uv.index]]
name = "flashinfer-cu128"
url = "https://flashinfer.ai/whl/cu128"
explicit = true

[tool.uv.sources]
skyrl-gym = { path = "./skyrl-gym", editable = true }
# flashinfer wheels are only available from the custom cu128 index
flashinfer-jit-cache = { index = "flashinfer-cu128", marker = "sys_platform == 'linux'" }
# Use CUDA torch on Linux, CPU torch on macOS (must match skyrl-train config)
torch = [
{ index = "pytorch-cu128", marker = "sys_platform == 'linux'" },
{ index = "pytorch-cpu", marker = "sys_platform == 'darwin'" },
]
torchvision = [
{ index = "pytorch-cu128", marker = "sys_platform == 'linux'" },
{ index = "pytorch-cpu", marker = "sys_platform == 'darwin'" },
]
# pin megatron bridge commit to fix for MoE + LoRA merging. Update this when an official release is cut
megatron-bridge = {git = "https://github.com/NVIDIA-NeMo/Megatron-Bridge", rev = "04e370eedf8cc44a812189a19f2171d90555c07a", marker = "sys_platform == 'linux'"}

[tool.black]
line-length = 120
Expand Down
3 changes: 0 additions & 3 deletions skyrl-train/.env.example

This file was deleted.

3 changes: 0 additions & 3 deletions skyrl-train/.env.llm_judge

This file was deleted.

10 changes: 0 additions & 10 deletions skyrl-train/.gitignore

This file was deleted.

Loading
Loading