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.
Text is tokenized once up front (not re-tokenized every epoch) and streamed
through PyTorch in fixed-size batches. Model size is auto-scaled with corpus
size across four tiers -- small, lower-mid, upper-mid, large -- capped at
"upper-mid" (roughly 50M-350M parameters) unless you pass explicit
d_model=/layers=/etc. yourself. New training runs use the architecture="v2"
backbone (RoPE + RMSNorm + SwiGLU + KV-cached generation); older .tl
checkpoints keep loading and running on the original "v1" backbone
automatically. CUDA training automatically uses fp16 or bf16 when
supported (with gradient scaling and checkpointed scaler state), TPU (XLA)
training is supported via device="tpu", and large auto-sized models enable
gradient checkpointing automatically to fit in memory. 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tensorless_pytorch-0.5.0.tar.gz.
File metadata
- Download URL: tensorless_pytorch-0.5.0.tar.gz
- Upload date:
- Size: 130.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f1ed2b2a3398accbdddce21da6c62f5483f5de847df0c244fa62770c5ad75fa
|
|
| MD5 |
6b3d819ce1761cc9bd11cd69e03bdab9
|
|
| BLAKE2b-256 |
513f8c99055ada8de8b24742f17a487edd340e4ebefd7e0103820a0fb4b9ba81
|
File details
Details for the file tensorless_pytorch-0.5.0-py3-none-any.whl.
File metadata
- Download URL: tensorless_pytorch-0.5.0-py3-none-any.whl
- Upload date:
- Size: 112.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e743b1017fa06437c31159fc608a61a4376897bbea3ce358a77260ac2ffaffca
|
|
| MD5 |
6586663953cc3959109423d58df91bcf
|
|
| BLAKE2b-256 |
f7fc06dbb3f2e80ae194aca3e5c8c774180ba3c955b98a376670137536e2d419
|