Models
Managers for loading models
- construe.models.loaders.load_all_models(model_home=None)[source]
Load all available models as defined by __all__
- construe.models.loaders.cleanup_all_models(model_home=None)[source]
Delete everything in the model home directory
- construe.models.loaders.cleanup_moondream(model_home=None, archive='.zip')
- construe.models.loaders.load_whisper(model_home=None)[source]
Returns a tflite interpreter with the whisper model and the whisper prepocessor.
- construe.models.loaders.cleanup_whisper(model_home=None, archive='.zip')
- construe.models.loaders.cleanup_mobilenet(model_home=None, archive='.zip')
- construe.models.loaders.cleanup_mobilevit(model_home=None, archive='.zip')
- construe.models.loaders.cleanup_nsfw(model_home=None, archive='.zip')
- construe.models.loaders.cleanup_lowlight(model_home=None, archive='.zip')
- construe.models.loaders.cleanup_offensive(model_home=None, archive='.zip')
- construe.models.loaders.cleanup_gliner(model_home=None, archive='.zip')
TFLite
Utilities for model loading and conversion.
- class construe.models.tflite.TFLiteGenerateModel(model)[source]
Bases:
Module
Defines a model whose serving function is the generation call.
- Attributes:
name
Returns the name of this module as passed or determined in the ctor.
name_scope
Returns a tf.name_scope instance for this class.
non_trainable_variables
Sequence of non-trainable variables owned by this module and its submodules.
submodules
Sequence of all sub-modules.
trainable_variables
Sequence of trainable variables owned by this module and its submodules.
variables
Sequence of variables owned by this module and its submodules.
Methods
with_name_scope
(method)Decorator to automatically enter the module name scope.
serving
Manifest
Manifest handlers for models
Path
Path handling for model downloads
- construe.models.path.get_model_home(path=None)[source]
Return the path of the Construe models directory. This folder is used by model loaders to avoid downloading model parameters several times.
By default, this folder is in a config directory in the users home folderso the model can be can be easily located. Alternatively it can be set by the
$CONSTRUE_MODELS
environment variable, or programmatically by giving a folder path. Note that the'~'
symbol is expanded to the user home directory, and environment variables are also expanded when resolving the path.
- construe.models.path.find_model_path(model, model_home=None, fname=None, ext=None, raises=True)[source]
Looks up the path to the model specified in the models home directory. The storage location of the models can be set with the $CONSTRUE_MODELS environment variable.
If the model is not found a
ModelsError
is raised by default.
- construe.models.path.model_exists(model, model_home=None, fname=None, ext=None)[source]
Checks to see if the specified model exists in the model home directory.
- construe.models.path.model_tflite_exists(model, model_home)[source]
Checks to see if the model .tflite file exists or not.