From 9462a1bf7903bd25b212722b7399ad5cefe9cb1a Mon Sep 17 00:00:00 2001 From: Dan Saunders Date: Fri, 29 Aug 2025 16:54:27 -0400 Subject: [PATCH] wip --- README.md | 3 + pyproject.toml | 226 ++++++++++++++++++++++++++++++++++++++++++++++- requirements.txt | 14 ++- setup.py | 18 ++-- 4 files changed, 252 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8402a27f3..8ff5e361f 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,9 @@ Features: # Install uv curl -LsSf https://astral.sh/uv/install.sh | sh +# Create virtualenv +uv venv + # Install axolotl uv pip install --no-build-isolation axolotl[flash-attn,deepspeed] diff --git a/pyproject.toml b/pyproject.toml index f851dab45..065a375ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,225 @@ [build-system] -requires = ["setuptools>=64", "wheel", "setuptools_scm>=8", "packaging==23.2"] +requires = ["setuptools>=64", "wheel", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" +[project] +name = "axolotl" +version = "0.13.0.dev" +description = "LLM Trainer" +readme = "README.md" +requires-python = ">=3.10" +license = {text = "Apache-2.0"} +authors = [ + {name = "Axolotl AI"}, +] +maintainers = [ + {name = "Axolotl AI"}, +] +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] + +dependencies = [ + # Core dependencies + "torch>=2.6.0", # Minimum 2.6.0, preference for latest stable (2.8.0) + "packaging==23.2", + "huggingface_hub>=0.33.0", + "peft==0.17.0", + "transformers==4.55.2", + "tokenizers>=0.21.1", + "accelerate==1.10.0", + "datasets==4.0.0", + "trl==0.21.0", + "hf_xet==1.1.5", + "kernels==0.9.0", + "trackio", + + # Optimization and training + "optimum==1.16.2", + "hf_transfer", + "sentencepiece", + "gradio==5.41.1", + + # Infrastructure + "modal==1.0.2", + "pydantic==2.10.6", + "addict", + "fire", + "PyYAML>=6.0", + "requests", + "wandb", + "einops", + "colorama", + "numba", + "numpy>=1.24.4,<=2.0.1", + + # QLora dependencies + "evaluate==0.4.1", + "scipy", + "scikit-learn>=1.4.2", + "nvidia-ml-py==12.560.30", + "art", + "tensorboard", + "python-dotenv==1.0.1", + + # Remote filesystems + "s3fs>=2024.5.0", + "gcsfs>=2024.5.0", + "adlfs>=2024.5.0", + "ocifs==1.3.2", + + # Other utilities + "zstandard>=0.23.0", # Updated for Python 3.13 compatibility + "fastcore", + + # LM eval harness + "lm_eval==0.4.7", + "langdetect==1.0.9", + "immutabledict==4.2.0", + "antlr4-python3-runtime==4.13.2", + + # Training optimizers + "schedulefree==1.4.1", + + # Axolotl contribs + "axolotl-contribs-lgpl==0.0.6", + "axolotl-contribs-mit==0.0.5", + + # Mistral + "mistral-common==1.8.3", +] + +[project.optional-dependencies] +# Platform-specific dependencies (Linux only) +linux = [ + "bitsandbytes==0.47.0", + "triton>=3.0.0,<3.4.0", + "xformers>=0.0.23.post1", + "autoawq==0.2.7.post3", + "liger-kernel==0.6.1", + "torchao==0.12.0", +] + +# Specific hardware acceleration +flash-attn = [ + "flash-attn==2.8.2", +] + +ring-flash-attn = [ + "flash-attn==2.8.2", + "ring-flash-attn>=0.1.7", + "yunchang==0.6.0", +] + +# Deep learning frameworks +deepspeed = [ + "deepspeed>=0.17.0", # Allow newer versions + "deepspeed-kernels", +] + +mamba-ssm = [ + "mamba-ssm>=2.2.0", # Updated to latest stable version + "causal_conv1d>=1.4.0", +] + +# Quantization +auto-gptq = [ + "auto-gptq==0.5.1", +] + +# Experiment tracking +mlflow = [ + "mlflow", +] + +# Optimizers +galore = [ + "galore_torch", +] + +apollo = [ + "apollo-torch", +] + +optimizers = [ + "galore_torch", + "apollo-torch", + "lomo-optim==0.1.1", + "torch-optimi==0.2.1", + "came_pytorch==0.1.3", +] + +# Distributed training +ray = [ + "ray[train]", +] + +# Inference (Note: vllm and llmcompressor have conflicting dependencies, install separately) +vllm = [ + "vllm>=0.10.0", +] + +llmcompressor = [ + "llmcompressor>=0.5.1", +] + +# Development dependencies +dev = [ + "pytest", + "pytest-cov", + "pytest-xdist", + "pre-commit", + "ruff", + "mypy", +] + +[project.scripts] +axolotl = "axolotl.cli.main:main" + +[project.urls] +Homepage = "https://axolotl.ai/" +Documentation = "https://docs.axolotl.ai/" +Repository = "https://github.com/axolotl-ai-cloud/axolotl.git" +Issues = "https://github.com/axolotl-ai-cloud/axolotl/issues" + +[tool.setuptools] +package-dir = {"" = "src"} +include-package-data = true + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.package-data] +"*" = ["*.yaml", "*.yml", "*.json"] + +[tool.setuptools_scm] +write_to = "src/axolotl/_version.py" + +[tool.ruff] +line-length = 88 +target-version = "py310" + +[tool.ruff.lint] +select = ["E", "F", "I", "W"] +ignore = ["E501"] + +[tool.mypy] +python_version = "3.10" +warn_return_any = true +warn_unused_configs = true +ignore_missing_imports = true + +[tool.pytest.ini_options] +testpaths = ["tests"] +python_files = ["test_*.py", "*_test.py"] +addopts = "-v --tb=short" + +# UV specific configuration [tool.uv] dev-dependencies = [ "pytest", @@ -12,14 +230,17 @@ dev-dependencies = [ "mypy", ] +# UV custom index for specific packages [[tool.uv.index]] url = "https://huggingface.github.io/autogptq-index/whl/cu118/" +# Build dependencies for packages that don't declare them properly [tool.uv.extra-build-dependencies] mamba-ssm = ["torch", "causal_conv1d"] flash-attn = ["torch", "packaging", "wheel", "setuptools"] autoawq = ["torch"] triton = ["torch"] +<<<<<<< HEAD bitsandbytes = ["torch"] [project] @@ -77,3 +298,6 @@ indent-style = "space" skip-magic-trailing-comma = false line-ending = "auto" docstring-code-format = false +======= +bitsandbytes = ["torch"] +>>>>>>> 01544ca0 (wip) diff --git a/requirements.txt b/requirements.txt index 86013374f..b07362b19 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,13 @@ ---extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ +# This file is kept for backward compatibility +# All dependencies are now defined in pyproject.toml +# To install axolotl with all dependencies, run: +# pip install . +# To install with extras (e.g., flash-attn): +# pip install .[flash-attn] +# To install for development: +# pip install -e .[dev] +<<<<<<< HEAD # START section of dependencies that don't install on Darwin/MacOS bitsandbytes==0.47.0 triton>=3.0.0 @@ -71,3 +79,7 @@ axolotl-contribs-lgpl==0.0.6 axolotl-contribs-mit==0.0.5 mistral-common==1.8.5 + +# For UV users: +# uv pip install . +# uv pip install -e .[dev] diff --git a/setup.py b/setup.py index 3e642b57f..35c5130b0 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,12 @@ -"""setup.py for axolotl""" +#!/usr/bin/env python +""" +Minimal setup.py for backward compatibility. +All configuration is now in pyproject.toml. +""" -import ast -import os -import platform -import re -from importlib.metadata import PackageNotFoundError, version -from pathlib import Path +from setuptools import setup +<<<<<<< HEAD from setuptools import find_packages, setup @@ -180,3 +180,7 @@ setup( }, extras_require=extras_require_build, ) +======= +if __name__ == "__main__": + setup() +>>>>>>> 01544ca0 (wip)