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.4.tar.gz (172.2 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.4-py3-none-any.whl (150.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for transformer_nuggets-0.0.4.tar.gz
Algorithm Hash digest
SHA256 fad327ea13723713f058cdf0f1e78f4e1f3b2e57745f879894a615605b93c19b
MD5 e62dfa62b1aa231fa15ac6723b1cad1f
BLAKE2b-256 2aef7518309dba625e0975ba88b98bb239edee25d0725feffc4085fee3782104

See more details on using hashes here.

Provenance

The following attestation bundles were made for transformer_nuggets-0.0.4.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.4-py3-none-any.whl.

File metadata

File hashes

Hashes for transformer_nuggets-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2e6101014206ab4ae5eeeaa054681ce302032bd16ad989dd5dc95ed165971996
MD5 ef26eb8a63d86612272cb7318b25d437
BLAKE2b-256 7406049317711e2c7a9b72bc1f9e49a416a22dcb642d779c8025410d2fd2f66c

See more details on using hashes here.

Provenance

The following attestation bundles were made for transformer_nuggets-0.0.4-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