validate.seg.model_registry#
Maintain a log of installed cerr.ai_models models to avoid re-installing.
Each entry also holds the SHA-256 of the model’s weights, with the weights’ size and modification time when hashed, so the hash is only recomputed when the weights change (see getWeightsHash).
Functions
Last-used install base directory, or None if nothing installed yet. |
|
|
Return (installStatus, record). |
|
SHA-256 of an installed model's weights, or None if the model isn't recorded or its weights aren't installed. |
|
Install status of a model in installDir (pyCERR's layout): "installed", "no weights" (its code is there but its weights aren't) or "not installed". |
Reads and returns the record of installed models. |
|
|
Records the installation of a new model, with the hash of its weights (None if its weights aren't installed). |
|
Make installDir the recorded install of modelNum, recording it (and hashing its weights) if it isn't already. |
- validate.seg.model_registry.readRegistry()[source]#
Reads and returns the record of installed models.
- validate.seg.model_registry.getInstallInfo(modelNum)[source]#
Return (installStatus, record). The record contains {“modelName”, “installDir”, “installDate”} for modelNum if available or None if not recorded, or recorded but the model’s weights are no longer installed (checked with pyCERR: weights in <installDir>/<repo>/weights/, see install_utils.listInstalledWeights).
- validate.seg.model_registry.recordInstall(modelNum, modelName, installDir)[source]#
Records the installation of a new model, with the hash of its weights (None if its weights aren’t installed).
- validate.seg.model_registry.installStatus(modelNum, installDir)[source]#
Install status of a model in installDir (pyCERR’s layout): “installed”, “no weights” (its code is there but its weights aren’t) or “not installed”.
- validate.seg.model_registry.useInstall(modelNum, modelName, installDir)[source]#
Make installDir the recorded install of modelNum, recording it (and hashing its weights) if it isn’t already.
- Raises:
RuntimeError – the model’s weights aren’t installed in installDir.
- validate.seg.model_registry.getWeightsHash(modelNum)[source]#
SHA-256 of an installed model’s weights, or None if the model isn’t recorded or its weights aren’t installed.
The hash stored at install time is reused while the weights’ size and modification time are unchanged; otherwise the weights are hashed again and the record updated.