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.3.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.3-py3-none-any.whl
(26.6 kB
view details)
File details
Details for the file deeplotx-0.4.3.tar.gz.
File metadata
- Download URL: deeplotx-0.4.3.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3fc672b56750e005b61371e15eb6100cfb67d35c64f9e3e1942f739f08232df
|
|
| MD5 |
e1ddff3e6dc8f89a8b18aa3c08bb21dc
|
|
| BLAKE2b-256 |
6338197cd1533a95b1696d52be6b9c4f9dbcfac55a7c14b567206e3532937048
|
File details
Details for the file deeplotx-0.4.3-py3-none-any.whl.
File metadata
- Download URL: deeplotx-0.4.3-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da1667676ec11efeaecbfe33fcf7a6d276e8f628411f829ef0206effc93d7bc5
|
|
| MD5 |
86892fe9db4cf0951f5ce8201c1538a8
|
|
| BLAKE2b-256 |
4ea5794611ec3dc770f5a563ef05c5b3c5147dc3d19f58c8f2b3377228bf3ec7
|