Chalk
Custom Triton/CUDA kernels that complement Liger Kernel.
pip install freesolo-chalk
Liger fuses the cross-entropy, activation, and RMSNorm paths. Chalk fills the gaps that matter for Freesolo's Flash post-training stack — fused GEMMs, the LoRA-delta matmuls, the QKV norm+RoPE epilogue, embedding gather, and FP8 frozen-base GEMMs — each behind a documented, benchmarked, opt-in entry point.
Chalk's repository layout and conventions intentionally mirror Liger Kernel.
Layout
src/chalk/
ops/ # raw Triton/CUDA kernels + autograd.Function wrappers
transformers/ # model-level installers that monkeypatch kernels into HF modules
utils.py # device detection helpers
test/ # correctness + gating tests (mirrors test/ops, test/transformers)
Design principles
- Worker-side kernel library. Like Liger, chalk depends on
torch+triton— it is meant to be installed where kernels actually run (the GPU worker), so consumers should depend on it from agpuextra rather than their base install. Importing the top-levelchalkpackage is still cheap (kernels lazy-load), so probingchalk.utils.infer_device()never forces a heavy import. - Complements, not replaces, Liger. Liger fuses CE / activation / RMSNorm; chalk fuses the GEMMs, LoRA delta, QKV epilogue, embedding, and FP8 base.
- Safe fallback. Every installer is arch-gated, runs a numeric self-test on install, and
silently falls back to the eager / Liger path on any import / compile / self-test failure.
All installers but one patch only frozen
nn.Linearlayers (never trainable / PEFT-wrapped layers). The exception is the LoRA-delta installer (install_fused_lora_delta), the one kernel that intentionally accelerates the trainable PEFT LoRA path: it monkeypatches PEFT's denselora.Linear.forwardto route the adapter delta through the fused kernel. Its self-test checks the fused forward and thex/A/Bgradients against torch autograd (bf16 tolerance) before patching, and at runtime it falls back to stock PEFT per call for everything the kernel does not replicate exactly (merged / disabled adapters, mixed-adapter batches, LoRA variants, dropout,lora_bias, quantized / non-dense bases, and any non-CUDA tensor) — so a failed self-test or any unsupported layer leaves training numerics on the stock PEFT path. - Opt-in & evidence-based. Kernels are off unless explicitly enabled, and every kept kernel has end-to-end loss-curve evidence — not just a microbenchmark.
Development
pip install -e '.[dev]'
make checkstyle # ruff check + format
make test # pytest with coverage
Status
Intentionally minimal to start — kernels are landed one at a time under chalk/ops +
chalk/transformers, each with correctness tests.
License
Metadata
Release files for freesolo-chalk 0.5.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| freesolo_chalk-0.5.7.tar.gz | 397.4 kB | Without provenance | Details for freesolo_chalk-0.5.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| freesolo_chalk-0.5.7-py3-none-any.whl | Python 3 | none | any | Details for freesolo_chalk-0.5.7-py3-none-any.whl |
Total release size: 629.3 kB
Release files / freesolo_chalk-0.5.7.tar.gz
| Download URL | freesolo_chalk-0.5.7.tar.gz |
|---|---|
| Size | 397.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc36c02b8a4538eb8d34f1f488c1b27bfb7f231c80123156a378eb9519cacb2c
|
|
BLAKE2b-256 checksum How to use checksums |
5507caab8ca45b4f6f4005769d0852678ba45c5cdc98fae40579acacd902f9e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / freesolo_chalk-0.5.7-py3-none-any.whl
| Download URL | freesolo_chalk-0.5.7-py3-none-any.whl |
|---|---|
| Size | 231.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51be0e970489c1fff739bc492cd7a7bb53ce1f8828bcf9c7402acae5abbe4dbe
|
|
BLAKE2b-256 checksum How to use checksums |
5477d329dacfe2f913de672c421a3d0b629661e3abe1676cfb6cc38197d616c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for freesolo-chalk 0.5.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.