Skip to main content

Tensorless PyTorch

Tensorless PyTorch is a lightweight toolkit for turning ordinary text and tabular data into portable PyTorch models with minimal setup. It supports text generation, text classification, tabular classification, and regression.

The distribution is installed as tensorless-pytorch; the stable Python import remains tensorless for compatibility.

Install

pip install tensorless-pytorch

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 PyTorch 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. CUDA training automatically uses fp16 or bf16 when supported, including gradient scaling and checkpointed scaler state. Reduce batch_size if 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, mixed precision, 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_pytorch-0.2.0.tar.gz (120.6 kB view details)

Uploaded Source

Built Distribution

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

tensorless_pytorch-0.2.0-py3-none-any.whl (101.3 kB view details)

Uploaded Python 3

File details

Details for the file tensorless_pytorch-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for tensorless_pytorch-0.2.0.tar.gz
Algorithm Hash digest
SHA256 07b2a243f0331ef810c85653dfd29e92de550066adc1a4c8420badeddf416b21
MD5 5507ad0b7c046adc898fa30a0137d212
BLAKE2b-256 176812a9ef4f0eefcdccdc9076f4b5b482c0ef6f7c36a7478bafabd516260777

See more details on using hashes here.

File details

Details for the file tensorless_pytorch-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tensorless_pytorch-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e63ef63d517d67e98c18f1b24b26d324571a7108ed8e0c2f55228db1616a7dc6
MD5 82156e17cd3e9d0e81437fd65d494dff
BLAKE2b-256 583c3ca42fb9e9464a652ad331f9133ad309e78a41fa5ed3f64fb48e4b7c0848

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

This release

0.2.0 This release

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