Easy-2-use long text classifier trainers.
Project description
DeepLoTX: Easy2UseLongTextClassifierTrainers
Installation
-
Install with pip
pip install git+https://github.com/vortezwohl/DeepLoTX.git -
Install with uv
uv add git+https://github.com/vortezwohl/DeepLoTX.git
Quick Start
To train a binary classifier for 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.2.19.tar.gz
(19.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.2.19-py3-none-any.whl
(22.6 kB
view details)
File details
Details for the file deeplotx-0.2.19.tar.gz.
File metadata
- Download URL: deeplotx-0.2.19.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4cc3b04e713fbc67c7d9262ee45da1b68c4cf59263f551bf7c6bd4cb72b9124
|
|
| MD5 |
5c2448d4560bf6c516e1489cb4d56351
|
|
| BLAKE2b-256 |
e0feb03b1b384caf88f851b8b4aa72648fda7c18f11ac9e2369de6a8171fec54
|
File details
Details for the file deeplotx-0.2.19-py3-none-any.whl.
File metadata
- Download URL: deeplotx-0.2.19-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8e3b778be4813a3543d7957140b3e13c6f008742a76522a29f8107fcbbd79d9
|
|
| MD5 |
636f54576e938df5eb73727b173b72d6
|
|
| BLAKE2b-256 |
1aa0e8b2c028d137335fb0d49bbf2a989dab0e9422b0338bd5c6f2c73653d8e3
|