Easy-2-use long text NLP toolkit.
Project description
DeepLoTX
An Easy-2-use long text NLP toolkit
Installation
-
Install with pip
pip install -U deeplotx -
Install with uv
uv add -U deeplotx -
Install from github
pip install -U git+https://github.com/vortezwohl/DeepLoTX.git
Quick Start
To train a binary classifier from text files:
from deeplotx.util import get_files, read_file
from deeplotx import TextBinaryClassifierTrainer, LongTextEncoder
long_text_encoder = LongTextEncoder(
max_length=2048,
chunk_size=512,
overlapping=128
)
trainer = TextBinaryClassifierTrainer(
long_text_encoder=long_text_encoder,
batch_size=4,
train_ratio=0.9
)
pos_data_path = './data/pos'
neg_data_path = './data/neg'
pos_data = [read_file(x) for x in get_files(pos_data_path)]
neg_data = [read_file(x) for x in get_files(neg_data_path)]
model = trainer.train(pos_data, neg_data, num_epochs=20, learning_rate=2e-5, train_loss_threshold=1)
model.save()
model = model.load()
model.predict(long_text_encoder.encode('这是一个测试文本.').squeeze())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
deeplotx-0.4.8.tar.gz
(21.6 kB
view details)
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
deeplotx-0.4.8-py3-none-any.whl
(26.7 kB
view details)
File details
Details for the file deeplotx-0.4.8.tar.gz.
File metadata
- Download URL: deeplotx-0.4.8.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08ee3efc577f5524a7b2dd1922db170db6a3e14d7248b977fb57162f9f3d22de
|
|
| MD5 |
a3aed38b0d1b522fadfe093f8d4f65c6
|
|
| BLAKE2b-256 |
96811248f388c93c8403d4c8033c941e79d3d9bf0c9a6b5093fe74692648df26
|
File details
Details for the file deeplotx-0.4.8-py3-none-any.whl.
File metadata
- Download URL: deeplotx-0.4.8-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d544f3c83386bbb57981ef340123edc22f0c52f9e3c24c0e7b5086cf87559697
|
|
| MD5 |
bf5d3b26755088bd675a3aacae1179e3
|
|
| BLAKE2b-256 |
7cccbb97f486440071c49a16df81bfb4ff1c5664705c6b71389ca8d4b51b5ffe
|