Skip to main content

Base Jenerator

Abstract base class and return formats for AI Generator classes within the Jeneratorverse, providing a unified API across different media formats.

The idea is, whether you're running Stable Diffusion 1.5 with imagejenerator, or Llama 3.2 with textjenerator, you'll always call the same methods, and get outputs returned to you in the same format.

BaseGenerator class

Contract for generator classes that run model inference.

Abstract methods that must be implmented by subclasses are:

  • load: load the model into memory, and assign the pipeline/model/engine to self.model.
  • prepare: Reset lifecycle without tearing down the model - e.g., reset torch generators, clear cache, etc.
  • generate: The public method that is called to run inference.
  • generate_impl: Subclasses must implement this to run inference. Called by .generate().
  • _quick_wrap: Helper for subclasses to wrap artifacts into the Artfact class.
  • teardown: Purge the model from memory, empty cache, run garbage collector, etc.

GeneratorOutput

Wrapper for artifacts generated. Will always return artifacts in a list in the .artifacts attribute, even for pipelines that return a single artifact (e.g., LLMs, non-batch image generation, etc.). Generation level metadata can be returned in .extras, however you should reserve this for things really cannot be captured anywhere else. The generator classes are meant to be stateless, besides the model/pipline.

They are like toasters - prompt in, artifact out.

Artifact

Represents a single artifact created by the generator. One image, text response, wav file, or whatever.

As with GeneratorOutput you can bundle metadata into .item_extras but again, I recommend leaving that responsibility to the calling app.

Metadata

Release files for basejenerator 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for basejenerator 0.1.0
File Size Uploaded Provenance
basejenerator-0.1.0.tar.gz 3.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for basejenerator 0.1.0
File Interpreter ABI Platform
basejenerator-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / basejenerator-0.1.0.tar.gz

Download URL basejenerator-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ecc7bec45d4b561bff2853d3ebf8fc444bdeb8caad0678079c82638849c52410
BLAKE2b-256 checksum
How to use checksums
2b9ab7b54df970d573ecd03aa05b2beac1035b821b39d7d64c05bd5853335554
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.3 Linux/6.17.0-35-generic

Release files / basejenerator-0.1.0-py3-none-any.whl

Download URL basejenerator-0.1.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
daca52550758b3947cafe482e5d5a1c7d9b89216175497a53f1f1a3c185a3ca8
BLAKE2b-256 checksum
How to use checksums
841faa86719e3ef05402500e9db3c9b904d24fc961f52146636ff4a918efd3f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.3 Linux/6.17.0-35-generic

Security for basejenerator 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page