Skip to main content

Easy-2-use long text classifier trainers.

Project description

DeepLoTX: Easy2UseLongTextClassifierTrainers

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 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


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.3.2.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deeplotx-0.3.2-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file deeplotx-0.3.2.tar.gz.

File metadata

  • Download URL: deeplotx-0.3.2.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for deeplotx-0.3.2.tar.gz
Algorithm Hash digest
SHA256 38a6a0e881723ee8bf00e57bcc49c6bb520faf719c61226dfcbf966e9e907c69
MD5 829b1c69812f7c2ed80f2226cf92baaf
BLAKE2b-256 0d2bb51f8ffd455f6a3fdbddf13e7ecf89c51f7894c99bae003d5780c0edbac0

See more details on using hashes here.

File details

Details for the file deeplotx-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: deeplotx-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for deeplotx-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1ba075f96d65226e236ece3217c0ad82c2af8038f65ab1777e087aec7d3a4121
MD5 6cdd43b2b7c64ac652daf253b3be9700
BLAKE2b-256 72c1f5e483cfeab78938f7fb80e91ca84793cd69f4a0ddc791a0d70ce8551d85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page