Skip to main content

Tensorless

Tensorless trains small PyTorch models with sensible defaults. It supports text generation, text classification, tabular classification, and regression.

Install

pip install -e .

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 PyTorch 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())

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

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.3.0.tar.gz (72.0 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.3.0-py3-none-any.whl (53.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tensorless-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e2b575cc85eb8442c184db7c9fe2e40d38c519cd7090e96f5d1004e91e2a0e94
MD5 2bf72a2bfc51556b7282036c16f775ca
BLAKE2b-256 838f8f57d76f35d8e61aab8d256fc14eba38cc2dffc6f1e1579c85bce9fb884f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tensorless-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 53.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d6afd01e858b1a17c71df7bf7af92b8dcc0deeb8ec06956ff1845940191b5f2
MD5 9a3866e0136251d2770c901afc9a7501
BLAKE2b-256 a5096b8f3a8f4933895084dba292092577a37acac77bbece8489c49a8fc0c19f

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

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

This release

0.3.0 This release

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