Easy-2-use long text classifier trainers.
Project description
DeepLoT: Easy2UseLongTextClassifierTrainers
Installation
-
Install with pip
pip install git+https://github.com/vortezwohl/DeepLoT.git -
Install with uv
uv add git+https://github.com/vortezwohl/DeepLoT.git
Quick Start
To train a binary classifier for text files:
from deeplot.util import get_files, read_file
from deeplot 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.0.0.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.0.0-py3-none-any.whl
(22.6 kB
view details)
File details
Details for the file deeplotx-0.0.0.tar.gz.
File metadata
- Download URL: deeplotx-0.0.0.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 |
be3a992302f5457f08f9f944205f1aa2a7ac0d38d2d70379027c890466734497
|
|
| MD5 |
bffca4b94a4aa416fd3c5072785cd4a7
|
|
| BLAKE2b-256 |
530a8d6f3c379222b0591f1a5bff2f1c0f0440e5c5442bf6cf79bb5374391401
|
File details
Details for the file deeplotx-0.0.0-py3-none-any.whl.
File metadata
- Download URL: deeplotx-0.0.0-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 |
0c44deb49a30f8aa55f6a0110a00b2643cee31e2e5deff89578b1c09fb2375d6
|
|
| MD5 |
bfb5f5b1f68bb9be8b07b973e5f7da43
|
|
| BLAKE2b-256 |
ea64f496b9af41004a4a1023b21065976c7559538f34116945cac52c1865e5bc
|