Skip to main content

transformers library new generate API

Project description

synthetic-transformers

Package structure

SyntheticTransformer

Class that will substitute the HuggingFace's PreTrainedModel API. The idea is to use one HuggingFace Transformer and a Tokenizer to initialize this class together with a prompt template and some special plugins as Hooks, Components and Commands. This will create an instance that then you can call as usual with the usual .generate() method.

The idea of this plugins is to give you more control over the generation and allow the LLM to interact with tools in a more dynamic manner.

Hooks

Hooks are one of the two main ways to change how your LLM generates text, they can be triggered by many events and will have access to needed information, such as generated text and others, depending on the activation. There are the following hook types:

  • on-token: this hook runs when a token is generated by the model, it has access to the generated text and can modify it freely.
  • on-command:{command-id}: this hook runs after a command has finished running, it has access to the command input and output and to the
  • on-eos: this hook runs when the end of generation exception has been raised.
  • on-change:{component-id}: this hook runs when a component reports a change.

Commands

Commands are the other way to change how your LLM generates text, they are called by the CommandCall hook that is always added as the last hook in the on-token type. This commands have read and write access to the content and the input of the command.

TODO: Finish this section

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

synthetic_transformers-0.1.7.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

synthetic_transformers-0.1.7-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file synthetic_transformers-0.1.7.tar.gz.

File metadata

  • Download URL: synthetic_transformers-0.1.7.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.1 Linux/6.11.0-1018-azure

File hashes

Hashes for synthetic_transformers-0.1.7.tar.gz
Algorithm Hash digest
SHA256 67617b1b05b7769b8fb580becd0371e41150e416ffad53a48ad3a99794774764
MD5 d80ac76586e0c30d874fcfd754e0bcbb
BLAKE2b-256 6feddd088f338bc87c34417a0189bba0ed2b832d1d06c3031920fa889337c63b

See more details on using hashes here.

File details

Details for the file synthetic_transformers-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for synthetic_transformers-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f6fadbc6a33c2a28739fef371d15efa3afd0a1ae7e3f7bbb321bbcbe7b9d59da
MD5 36c32916e644109e8582953eb7468d7b
BLAKE2b-256 798cae69495ae9f3981653fe9889cab75d8347a05e927f161c83ef1048aa3e14

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