Daniel Han
187144d4e7
Reduce and tighten code comments and docstrings repo-wide ( #6095 )
...
Trim and tighten code comments and docstrings across the repository. Comment-only: every changed file verified code-identical to main via AST/token comparison.
2026-06-08 23:09:51 -07:00
Daniel Han
3ce187da02
Formatting: ruff line-length 100, kwarg-spacing passes, drop blank after short local imports ( #6079 )
...
Raise ruff line-length to 100 and extend the local pre-commit format pipeline (def-signature magic-comma normalization, short multi-line assert collapse, kwarg '=' spacing, blank-line-after-short-import removal, adjacent string-literal / f-string+plain merge, redundant-pass pruning). Every transform re-checks the file AST and is dropped if it would differ; the whole-repo reformat is verified AST-identical per file and idempotent.
2026-06-08 04:24:13 -07:00
Mohammad Miadh Angkad
336bec216a
Refactor Ollama template wiring and harden packing helpers ( #3890 )
...
* Refactor Ollama template wiring and harden packing helpers
Signed-off-by: Mohammad Miadh Angkad <MAngkad.BSDSBA2027@aim.edu>
* Fix Qwen3 and Gemma3n template bindings and tidy packing test helper
* Fix gptoss Ollama comment and tinyllama stop parameter
- Fix wrong comment referencing gemma3n for gptoss_ollama in chat_templates.py
- Add missing stop keyword to tinyllama PARAMETER in ollama_template_mappers.py
* Fix _DummyTrainer compatibility across TRL versions
The try/except only handled the removal of return_position_ids
(TRL v0.24+) but not the absence of padding_free (TRL v0.18.2).
Gracefully degrade through all optional collator flags so the
test works from trl>=0.18.2 through v0.27+.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Signed-off-by: Mohammad Miadh Angkad <MAngkad.BSDSBA2027@aim.edu>
Co-authored-by: Daniel Hanchen <danielhanchen@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-09 04:04:48 -08:00
Dan Saunders
75e0d7ce62
Auto-enable padding-free SFT ( #3672 )
...
* implement (sdpa, xformers, fa2) sample packing
* attention dispatching
* ddp working OOTB with CLI
* packed SWA and softcap support
* enable batch flattening
* LGPL license headers
* mask packed sequence boundaries
* auto-enable sample packing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add explicit toggle for sample packing
* Add explicit toggle for sample packing
* Update __init__.py
* Update unsloth/kernels/rope_embedding.py
* Update unsloth/kernels/rope_embedding.py
* remove grad output clones; restore deleted FastLanguageModel arg
* fix
* restore rope embedding clones
* xformers mask cache
* implement (sdpa, xformers, fa2) sample packing
* attention dispatching
* ddp working OOTB with CLI
* packed SWA and softcap support
* enable batch flattening
* LGPL license headers
* mask packed sequence boundaries
* auto-enable sample packing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add explicit toggle for sample packing
* Add explicit toggle for sample packing
* Update __init__.py
* Update unsloth/kernels/rope_embedding.py
* Update unsloth/kernels/rope_embedding.py
* remove grad output clones; restore deleted FastLanguageModel arg
* fix
* restore rope embedding clones
* xformers mask cache
* add back accidental deletion
* Update unsloth/kernels/rope_embedding.py
Co-authored-by: Daniel Han <danielhanchen@gmail.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix merge conflicts
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add **kwargs
* add back clobbered
* Update rope_embedding.py
* Update rope_embedding.py
* simplify trl warnings filter
* docstring
* nit
* bugfix
* add padding-free seqlen metadata
* auto-enable padding free
* gemma2 disable
* Apply suggestion from @danielhanchen
* Update trainer.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update trainer.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Han <danielhanchen@gmail.com>
2025-12-10 03:07:29 -08:00
Dan Saunders
496f84ff6b
SFT sample packing ( #3566 )
...
* implement (sdpa, xformers, fa2) sample packing
* attention dispatching
* ddp working OOTB with CLI
* packed SWA and softcap support
* enable batch flattening
* LGPL license headers
* mask packed sequence boundaries
* auto-enable sample packing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add explicit toggle for sample packing
* Add explicit toggle for sample packing
* Update __init__.py
* Update unsloth/kernels/rope_embedding.py
* Update unsloth/kernels/rope_embedding.py
* remove grad output clones; restore deleted FastLanguageModel arg
* fix
* restore rope embedding clones
* xformers mask cache
* implement (sdpa, xformers, fa2) sample packing
* attention dispatching
* ddp working OOTB with CLI
* packed SWA and softcap support
* enable batch flattening
* LGPL license headers
* mask packed sequence boundaries
* auto-enable sample packing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add explicit toggle for sample packing
* Add explicit toggle for sample packing
* Update __init__.py
* Update unsloth/kernels/rope_embedding.py
* Update unsloth/kernels/rope_embedding.py
* remove grad output clones; restore deleted FastLanguageModel arg
* fix
* restore rope embedding clones
* xformers mask cache
* add back accidental deletion
* Update unsloth/kernels/rope_embedding.py
Co-authored-by: Daniel Han <danielhanchen@gmail.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix merge conflicts
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add **kwargs
* add back clobbered
* Update rope_embedding.py
* Update rope_embedding.py
* simplify trl warnings filter
* docstring
* nit
* bugfix
* Apply suggestion from @danielhanchen
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update unsloth/trainer.py
* Update unsloth/trainer.py
* Update unsloth/trainer.py
* Update unsloth/trainer.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Han <danielhanchen@gmail.com>
2025-12-09 17:36:45 -08:00