Skip to content

Add real transformer batch inference - #116

Draft
Mayukhga83 wants to merge 1 commit into
KRLabsOrg:mainfrom
Mayukhga83:fix/real-transformer-batching
Draft

Mayukhga83 wants to merge 1 commit into
KRLabsOrg:mainfrom
Mayukhga83:fix/real-transformer-batching

Conversation

@Mayukhga83

@Mayukhga83 Mayukhga83 commented Sep 24, 2026 •

Copy link
Copy Markdown

Summary

  • replace per-example transformer inference with padded whole-list batching and a single model forward pass
  • preserve input order while handling uneven sequence lengths, token and span outputs, confidence filtering, taxonomy typing, and empty inputs
  • reject mismatched prompt/answer lengths for both transformer and LLM batch paths
  • keep benchmark memory reporting portable on platforms without the Unix resource module

Related issue

Closes #23.

Type of change

  • Bug fix
  • Feature
  • Documentation
  • Tests
  • Refactor or maintenance

Testing

  • ruff format --check lettucedetect/ lettucedetect_api/ tests/
  • ruff check lettucedetect/ lettucedetect_api/ tests/ --extend-exclude lettucedetect/integrations/
  • python -m pytest
  • Other: ruff check scripts/benchmark_detectors.py

Checklist

  • I kept the PR focused on one change.
  • I added or updated tests/docs when needed.
  • I checked that no secrets, API keys, or credentials are included.

Rights & sign-off (required)

  • I certify that I have the right to submit this code and that it may be
    distributed under the repository's MIT license
    (see CONTRIBUTING).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for “real” batch processing

1 participant