Model management

From VectorSpaceLab/AREX-Skill · View interactive version

Model management is an AI agent skill from the GitHub repository VectorSpaceLab/AREX-Skill. Manage BentoML model stores, model references, framework save/load helpers, optional dependencies, and model troubleshooting for services and builds.

How to use this skill

Skill file

BentoML Model Management

Use this sub-skill when an agent needs to save, inspect, package, load, import/export, or diagnose BentoML models. Keep service endpoint design in ../service-authoring/SKILL.md; keep Bento build/container packaging mechanics in ../packaging-and-containerization/SKILL.md; keep BentoCloud deployment in ../cli-and-cloud/SKILL.md.

First Decision

  1. Need a model dependency in a Service or Bento build? Declare BentoModel("name:version"), BentoModel("name:latest"), or HuggingFaceModel("org/model") as a Service class variable so BentoML can include/resolve it during build and deployment.
  2. Need to put files into BentoML's local store? Use bentoml.models.create(name) as a context manager for arbitrary model directories, or a framework helper such as bentoml.sklearn.save_model() when that framework helper is appropriate and installed.
  3. Need to inspect or move a stored model? Use bentoml models list/get/export/import/delete or the Python equivalents under bentoml.models.
  4. Need to load framework-native objects? Prefer the matching helper (bentoml.sklearn.load_model, bentoml.pytorch.load_model, etc.) only when the stored model's module matches that helper and its optional dependencies are present.

Model Store Essentials

Service Loading Pattern

Declare model dependencies at Service class scope, then load the framework object in __init__ or a method:

import bentoml
from bentoml.models import BentoModel

@bentoml.service
class IrisService:
    model_ref = BentoModel("iris_sklearn:latest")

    def __init__(self):
        import joblib
        self.model = joblib.load(self.model_ref.path_of("model.pkl"))

Class-scope declaration is important: BentoML records the model dependency for build, push, and deployment. Creating BentoModel(...) only inside __init__ can produce a Bento that starts without the referenced model and later fails with a model not found error.

For Hugging Face Hub models, use HuggingFaceModel("org/model") as a class variable and pass the resolved path to transformers loaders in __init__. Private or gated Hub models require the appropriate token in the runtime/build environment; do not bake secrets into skill content or service source.

Commands And APIs

Bundled Helpers

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.