Skip to main content

A place to store reusable transformer components found around the interwebs

Project description

transformer_nuggets

A grab-bag of experimental transformer kernels and utilities (mostly PyTorch + Triton).

transformer_nuggies

What’s in here

  • transformer_nuggets/flash: Triton FlashAttention experiments + masking/bias utilities.
  • transformer_nuggets/quant: NF4 tensor subclass + QLoRA building blocks (pure PyTorch).
  • transformer_nuggets/fp8: FP8 casting / scaled-quantization kernels (Triton). Try helion :)
  • transformer_nuggets/cute: CUTE DSL experiments and tooling (includes an intra-kernel profiler).
  • transformer_nuggets/misc: Odds and ends (e.g. attention wrappers, utilities).
  • transformer_nuggets/llama: LLaMA-ish model + training/finetune scripts (research-grade).

This repository is research code: APIs are not stable and may change.

Install

You’ll need a working PyTorch install first (CPU or CUDA). Follow the official PyTorch install instructions.

To install from PyPI:

pip install transformer_nuggets

To hack on the code locally:

git clone https://github.com/drisspg/transformer_nuggets.git
cd transformer_nuggets
pip install -e .

Optional extras:

pip install "transformer_nuggets[flash]"  # triton
pip install "transformer_nuggets[qlora]"  # bitsandbytes (optional comparisons)
pip install "transformer_nuggets[llama]"  # llama training utilities

Quick examples

Use torchao :)

FlashAttention (requires CUDA + Triton; API is experimental):

Use flex-attention :)

CUTE intra-kernel profiling (writes a Perfetto trace):

python -m transformer_nuggets.cute.profiler.example

Repo layout

  • transformer_nuggets/: Python package.
  • benchmarks/: Microbenchmarks and profiling scripts.
  • examples/: Small runnable examples.
  • scripts/: One-off utilities.
  • test/: PyTest suite.

Development

pip install -e ".[dev]"
pre-commit install
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transformer_nuggets-0.0.3.tar.gz (168.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transformer_nuggets-0.0.3-py3-none-any.whl (147.9 kB view details)

Uploaded Python 3

File details

Details for the file transformer_nuggets-0.0.3.tar.gz.

File metadata

  • Download URL: transformer_nuggets-0.0.3.tar.gz
  • Upload date:
  • Size: 168.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for transformer_nuggets-0.0.3.tar.gz
Algorithm Hash digest
SHA256 38c567defa151a158d7ea49981b005a6590a9de27e0623b25d86bbc67b43e6db
MD5 1706b4b89719388ecd6abd516ee6a398
BLAKE2b-256 55c36bfe31c3e8827e6a9eb48b21f9e991cdf594ad8c1eedb89d2f183c10c567

See more details on using hashes here.

Provenance

The following attestation bundles were made for transformer_nuggets-0.0.3.tar.gz:

Publisher: publish-to-pypi.yml on drisspg/transformer_nuggets

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file transformer_nuggets-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for transformer_nuggets-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c52717236acf1ee54da8f83ff09858000aa1f441bb801484085a7ce214b57cb7
MD5 ae5595a8a4bad6432a36f854492215fe
BLAKE2b-256 0a8e81319757464ff2cfac8245aec0d2980cb94bb4a154997bb72cc03435e8a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for transformer_nuggets-0.0.3-py3-none-any.whl:

Publisher: publish-to-pypi.yml on drisspg/transformer_nuggets

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page