xaytune 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xaytune-0.6.0/.github/workflows/ci.yml +41 -0
- xaytune-0.6.0/.github/workflows/docs.yml +52 -0
- xaytune-0.6.0/.github/workflows/publish.yml +66 -0
- xaytune-0.6.0/.gitignore +26 -0
- xaytune-0.6.0/.python-version +1 -0
- xaytune-0.6.0/CHANGELOG.md +54 -0
- xaytune-0.6.0/PKG-INFO +284 -0
- xaytune-0.6.0/README.md +224 -0
- xaytune-0.6.0/configs/examples/dpo_align.yaml +28 -0
- xaytune-0.6.0/configs/examples/full_finetune.yaml +26 -0
- xaytune-0.6.0/configs/examples/grpo_align.yaml +28 -0
- xaytune-0.6.0/configs/examples/lora_finetune.yaml +24 -0
- xaytune-0.6.0/configs/examples/orpo_align.yaml +28 -0
- xaytune-0.6.0/configs/examples/ppo_align.yaml +28 -0
- xaytune-0.6.0/configs/examples/pretrain.yaml +28 -0
- xaytune-0.6.0/configs/examples/qlora_finetune.yaml +25 -0
- xaytune-0.6.0/configs/examples/reinforce_align.yaml +25 -0
- xaytune-0.6.0/configs/examples/simpo_align.yaml +29 -0
- xaytune-0.6.0/docs/api/alignment.md +64 -0
- xaytune-0.6.0/docs/api/callbacks.md +112 -0
- xaytune-0.6.0/docs/api/config.md +239 -0
- xaytune-0.6.0/docs/api/data.md +59 -0
- xaytune-0.6.0/docs/api/evaluation.md +165 -0
- xaytune-0.6.0/docs/api/export.md +185 -0
- xaytune-0.6.0/docs/api/index.md +79 -0
- xaytune-0.6.0/docs/api/recipes.md +33 -0
- xaytune-0.6.0/docs/api/trainer.md +51 -0
- xaytune-0.6.0/docs/assets/logo.png +0 -0
- xaytune-0.6.0/docs/cli.md +207 -0
- xaytune-0.6.0/docs/comparison.md +169 -0
- xaytune-0.6.0/docs/examples.md +120 -0
- xaytune-0.6.0/docs/extensibility.md +205 -0
- xaytune-0.6.0/docs/getting-started.md +166 -0
- xaytune-0.6.0/docs/index.md +61 -0
- xaytune-0.6.0/docs/recipes/alignment.md +186 -0
- xaytune-0.6.0/docs/recipes/finetuning.md +201 -0
- xaytune-0.6.0/docs/recipes/index.md +98 -0
- xaytune-0.6.0/docs/recipes/pretraining.md +118 -0
- xaytune-0.6.0/examples/01_quickstart.ipynb +101 -0
- xaytune-0.6.0/examples/02_finetuning.ipynb +273 -0
- xaytune-0.6.0/examples/03_pretraining.ipynb +211 -0
- xaytune-0.6.0/examples/04_alignment.ipynb +338 -0
- xaytune-0.6.0/examples/05_evaluation.ipynb +254 -0
- xaytune-0.6.0/examples/06_advanced.ipynb +421 -0
- xaytune-0.6.0/examples/end_to_end.py +578 -0
- xaytune-0.6.0/mkdocs.yml +107 -0
- xaytune-0.6.0/pyproject.toml +94 -0
- xaytune-0.6.0/tests/__init__.py +1 -0
- xaytune-0.6.0/tests/conftest.py +14 -0
- xaytune-0.6.0/tests/test_activation_async_integration.py +228 -0
- xaytune-0.6.0/tests/test_checkpoint_resume_integration.py +254 -0
- xaytune-0.6.0/tests/test_cli.py +482 -0
- xaytune-0.6.0/tests/test_config/__init__.py +1 -0
- xaytune-0.6.0/tests/test_config/fixtures/base_lora.yaml +15 -0
- xaytune-0.6.0/tests/test_config/fixtures/child_config.yaml +11 -0
- xaytune-0.6.0/tests/test_config/fixtures/full_config.yaml +18 -0
- xaytune-0.6.0/tests/test_config/test_defaults.py +36 -0
- xaytune-0.6.0/tests/test_config/test_parser.py +94 -0
- xaytune-0.6.0/tests/test_config/test_schema.py +309 -0
- xaytune-0.6.0/tests/test_config/test_validation.py +202 -0
- xaytune-0.6.0/tests/test_data/__init__.py +1 -0
- xaytune-0.6.0/tests/test_data/test_formats.py +139 -0
- xaytune-0.6.0/tests/test_data/test_loader.py +194 -0
- xaytune-0.6.0/tests/test_data/test_packing.py +50 -0
- xaytune-0.6.0/tests/test_data/test_preferences.py +61 -0
- xaytune-0.6.0/tests/test_data/test_streaming.py +99 -0
- xaytune-0.6.0/tests/test_data/test_tokenizer.py +341 -0
- xaytune-0.6.0/tests/test_data/test_validation.py +88 -0
- xaytune-0.6.0/tests/test_distributed_integration.py +282 -0
- xaytune-0.6.0/tests/test_eval/__init__.py +1 -0
- xaytune-0.6.0/tests/test_eval/test_benchmarks.py +139 -0
- xaytune-0.6.0/tests/test_eval/test_evaluate.py +93 -0
- xaytune-0.6.0/tests/test_eval/test_metrics.py +76 -0
- xaytune-0.6.0/tests/test_eval_during_training_integration.py +188 -0
- xaytune-0.6.0/tests/test_example_configs.py +79 -0
- xaytune-0.6.0/tests/test_export/__init__.py +1 -0
- xaytune-0.6.0/tests/test_export/test_gguf.py +79 -0
- xaytune-0.6.0/tests/test_export/test_hub.py +34 -0
- xaytune-0.6.0/tests/test_export/test_merge.py +89 -0
- xaytune-0.6.0/tests/test_integration.py +481 -0
- xaytune-0.6.0/tests/test_logging/__init__.py +0 -0
- xaytune-0.6.0/tests/test_logging/test_base.py +167 -0
- xaytune-0.6.0/tests/test_logging/test_console.py +36 -0
- xaytune-0.6.0/tests/test_logging/test_mlflow.py +69 -0
- xaytune-0.6.0/tests/test_logging/test_setup.py +105 -0
- xaytune-0.6.0/tests/test_logging/test_tensorboard.py +79 -0
- xaytune-0.6.0/tests/test_logging/test_wandb.py +66 -0
- xaytune-0.6.0/tests/test_logging_integration.py +179 -0
- xaytune-0.6.0/tests/test_models/__init__.py +1 -0
- xaytune-0.6.0/tests/test_models/test_loader.py +120 -0
- xaytune-0.6.0/tests/test_models/test_peft.py +76 -0
- xaytune-0.6.0/tests/test_packaging.py +87 -0
- xaytune-0.6.0/tests/test_plugins.py +74 -0
- xaytune-0.6.0/tests/test_real_integration/__init__.py +0 -0
- xaytune-0.6.0/tests/test_real_integration/test_real_model.py +353 -0
- xaytune-0.6.0/tests/test_recipes/__init__.py +1 -0
- xaytune-0.6.0/tests/test_recipes/test_align/__init__.py +1 -0
- xaytune-0.6.0/tests/test_recipes/test_align/test_align.py +185 -0
- xaytune-0.6.0/tests/test_recipes/test_align/test_dpo.py +107 -0
- xaytune-0.6.0/tests/test_recipes/test_align/test_grpo.py +107 -0
- xaytune-0.6.0/tests/test_recipes/test_align/test_init.py +58 -0
- xaytune-0.6.0/tests/test_recipes/test_align/test_logprobs.py +72 -0
- xaytune-0.6.0/tests/test_recipes/test_align/test_loss_dispatch.py +112 -0
- xaytune-0.6.0/tests/test_recipes/test_align/test_orpo.py +104 -0
- xaytune-0.6.0/tests/test_recipes/test_align/test_ppo.py +161 -0
- xaytune-0.6.0/tests/test_recipes/test_align/test_rewards.py +114 -0
- xaytune-0.6.0/tests/test_recipes/test_align/test_simpo.py +142 -0
- xaytune-0.6.0/tests/test_recipes/test_base.py +721 -0
- xaytune-0.6.0/tests/test_recipes/test_finetune.py +100 -0
- xaytune-0.6.0/tests/test_recipes/test_init.py +22 -0
- xaytune-0.6.0/tests/test_recipes/test_pretrain.py +95 -0
- xaytune-0.6.0/tests/test_scheduler_integration.py +189 -0
- xaytune-0.6.0/tests/test_studio/__init__.py +0 -0
- xaytune-0.6.0/tests/test_studio/test_app.py +448 -0
- xaytune-0.6.0/tests/test_studio/test_events.py +104 -0
- xaytune-0.6.0/tests/test_studio/test_jobs.py +170 -0
- xaytune-0.6.0/tests/test_top_level_api.py +44 -0
- xaytune-0.6.0/tests/test_trainer/__init__.py +0 -0
- xaytune-0.6.0/tests/test_trainer/test_async_checkpoint.py +153 -0
- xaytune-0.6.0/tests/test_trainer/test_callbacks.py +162 -0
- xaytune-0.6.0/tests/test_trainer/test_checkpoint_callback.py +308 -0
- xaytune-0.6.0/tests/test_trainer/test_checkpointing.py +243 -0
- xaytune-0.6.0/tests/test_trainer/test_device.py +135 -0
- xaytune-0.6.0/tests/test_trainer/test_distributed.py +252 -0
- xaytune-0.6.0/tests/test_trainer/test_early_stopping.py +132 -0
- xaytune-0.6.0/tests/test_trainer/test_eval_callback.py +251 -0
- xaytune-0.6.0/tests/test_trainer/test_init.py +45 -0
- xaytune-0.6.0/tests/test_trainer/test_loop.py +517 -0
- xaytune-0.6.0/tests/test_trainer/test_lr_finder.py +117 -0
- xaytune-0.6.0/tests/test_trainer/test_progress.py +100 -0
- xaytune-0.6.0/tests/test_trainer/test_scheduler.py +119 -0
- xaytune-0.6.0/tests/test_utils/__init__.py +1 -0
- xaytune-0.6.0/tests/test_utils/test_registry.py +74 -0
- xaytune-0.6.0/uv.lock +5975 -0
- xaytune-0.6.0/xaytune/__init__.py +23 -0
- xaytune-0.6.0/xaytune/__main__.py +3 -0
- xaytune-0.6.0/xaytune/cli.py +447 -0
- xaytune-0.6.0/xaytune/config/__init__.py +42 -0
- xaytune-0.6.0/xaytune/config/defaults/full_finetune.yaml +15 -0
- xaytune-0.6.0/xaytune/config/defaults/lora.yaml +21 -0
- xaytune-0.6.0/xaytune/config/defaults/pretrain.yaml +22 -0
- xaytune-0.6.0/xaytune/config/defaults/qlora.yaml +24 -0
- xaytune-0.6.0/xaytune/config/parser.py +101 -0
- xaytune-0.6.0/xaytune/config/schema.py +293 -0
- xaytune-0.6.0/xaytune/config/validation.py +150 -0
- xaytune-0.6.0/xaytune/data/__init__.py +34 -0
- xaytune-0.6.0/xaytune/data/formats.py +79 -0
- xaytune-0.6.0/xaytune/data/loader.py +112 -0
- xaytune-0.6.0/xaytune/data/packing.py +70 -0
- xaytune-0.6.0/xaytune/data/preferences.py +64 -0
- xaytune-0.6.0/xaytune/data/registry.py +3 -0
- xaytune-0.6.0/xaytune/data/tokenizer.py +300 -0
- xaytune-0.6.0/xaytune/data/validation.py +84 -0
- xaytune-0.6.0/xaytune/eval/__init__.py +5 -0
- xaytune-0.6.0/xaytune/eval/benchmarks.py +47 -0
- xaytune-0.6.0/xaytune/eval/evaluate.py +57 -0
- xaytune-0.6.0/xaytune/eval/metrics.py +41 -0
- xaytune-0.6.0/xaytune/export/__init__.py +5 -0
- xaytune-0.6.0/xaytune/export/gguf.py +45 -0
- xaytune-0.6.0/xaytune/export/hub.py +38 -0
- xaytune-0.6.0/xaytune/export/merge.py +58 -0
- xaytune-0.6.0/xaytune/logging/__init__.py +68 -0
- xaytune-0.6.0/xaytune/logging/base.py +56 -0
- xaytune-0.6.0/xaytune/logging/console.py +18 -0
- xaytune-0.6.0/xaytune/logging/mlflow.py +21 -0
- xaytune-0.6.0/xaytune/logging/tensorboard.py +22 -0
- xaytune-0.6.0/xaytune/logging/wandb.py +25 -0
- xaytune-0.6.0/xaytune/models/__init__.py +14 -0
- xaytune-0.6.0/xaytune/models/loader.py +90 -0
- xaytune-0.6.0/xaytune/models/peft.py +54 -0
- xaytune-0.6.0/xaytune/models/registry.py +3 -0
- xaytune-0.6.0/xaytune/plugins.py +66 -0
- xaytune-0.6.0/xaytune/py.typed +0 -0
- xaytune-0.6.0/xaytune/recipes/__init__.py +12 -0
- xaytune-0.6.0/xaytune/recipes/align/__init__.py +35 -0
- xaytune-0.6.0/xaytune/recipes/align/align.py +144 -0
- xaytune-0.6.0/xaytune/recipes/align/dpo.py +21 -0
- xaytune-0.6.0/xaytune/recipes/align/grpo.py +32 -0
- xaytune-0.6.0/xaytune/recipes/align/logprobs.py +40 -0
- xaytune-0.6.0/xaytune/recipes/align/loss_dispatch.py +238 -0
- xaytune-0.6.0/xaytune/recipes/align/orpo.py +22 -0
- xaytune-0.6.0/xaytune/recipes/align/ppo.py +37 -0
- xaytune-0.6.0/xaytune/recipes/align/rewards.py +62 -0
- xaytune-0.6.0/xaytune/recipes/align/simpo.py +22 -0
- xaytune-0.6.0/xaytune/recipes/base.py +434 -0
- xaytune-0.6.0/xaytune/recipes/finetune.py +116 -0
- xaytune-0.6.0/xaytune/recipes/pretrain.py +108 -0
- xaytune-0.6.0/xaytune/studio/__init__.py +11 -0
- xaytune-0.6.0/xaytune/studio/app.py +988 -0
- xaytune-0.6.0/xaytune/studio/events.py +77 -0
- xaytune-0.6.0/xaytune/studio/jobs.py +142 -0
- xaytune-0.6.0/xaytune/studio/server.py +20 -0
- xaytune-0.6.0/xaytune/trainer/__init__.py +47 -0
- xaytune-0.6.0/xaytune/trainer/async_checkpoint.py +104 -0
- xaytune-0.6.0/xaytune/trainer/callbacks.py +79 -0
- xaytune-0.6.0/xaytune/trainer/checkpoint_callback.py +75 -0
- xaytune-0.6.0/xaytune/trainer/checkpointing.py +121 -0
- xaytune-0.6.0/xaytune/trainer/device.py +59 -0
- xaytune-0.6.0/xaytune/trainer/distributed.py +213 -0
- xaytune-0.6.0/xaytune/trainer/early_stopping.py +46 -0
- xaytune-0.6.0/xaytune/trainer/eval_callback.py +69 -0
- xaytune-0.6.0/xaytune/trainer/loop.py +245 -0
- xaytune-0.6.0/xaytune/trainer/lr_finder.py +132 -0
- xaytune-0.6.0/xaytune/trainer/progress.py +62 -0
- xaytune-0.6.0/xaytune/trainer/scheduler.py +77 -0
- xaytune-0.6.0/xaytune/utils/__init__.py +3 -0
- xaytune-0.6.0/xaytune/utils/registry.py +40 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: astral-sh/setup-uv@v4
|
|
15
|
+
- run: uvx ruff check .
|
|
16
|
+
- run: uvx ruff format --check .
|
|
17
|
+
|
|
18
|
+
test:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
strategy:
|
|
21
|
+
matrix:
|
|
22
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
- uses: astral-sh/setup-uv@v4
|
|
26
|
+
- uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: ${{ matrix.python-version }}
|
|
29
|
+
- run: uv pip install -e ".[dev]" --system
|
|
30
|
+
- run: python -m pytest tests/ -q --tb=short -m "not slow"
|
|
31
|
+
|
|
32
|
+
type-check:
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v4
|
|
36
|
+
- uses: astral-sh/setup-uv@v4
|
|
37
|
+
- uses: actions/setup-python@v5
|
|
38
|
+
with:
|
|
39
|
+
python-version: "3.12"
|
|
40
|
+
- run: uv pip install -e ".[dev]" --system
|
|
41
|
+
- run: mypy xaytune/ --ignore-missing-imports
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Deploy Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- "docs/**"
|
|
8
|
+
- "mkdocs.yml"
|
|
9
|
+
- "xaytune/**"
|
|
10
|
+
- ".github/workflows/docs.yml"
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
pages: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
concurrency:
|
|
19
|
+
group: pages
|
|
20
|
+
cancel-in-progress: true
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
build:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
|
|
28
|
+
- uses: astral-sh/setup-uv@v4
|
|
29
|
+
|
|
30
|
+
- uses: actions/setup-python@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: "3.12"
|
|
33
|
+
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: uv pip install -e ".[docs]" --system
|
|
36
|
+
|
|
37
|
+
- name: Build docs
|
|
38
|
+
run: mkdocs build --strict
|
|
39
|
+
|
|
40
|
+
- uses: actions/upload-pages-artifact@v3
|
|
41
|
+
with:
|
|
42
|
+
path: site/
|
|
43
|
+
|
|
44
|
+
deploy:
|
|
45
|
+
needs: build
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
environment:
|
|
48
|
+
name: github-pages
|
|
49
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
50
|
+
steps:
|
|
51
|
+
- id: deployment
|
|
52
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: Build distribution
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- uses: astral-sh/setup-uv@v4
|
|
16
|
+
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
|
|
21
|
+
- name: Build sdist and wheel
|
|
22
|
+
run: uv build
|
|
23
|
+
|
|
24
|
+
- name: Upload distribution artifacts
|
|
25
|
+
uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: dist
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
test-publish:
|
|
31
|
+
name: Publish to TestPyPI
|
|
32
|
+
needs: build
|
|
33
|
+
if: github.event_name == 'workflow_dispatch'
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
environment: testpypi
|
|
36
|
+
permissions:
|
|
37
|
+
id-token: write
|
|
38
|
+
steps:
|
|
39
|
+
- name: Download distribution artifacts
|
|
40
|
+
uses: actions/download-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: dist
|
|
43
|
+
path: dist/
|
|
44
|
+
|
|
45
|
+
- name: Publish to TestPyPI
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
47
|
+
with:
|
|
48
|
+
repository-url: https://test.pypi.org/legacy/
|
|
49
|
+
|
|
50
|
+
publish:
|
|
51
|
+
name: Publish to PyPI
|
|
52
|
+
needs: build
|
|
53
|
+
if: github.event_name == 'release'
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
environment: pypi
|
|
56
|
+
permissions:
|
|
57
|
+
id-token: write
|
|
58
|
+
steps:
|
|
59
|
+
- name: Download distribution artifacts
|
|
60
|
+
uses: actions/download-artifact@v4
|
|
61
|
+
with:
|
|
62
|
+
name: dist
|
|
63
|
+
path: dist/
|
|
64
|
+
|
|
65
|
+
- name: Publish to PyPI
|
|
66
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
xaytune-0.6.0/.gitignore
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.eggs/
|
|
9
|
+
*.egg
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
env/
|
|
13
|
+
.env
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.mypy_cache/
|
|
16
|
+
.ruff_cache/
|
|
17
|
+
htmlcov/
|
|
18
|
+
.coverage
|
|
19
|
+
*.log
|
|
20
|
+
output/
|
|
21
|
+
checkpoints/
|
|
22
|
+
wandb/
|
|
23
|
+
runs/
|
|
24
|
+
*.gguf
|
|
25
|
+
site/
|
|
26
|
+
.DS_Store
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v0.3.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **Tokenization pipeline** (`tokenize_dataset()`, `collate_tokenized()`) — automatic tokenization of text-format data before training. Converts `{"text": "..."}` samples to `{"input_ids", "labels", "attention_mask"}` tensors.
|
|
8
|
+
- **Real model integration tests** — end-to-end tests using `sshleifer/tiny-gpt2` covering forward pass, gradient flow, loss decrease, Trainer loop, and eval-during-training.
|
|
9
|
+
- **`@pytest.mark.slow` marker** — integration tests that download models are deselected by default.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- `setup_training()` now auto-tokenizes text-format datasets and uses a proper `collate_fn` for padding/batching.
|
|
14
|
+
- `validate_batch()` now requires `input_ids` — text-only batches are rejected since tokenization is handled upstream.
|
|
15
|
+
|
|
16
|
+
## v0.2.0
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **Algorithm-specific parameters** (`method_params`) — configure DPO beta, GRPO kl_coeff, PPO clip_eps, ORPO lambda_weight, SimPO beta/gamma via config, CLI, Python API, and Studio UI.
|
|
21
|
+
- **Studio Simple/Advanced mode** — toggle between minimal form (recipe, model, data) and full control with all training parameters.
|
|
22
|
+
- **Auto chat template** — tokenizer chat templates are automatically applied for `chat` and `sharegpt` data formats when a tokenizer is available.
|
|
23
|
+
- **Pre-flight validation** (`preflight_check()`) — checks GPU availability, quantization CUDA requirement, data path existence, and output directory writability before training starts.
|
|
24
|
+
- **Dynamic method params in Studio** — selecting an alignment method (DPO, GRPO, etc.) shows its configurable hyperparameters with defaults and descriptions.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- `align()` one-liner now accepts algorithm kwargs directly (e.g., `align(model="m", dataset="d", beta=0.2)`).
|
|
29
|
+
- `build_config()` accepts `method_params` dict for Studio integration.
|
|
30
|
+
- All alignment example configs now include `method_params` with documented defaults.
|
|
31
|
+
- `setup_training()` passes tokenizer to `load_dataset()` for automatic chat template application.
|
|
32
|
+
|
|
33
|
+
## v0.1.0
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- Recipe-based training: `finetune`, `pretrain`, `align` recipes with registry pattern.
|
|
38
|
+
- Alignment methods: DPO, GRPO, PPO, ORPO, SimPO, REINFORCE.
|
|
39
|
+
- Fine-tuning methods: full, LoRA, QLoRA.
|
|
40
|
+
- Pydantic config schema with YAML parsing, dot-notation overrides, and config inheritance.
|
|
41
|
+
- Cross-field config validation with actionable error messages.
|
|
42
|
+
- CLI: `train`, `list`, `eval`, `export` (merge/gguf/push), `compare`, `lr-find`, `studio`, `launch`.
|
|
43
|
+
- Training Studio: Gradio web UI with Train/Monitor/History tabs, live loss plotting.
|
|
44
|
+
- Data pipeline: format registry (alpaca, sharegpt, chat, text), sequence packing, eval splits.
|
|
45
|
+
- Evaluation: metric registry (loss, perplexity), lm-eval-harness benchmark integration.
|
|
46
|
+
- Export: LoRA merge, GGUF conversion, HuggingFace Hub push.
|
|
47
|
+
- Trainer: mixed precision, gradient accumulation, gradient clipping, LR schedulers.
|
|
48
|
+
- Checkpointing: periodic saves, save-last, async checkpoint, resume from checkpoint.
|
|
49
|
+
- Early stopping with configurable patience, metric, and min delta.
|
|
50
|
+
- LR finder with EMA smoothing and suggested LR.
|
|
51
|
+
- Distributed training: DDP, FSDP, DeepSpeed via `xaytune launch`.
|
|
52
|
+
- Logging backends: console, WandB, MLflow, TensorBoard.
|
|
53
|
+
- Progress bar with Rich.
|
|
54
|
+
- Python API one-liners: `finetune()`, `pretrain()`, `align()`.
|
xaytune-0.6.0/PKG-INFO
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xaytune
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: An opinionated LLM training and fine-tuning library
|
|
5
|
+
Project-URL: Homepage, https://github.com/szaher/xaytune
|
|
6
|
+
Project-URL: Repository, https://github.com/szaher/xaytune
|
|
7
|
+
Project-URL: Issues, https://github.com/szaher/xaytune/issues
|
|
8
|
+
Author: szaher
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: bitsandbytes>=0.43
|
|
21
|
+
Requires-Dist: datasets>=2.18
|
|
22
|
+
Requires-Dist: peft>=0.10
|
|
23
|
+
Requires-Dist: pydantic>=2.0
|
|
24
|
+
Requires-Dist: pyyaml>=6.0
|
|
25
|
+
Requires-Dist: rich>=13.0
|
|
26
|
+
Requires-Dist: torch>=2.0
|
|
27
|
+
Requires-Dist: transformers>=4.40
|
|
28
|
+
Provides-Extra: all
|
|
29
|
+
Requires-Dist: deepspeed>=0.14; extra == 'all'
|
|
30
|
+
Requires-Dist: gradio>=5.0; extra == 'all'
|
|
31
|
+
Requires-Dist: lm-eval>=0.4; extra == 'all'
|
|
32
|
+
Requires-Dist: mlflow>=2.10; extra == 'all'
|
|
33
|
+
Requires-Dist: plotly>=5.0; extra == 'all'
|
|
34
|
+
Requires-Dist: tensorboard>=2.14; extra == 'all'
|
|
35
|
+
Requires-Dist: wandb>=0.16; extra == 'all'
|
|
36
|
+
Provides-Extra: deepspeed
|
|
37
|
+
Requires-Dist: deepspeed>=0.14; extra == 'deepspeed'
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: mkdocs-material>=9.5; extra == 'dev'
|
|
40
|
+
Requires-Dist: mkdocstrings[python]>=0.25; extra == 'dev'
|
|
41
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
42
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
45
|
+
Provides-Extra: docs
|
|
46
|
+
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
|
|
47
|
+
Requires-Dist: mkdocstrings[python]>=0.25; extra == 'docs'
|
|
48
|
+
Provides-Extra: eval
|
|
49
|
+
Requires-Dist: lm-eval>=0.4; extra == 'eval'
|
|
50
|
+
Provides-Extra: mlflow
|
|
51
|
+
Requires-Dist: mlflow>=2.10; extra == 'mlflow'
|
|
52
|
+
Provides-Extra: studio
|
|
53
|
+
Requires-Dist: gradio>=5.0; extra == 'studio'
|
|
54
|
+
Requires-Dist: plotly>=5.0; extra == 'studio'
|
|
55
|
+
Provides-Extra: tensorboard
|
|
56
|
+
Requires-Dist: tensorboard>=2.14; extra == 'tensorboard'
|
|
57
|
+
Provides-Extra: wandb
|
|
58
|
+
Requires-Dist: wandb>=0.16; extra == 'wandb'
|
|
59
|
+
Description-Content-Type: text/markdown
|
|
60
|
+
|
|
61
|
+
<p align="center">
|
|
62
|
+
<img src="docs/assets/logo.png" alt="xaytune" width="400">
|
|
63
|
+
</p>
|
|
64
|
+
|
|
65
|
+
<p align="center">
|
|
66
|
+
An opinionated LLM training and fine-tuning library built on PyTorch.<br>
|
|
67
|
+
Recipe-based architecture with a layered API: simple one-liners for beginners, full control for experts.
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
**[Documentation](https://szaher.github.io/xaytune/)** | **[Examples](https://szaher.github.io/xaytune/examples/)** | **[API Reference](https://szaher.github.io/xaytune/api/)**
|
|
71
|
+
|
|
72
|
+
## Features
|
|
73
|
+
|
|
74
|
+
- **3 recipes** — fine-tune (full/LoRA/QLoRA), pre-train, align (DPO, GRPO, PPO, ORPO, SimPO, REINFORCE)
|
|
75
|
+
- **4 data formats** — Alpaca, ShareGPT, chat template, raw text, plus preference pairs
|
|
76
|
+
- **Automatic tokenization** — text data is tokenized and collated automatically; pre-tokenized data passes through unchanged
|
|
77
|
+
- **Sequence packing** — pack short sequences to maximize GPU utilization
|
|
78
|
+
- **Distributed training** — DDP, FSDP, DeepSpeed via `xaytune launch`
|
|
79
|
+
- **4 logging backends** — console, TensorBoard, W&B, MLflow
|
|
80
|
+
- **LR finder** — automatic learning rate range test
|
|
81
|
+
- **Callbacks** — event-driven hooks for early stopping, checkpointing, progress, custom logic
|
|
82
|
+
- **Evaluation** — built-in metrics + lm-eval-harness benchmarks
|
|
83
|
+
- **Export** — merge LoRA adapters, GGUF conversion, push to HuggingFace Hub
|
|
84
|
+
- **Training Studio** — Gradio web UI for configuring and launching runs
|
|
85
|
+
- **8 CLI commands** — train, eval, export, compare, lr-find, list, studio, launch
|
|
86
|
+
- **Fully typed** — Pydantic configs, py.typed, mypy-clean
|
|
87
|
+
|
|
88
|
+
## Install
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install xaytune
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Optional extras:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install xaytune[wandb] # Weights & Biases logging
|
|
98
|
+
pip install xaytune[mlflow] # MLflow logging
|
|
99
|
+
pip install xaytune[deepspeed] # DeepSpeed distributed training
|
|
100
|
+
pip install xaytune[eval] # lm-eval-harness benchmarks
|
|
101
|
+
pip install xaytune[studio] # Training Studio web UI
|
|
102
|
+
pip install xaytune[docs] # MkDocs documentation site
|
|
103
|
+
pip install xaytune[all] # Everything
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Quickstart
|
|
107
|
+
|
|
108
|
+
### Python API
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import xaytune
|
|
112
|
+
|
|
113
|
+
# LoRA fine-tuning
|
|
114
|
+
xaytune.finetune(
|
|
115
|
+
model="meta-llama/Llama-3.1-8B",
|
|
116
|
+
dataset="data/train.jsonl",
|
|
117
|
+
method="lora",
|
|
118
|
+
format="alpaca",
|
|
119
|
+
num_epochs=3,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# Pre-training
|
|
123
|
+
xaytune.pretrain(
|
|
124
|
+
model="meta-llama/Llama-3.1-8B",
|
|
125
|
+
dataset="data/corpus.jsonl",
|
|
126
|
+
format="text",
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
# DPO alignment
|
|
130
|
+
xaytune.align(
|
|
131
|
+
model="output/sft-model",
|
|
132
|
+
dataset="data/preferences.jsonl",
|
|
133
|
+
method="dpo",
|
|
134
|
+
format="preference",
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
# Evaluation
|
|
138
|
+
results = xaytune.evaluate(
|
|
139
|
+
model="output/my-model",
|
|
140
|
+
dataset=[{"input_ids": [1, 2], "labels": [1, 2]}],
|
|
141
|
+
metrics=["loss", "perplexity"],
|
|
142
|
+
)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### CLI
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Train
|
|
149
|
+
xaytune train --config configs/lora_finetune.yaml
|
|
150
|
+
xaytune train --config configs/lora_finetune.yaml --override model.name=mistralai/Mistral-7B-v0.3
|
|
151
|
+
xaytune train --config configs/lora_finetune.yaml --dry-run
|
|
152
|
+
|
|
153
|
+
# Evaluate
|
|
154
|
+
xaytune eval --model output/my-model --benchmarks mmlu,gsm8k --num-fewshot 5
|
|
155
|
+
xaytune eval --model output/my-model --dataset data/eval.jsonl --metrics loss,perplexity
|
|
156
|
+
|
|
157
|
+
# Compare models
|
|
158
|
+
xaytune compare model-a/ model-b/ --benchmarks mmlu,gsm8k
|
|
159
|
+
|
|
160
|
+
# Export
|
|
161
|
+
xaytune export merge --checkpoint output/lora-ckpt --output output/merged
|
|
162
|
+
xaytune export gguf --model output/merged --output model.gguf --quant Q4_K_M
|
|
163
|
+
xaytune export push --model output/merged --repo username/my-model
|
|
164
|
+
|
|
165
|
+
# LR finder
|
|
166
|
+
xaytune lr-find --config configs/lora_finetune.yaml
|
|
167
|
+
|
|
168
|
+
# Distributed training
|
|
169
|
+
xaytune launch --config configs/lora_finetune.yaml --nproc-per-node 4
|
|
170
|
+
|
|
171
|
+
# Training Studio
|
|
172
|
+
xaytune studio --port 7860
|
|
173
|
+
|
|
174
|
+
# List components
|
|
175
|
+
xaytune list recipes
|
|
176
|
+
xaytune list formats
|
|
177
|
+
xaytune list metrics
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Config file
|
|
181
|
+
|
|
182
|
+
```yaml
|
|
183
|
+
recipe: finetune
|
|
184
|
+
method: lora
|
|
185
|
+
|
|
186
|
+
model:
|
|
187
|
+
name: meta-llama/Llama-3.1-8B
|
|
188
|
+
|
|
189
|
+
data:
|
|
190
|
+
path: data/train.jsonl
|
|
191
|
+
format: alpaca
|
|
192
|
+
eval_split: 0.05
|
|
193
|
+
packing: true
|
|
194
|
+
max_seq_length: 2048
|
|
195
|
+
|
|
196
|
+
lora:
|
|
197
|
+
rank: 16
|
|
198
|
+
alpha: 32
|
|
199
|
+
|
|
200
|
+
trainer:
|
|
201
|
+
batch_size: 4
|
|
202
|
+
learning_rate: 2e-4
|
|
203
|
+
num_epochs: 3
|
|
204
|
+
mixed_precision: bf16
|
|
205
|
+
checkpoint_every_n_steps: 500
|
|
206
|
+
|
|
207
|
+
eval:
|
|
208
|
+
every_n_steps: 500
|
|
209
|
+
metrics: [loss, perplexity]
|
|
210
|
+
|
|
211
|
+
logging:
|
|
212
|
+
backends: [console, tensorboard]
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Recipes
|
|
216
|
+
|
|
217
|
+
| Recipe | Methods | Use case |
|
|
218
|
+
|--------|---------|----------|
|
|
219
|
+
| `finetune` | `full`, `lora`, `qlora` | Supervised fine-tuning on instruction data |
|
|
220
|
+
| `pretrain` | `full` | Pre-training or continued pre-training on raw text |
|
|
221
|
+
| `align` | `dpo`, `grpo`, `ppo`, `orpo`, `simpo`, `reinforce` | Alignment with human preferences |
|
|
222
|
+
|
|
223
|
+
## Extensibility
|
|
224
|
+
|
|
225
|
+
Register custom components with decorators:
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
from xaytune.data import register_format
|
|
229
|
+
from xaytune.eval import register_metric
|
|
230
|
+
from xaytune.recipes.align import register_reward
|
|
231
|
+
from xaytune.trainer import on
|
|
232
|
+
|
|
233
|
+
@register_format("my-format")
|
|
234
|
+
def parse_my_data(sample):
|
|
235
|
+
return {"text": f"Q: {sample['q']}\nA: {sample['a']}"}
|
|
236
|
+
|
|
237
|
+
@register_metric("domain-accuracy")
|
|
238
|
+
def domain_accuracy(predictions, references, **kwargs):
|
|
239
|
+
return sum(p == r for p, r in zip(predictions, references)) / len(predictions)
|
|
240
|
+
|
|
241
|
+
@register_reward("brevity")
|
|
242
|
+
def brevity_reward(prompt, response, *, max_len=100):
|
|
243
|
+
return 1.0 if len(response) <= max_len else 0.0
|
|
244
|
+
|
|
245
|
+
@on("step_end")
|
|
246
|
+
def log_memory(state):
|
|
247
|
+
print(f"Step {state.global_step}: loss={state.metrics.get('loss', 'N/A')}")
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Export
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
from xaytune import export
|
|
254
|
+
|
|
255
|
+
# Merge LoRA adapters into base model
|
|
256
|
+
export.merge("output/lora-checkpoint", save_to="output/merged")
|
|
257
|
+
|
|
258
|
+
# Save with metadata
|
|
259
|
+
export.save(model, tokenizer, output_dir="output/final", metadata={"recipe": "finetune"})
|
|
260
|
+
|
|
261
|
+
# Push to Hugging Face Hub
|
|
262
|
+
export.push_to_hub("output/merged", repo="username/my-model")
|
|
263
|
+
|
|
264
|
+
# Convert to GGUF for local inference
|
|
265
|
+
from xaytune.export import to_gguf
|
|
266
|
+
to_gguf("output/merged", output="model.gguf", quantization="Q4_K_M")
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Architecture
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
+-----------------------------------------+
|
|
273
|
+
| CLI / Config Engine | Layer 3 - Interface
|
|
274
|
+
+-----------------------------------------+
|
|
275
|
+
| pretrain | finetune | align (recipes) | Layer 2 - Recipes
|
|
276
|
+
+--------+--------+---------+--------+----+
|
|
277
|
+
| models | data | trainer | eval | exp| Layer 1 - Building Blocks
|
|
278
|
+
+--------+--------+---------+--------+----+
|
|
279
|
+
PyTorch / HuggingFace / DeepSpeed
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## License
|
|
283
|
+
|
|
284
|
+
Apache 2.0
|