-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpyproject.toml
More file actions
353 lines (323 loc) · 8.46 KB
/
pyproject.toml
File metadata and controls
353 lines (323 loc) · 8.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "aligntune"
version = "0.1.10"
description = "AlignTune: Multi-backend alignment and fine-tuning library. Features TRL and Unsloth backends with complete RL coverage (DPO, PPO, GRPO, BOLT), 27+ reward functions, production-ready evaluation system, and unified configuration interface for LLM alignment."
readme = "README.md"
requires-python = ">=3.12"
license = { text = "MIT" }
authors = [
{name = "Zera Lyngkhoi", email = "zera.lyngkhoi@lexsi.ai"},
{name = "Chirag Chawla", email = "chirag.chawla@lexsi.ai"},
{name = "Pratinav Seth", email = "pratinav.seth@lexsi.ai"},
{name = "Utsav Avaiya", email = "utsav.avaiya@lexsi.ai"},
{name = "Soham Bhattacharjee", email = "soham.bhattacharjee@lexsi.ai"},
{name = "Mykola Khandoga", email = "mykola.khandoga@lexsi.ai"},
{name = "Rui Yuan", email = "rui.yuan@lexsi.ai"},
{name = "Vinay Kumar Sankarapu", email = "v.k@lexsi.ai"}
]
keywords = [
"alignment",
"rlhf",
"fine-tuning",
"llm",
"machine learning",
"SFT",
"RL",
"DPO",
"GRPO",
"PPO",
"GSPO",
"BOLT",
"transformers",
"trl",
"unsloth",
"multi-backend",
"reward-functions",
"evaluation",
"lm-eval",
"wandb",
"tensorboard",
"checkpointing",
"device-management",
"unified-config",
"cli"
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: Other/Proprietary License",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Python Modules",
"Operating System :: OS Independent",
]
dependencies = [
# Core ML dependencies
"transformers>=4.35.0",
"datasets>=2.14.0",
"accelerate>=0.24.0",
"peft>=0.6.0",
"bitsandbytes>=0.41.0",
# Core Python dependencies
"numpy>=1.21.0",
"pyyaml>=6.0",
"huggingface-hub>=0.17.0",
"tqdm>=4.64.0",
"psutil>=5.9.0",
# Data processing
"pandas>=1.3.0",
"scikit-learn>=1.0.0",
# Utilities
"click>=8.0.0",
"rich>=12.0.0",
"typer>=0.7.0",
# Reinforcement Learning
"trl==0.23.0",
"vllm==0.11",
# Unsloth acceleration
"unsloth==2025.11.1",
"unsloth_zoo==2025.11.2",
# Logging and monitoring
"wandb>=0.15.0",
"tensorboard>=2.12.0",
"matplotlib>=3.5.0",
"seaborn>=0.11.0",
# Evaluation metrics
"evaluate>=0.4.0",
"rouge-score>=0.1.2",
"sacrebleu>=2.3.0",
"lm-eval>=0.4.0",
"nltk>=3.8.0",
# Device management (Linux/Windows only)
"nvitop>=1.1.0; platform_system!='Darwin'",
"nvidia-ml-py>=11.495.46; platform_system!='Darwin'",
]
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-xdist>=3.0.0",
"pytest-mock>=3.10.0",
"pytest-timeout>=2.1.0",
"hypothesis>=6.70.0",
"black>=23.0.0",
"isort>=5.12.0",
"flake8>=6.0.0",
"mypy>=1.5.0",
"pre-commit>=3.0.0",
]
docs = [
"sphinx>=5.0.0",
"sphinx-rtd-theme>=1.2.0",
"myst-parser>=0.18.0",
"sphinx-autodoc-typehints>=1.19.0",
]
[project.urls]
Homepage = "https://github.com/Lexsi-Labs/aligntune"
Repository = "https://github.com/Lexsi-Labs/aligntune"
Documentation = "https://aligntune.readthedocs.io"
"Bug Tracker" = "https://github.com/Lexsi-Labs/aligntune/issues"
"Changelog" = "https://github.com/Lexsi-Labs/aligntune/blob/main/CHANGELOG.md"
"Discussions" = "https://github.com/Lexsi-Labs/aligntune/discussions"
[project.scripts]
aligntune = "aligntune.cli:main"
at = "aligntune.cli:main"
[project.entry-points."aligntune.trainers"]
# TRL Backend Trainers
trl_sft = "aligntune.backends.trl.sft.sft:TRLSFTTrainer"
trl_dpo = "aligntune.backends.trl.rl.dpo.dpo:TRLDPOTrainer"
trl_ppo = "aligntune.backends.trl.rl.ppo.ppo:TRLPPOTrainer"
# Unsloth Backend Trainers
unsloth_sft = "aligntune.backends.unsloth.sft.sft:UnslothSFTTrainer"
unsloth_dpo = "aligntune.backends.unsloth.rl.dpo.dpo:UnslothDPOTrainer"
unsloth_ppo = "aligntune.backends.unsloth.rl.ppo.ppo:UnslothPPOTrainer"
unsloth_grpo = "aligntune.backends.unsloth.rl.grpo.grpo:EnhancedGRPOTrainer"
unsloth_gspo = "aligntune.backends.unsloth.rl.gspo.gspo:EnhancedGSPOTrainer"
[project.entry-points."aligntune.backends"]
trl = "aligntune.backends.trl:TRLBackend"
unsloth = "aligntune.backends.unsloth:UnslothBackend"
[project.entry-points."aligntune.evaluation"]
lm_eval = "aligntune.eval.lm_eval_runner:LMEvalRunner"
custom = "aligntune.eval.custom_runner:CustomEvalRunner"
[project.entry-points."aligntune.rewards"]
registry = "aligntune.rewards.core:RewardRegistry"
factory = "aligntune.rewards.core:RewardFunctionFactory"
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.package-data]
"aligntune" = [
"*.yaml",
"*.yml",
"*.json",
"*.md",
"*.txt",
"py.typed",
# Configuration files
"configs/*.yaml",
"configs/*.yml",
"configs/*.json",
# SFT configurations
"sft/*.yaml",
"sft/*.yml",
"sft/*.json",
# RL configurations
"rl/*.yaml",
"rl/*.yml",
"rl/*.json",
# Backend configurations
"backends/*/*.yaml",
"backends/*/*.yml",
"backends/*/*.json",
# (Excluded examples/tests/docs from package to keep library lean)
# CLI configurations
"cli/*.yaml",
"cli/*.yml",
"cli/*.json",
# Evaluation configurations
"eval/*.yaml",
"eval/*.yml",
"eval/*.json",
# Reward configurations
"rewards/*.yaml",
"rewards/*.yml",
"rewards/*.json",
]
# Black configuration
[tool.black]
line-length = 100
target-version = ['py312']
include = '\.pyi?$'
extend-exclude = '''
/(
# directories
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| build
| dist
| __pycache__
)/
'''
# isort configuration
[tool.isort]
profile = "black"
line_length = 100
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
known_first_party = ["aligntune"]
known_third_party = [
"torch",
"transformers",
"datasets",
"accelerate",
"peft",
"trl",
"unsloth",
"wandb",
"numpy",
"pandas"
]
# mypy configuration
[tool.mypy]
python_version = "3.12"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
ignore_missing_imports = true
strict_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
check_untyped_defs = true
[[tool.mypy.overrides]]
module = [
"unsloth.*",
"trl.*",
"wandb.*",
"tensorboard.*",
"evaluate.*",
]
ignore_missing_imports = true
# pytest configuration
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"--cov=src/aligntune",
"--cov-report=html",
"--cov-report=term-missing",
"--cov-report=xml",
"--strict-markers",
"--strict-config",
"-ra",
"-v"
]
filterwarnings = [
"ignore::UserWarning",
"ignore::DeprecationWarning",
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"gpu: marks tests that require GPU",
"unsloth: marks tests that require Unsloth",
"wandb: marks tests that require WandB",
]
# Coverage configuration
[tool.coverage.run]
source = ["src/aligntune"]
omit = [
"*/tests/*",
"*/test_*",
"*/__init__.py",
"*/examples/*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
# Ruff configuration (modern linter alternative to flake8)
[tool.ruff]
target-version = "py312"
line-length = 100
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
]
[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]
"tests/*" = ["B011"]
# Bandit security linting
[tool.bandit]
exclude_dirs = ["tests", "examples"]
skips = ["B101", "B601"]