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 theon-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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file synthetic_transformers-0.1.8.tar.gz.
File metadata
- Download URL: synthetic_transformers-0.1.8.tar.gz
- Upload date:
- Size: 3.4 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16371bba95b763229626726c64bbb4d6f38c9a8bd04ab4ba9d3bb67f357dea19
|
|
| MD5 |
ee428234ae91dd2d134e8ba08c5da021
|
|
| BLAKE2b-256 |
9706928d2243d674356e71428e0366b85365955794525f27f235b6b12a46bd41
|
File details
Details for the file synthetic_transformers-0.1.8-py3-none-any.whl.
File metadata
- Download URL: synthetic_transformers-0.1.8-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.13.1 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a47ca0733c1c59b69cdc850d56709f11469ade4e40448782fb3531e354e659b4
|
|
| MD5 |
dbc029df323e7652c4aaeaf3821ccb89
|
|
| BLAKE2b-256 |
f1ebfc6715502e412abc8312724496a682916ebfaf4d2e1d3795ea5fa071ce46
|