[core] add model metadata parser to ome agent#172
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @slin1237, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a new model-metadata agent to the OME framework, designed to automatically extract crucial metadata from machine learning models stored in Kubernetes Persistent Volume Claims (PVCs). This enhancement is a key part of the OEP-0004 PVC Storage Support initiative, enabling OME to enrich BaseModel and ClusterBaseModel Custom Resources with details like model type, architecture, parameter count, and capabilities, without requiring the models to be downloaded or accessed via object storage.
Highlights
- New Agent Introduction: I've added a new
model-metadataagent to theome-agentframework, specifically designed to run as a Kubernetes Job. This agent is a key component for enabling PVC Storage Support (OEP-0004). - Automated Metadata Extraction: The agent automatically extracts comprehensive metadata from machine learning models stored in Kubernetes PVCs. It leverages the robust
hfutil/modelconfigparser, supporting over 20 model types, eliminating the need to download models for metadata retrieval. - CR Update Logic: It updates
BaseModelandClusterBaseModelCustom Resources with the extracted metadata. A crucial design choice is that it only populates fields that are not already set, preserving any user-specified values. - Capability Inference: The agent includes intelligent logic to infer model capabilities (e.g., text-generation, vision, embeddings) based on the model's architecture and type, enriching the CRs with valuable functional information.
- Kubernetes Client Utility: A new shared Kubernetes client utility (
k8sclient.go) has been introduced, providing a consistent way forome-agentcomponents to interact with the Kubernetes API.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable model-metadata agent for extracting metadata from models stored in PVCs. The review focuses on improving robustness and maintainability by addressing a potential panic, removing duplicated code, and eliminating a redundant validation call.
d7ae3d3 to
49f3b79
Compare
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR implements the model metadata extraction agent as part of OEP-0004 (PVC Storage Support). The new
model-metadataagent enables OME toextract metadata from models stored in Kubernetes PVCs without requiring the model to be downloaded or accessible via object storage.
Key changes:
model-metadataagent to the ome-agent framework that can be run as a Kubernetes Jobhfutil/modelconfigparser for robust support of 20+ model typesArchitecture decisions:
Which issue(s) this PR fixes:
Related to OEP-0004: PVC Storage Support implementation
Special notes for your reviewer:
Configuration approach: Unlike other agents that read from static YAML config, this agent uses command-line flags because it's designed to be
run as a Kubernetes Job with dynamic parameters from the BaseModel controller.
Code organization: Following reviewer feedback, the implementation:
pkg/hfutil/modelconfiginstead of custom parsing logicTesting: Comprehensive unit tests cover config extraction, metadata parsing, and CR updates for both BaseModel and ClusterBaseModel
scenarios.
Files structure:
cmd/ome-agent/model_metadata_agent.gointernal/ome-agent/model-metadata/config/ome-agent/model-metadata.yamladdress
#163 #160
Does this PR introduce a user-facing change?