Skip to main content

Tensorless

Tensorless trains small custom models with sensible defaults. It uses a native NumPy engine on CPU and optional JAX or MLX backends for accelerator execution. It supports text generation, text classification, tabular classification, and regression.

Install

pip install -e .

Optional accelerator backends:

pip install -e '.[cuda]'   # JAX CUDA
pip install -e '.[tpu]'    # JAX TPU
pip install -e '.[mps]'    # Apple Silicon MLX

CUDA and TPU backends currently accelerate transformer text tasks. Tabular tasks and unsupported platforms use the native CPU engine.

Train on your data

import tensorless as tl

model = tl.train("./corpus.txt", task="text-generation")
print(model.generate("The", max_new_tokens=40))

Text files are trained as next-token language models. BPE is the default tokenizer; use tokenizer="char" for a character-level model. Tensorless derives model size, batch size, epochs, validation, device, and BPE vocabulary size from the data, while every setting can be overridden.

Long text is tokenized lazily and fed through the native engine in fixed-size batches. The automatic batch size uses a token budget; reduce batch_size if your available memory is limited.

English starter pretraining

import tensorless as tl

model = tl.pretrain(out="english.tl", epochs=20, max_seq_len=128)
print(model.generate("A complete sentence", max_new_tokens=30))

This offline starter corpus contains English prose and grammar examples. It is for demos and smoke tests, not a replacement for a large language dataset. For real pretraining, pass your own .txt corpus to tl.train() and increase the training settings as your hardware allows.

Other tasks

tl.train("reviews/", task="text-classification")
tl.train("housing.csv", task="regression")

Tabular preprocessing automatically handles numeric values, ISO dates, and high-cardinality categories. Missing and rare values are handled using the fitted training data, and the same preprocessing is stored in the .tl file.

Models are saved as .tl files and can be loaded later:

model = tl.load("model.tl")
print(model.info())

The native extension API is in tensorless.engine: Module, Parameter, Adam, and SGD provide model parameters, gradients, and optimization without a PyTorch dependency. Accelerator cache helpers are available as tensorless.devices.clear_memory() and tensorless.devices.memory_stats().

See the documentation for data formats, configuration, checkpointing, and the command-line interface. pypi-AgEIcHlwaS5vcmcCJDJmYzZiYmQ1LTI1YTAtNGNlZi05OWE2LTliMjg3ZjY5MThiZQACElsxLFsidGVuc29ybGVzcyJdXQACLFsyLFsiNjcxZGZmNDQtZmVmMC00MWNiLWIzYzYtZWQzMTI3OWU4NWM5Il1dAAAGIDZAp3AAlp0idrTOMPJ227qF_7W0LDsyUpi6pfqf0aV0

Download files

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

Source Distribution

tensorless-0.6.0.tar.gz (83.3 kB view details)

Uploaded Source

Built Distribution

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

tensorless-0.6.0-py3-none-any.whl (65.0 kB view details)

Uploaded Python 3

File details

Details for the file tensorless-0.6.0.tar.gz.

File metadata

  • Download URL: tensorless-0.6.0.tar.gz
  • Upload date:
  • Size: 83.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.1

File hashes

Hashes for tensorless-0.6.0.tar.gz
Algorithm Hash digest
SHA256 e4625675c2b9c24824167dd73e09dbdcbe872cad21c7d69bd96e3a04dbea0ae8
MD5 c76d7841b316b2584956965f203da0bd
BLAKE2b-256 3ef4f02e6132ffc9b78a64a89d235281878323553fb580512a7b58cf11d96e08

See more details on using hashes here.

File details

Details for the file tensorless-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: tensorless-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 65.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.1

File hashes

Hashes for tensorless-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 267c3927b3d42c7e0f8441a95c8abce36661e57e13a0c4203a3c18fe43af0ed6
MD5 8fcf3f23f5992b61b54e29bce0e02032
BLAKE2b-256 fdb132c036c661282b461edd983d56e85dace50809ec417bb46ba5a8f64e4742

See more details on using hashes here.

Release history Release notifications | RSS feed

0.9.3

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

This release

0.6.0 This release

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

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