Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lonnen/constrained-logits-processors

not ready yet
https://github.com/lonnen/constrained-logits-processors

Last synced: about 1 month ago
JSON representation

not ready yet

Awesome Lists containing this project

README

        

=============================
Constrained Logits Processors
=============================

HuggingFace's `transformers library `_
has a number of logits processors useful for nudging the probability of certain
tokens appearing in text generation models.

This module implements a logits processor that constrains logits for text generation
using a letter bank, similar to scrabble, by masking out tokens that cannot be spelled
with the remaining letters to `-math.Inf`. It doesn't work well and maybe it would be
better implemented as a `Constraint `.

|Build Status|

.. |Build Status| image:: https://github.com/lonnen/constrained-logits-processors/actions/workflows/main.yml/badge.svg?branch=main
:target: https://github.com/lonnen/constrained-logits-processors/actions/workflows/main.yml

:Code: https://github.com/lonnen/constrained-logits-processors
:Issues: https://github.com/lonnen/constrained-logits-processors/issues
:Releases: https://pypi.org/project/constrained-logits-processors/#history
:License: MIT; See LICENSE

Install
=======

To get started, install the library with `pip `_:

.. code-block:: shell

$ pip install git+https://github.com/lonnen/constrained-logits-processors.git

Usage
=====

.. code-block:: python

>>> from constrained_logits_processors import LetterBankLogitsProcessor

>>> # pass