Skip to main content

Utilities to compute boosted probabilities and identify dominant tokens.

Project description

boostedprob

Utilities to compute "dominant tokens" and derive boosted probabilities from model log-probabilities.

Install

  • Locally (development editable install):
python -m pip install -e .
  • From GitHub (example):
python -m pip install "git+https://github.com/yourusername/boostedprob.git"

Example

import torch
import boostedprob

# log_probs: shape [batch, seq_len, vocab]
# target: shape [batch, seq_len]
# (fill with your model outputs)

log_probs = torch.log_softmax(torch.randn(2, 4, 1000), dim=-1)
target = torch.randint(0, 1000, (2, 4))

scores = boostedprob.calculate_boostedprob(log_probs, target)
print(scores.shape)  # -> (2, 4)

Build & publish

python -m pip install --upgrade build twine
python -m build
python -m twine upload dist/*

Or test first on TestPyPI (recommended).

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

boostedprob-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

boostedprob-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file boostedprob-0.1.0.tar.gz.

File metadata

  • Download URL: boostedprob-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for boostedprob-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56f1316c9a9ab788bb1f63152fad731c4b45fcbb3a8971f56ed8638e062093df
MD5 72ec52269b627ba5b7cb5a20f1846980
BLAKE2b-256 8720edfaaffa2d84a28b56716b974db8a80ba03f74325bb8c364777131725f30

See more details on using hashes here.

File details

Details for the file boostedprob-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: boostedprob-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for boostedprob-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3dc0e6984a205fbbe0fac966afc8a57e9f069d70109f3463e52d7ab4afad8ff8
MD5 ba6991ab20038577475b05d2a3ccd40a
BLAKE2b-256 85d6df6fa6ddc0f229b5a8c12c0b0c5739bbb9baea430700a809ca32334074ac

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