-
Notifications
You must be signed in to change notification settings - Fork 7
Add git registry information during model upload with model-scoped change detection #762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: zeiler <2138258+zeiler@users.noreply.github.com>
@copilot i noticed that it checks for any uncommited files in the entire repo, not just within model_path. Can you update to check within the model_path only please. |
Co-authored-by: zeiler <2138258+zeiler@users.noreply.github.com>
Fixed! The git status checking is now limited to the model path only. Modified Commit: 32c9622 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements automatic git repository detection and metadata attachment during model uploads to provide complete traceability of model versions to their source code state. The implementation adds git integration features that automatically detect repository information, warn about uncommitted changes in the model directory only, and attach git metadata to model versions.
Key changes include:
- Added three new git-related methods to ModelBuilder class for repository detection and status checking
- Implemented model-scoped change detection that only checks for uncommitted files within the model directory
- Added git metadata attachment to model version protobuf with repository URL, commit hash, and branch information
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/runners/test_git_info.py |
Comprehensive test suite covering git and non-git environments, clean/dirty repository states, and metadata attachment |
clarifai/runners/models/model_builder.py |
Core implementation adding git detection, status checking, and metadata attachment methods to ModelBuilder |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@copilot there are errors in the tests only on windows: TestGitInfo.test_check_git_status_clean_repo _________________ path = 'C:\Users\RUNNER~1\AppData\Local\Temp\tmp132bcxue\test_model\.git\objects\24'
E PermissionError: [WinError 5] Access is denied: 'C:\Users\RUNNER~1\AppData\Local\Temp\tmp132bcxue\test_model\.git\objects\24\ce15ab7ead32f98c7ac3edcd34bb2010ff4326 Can you fix please |
Add Windows-compatible cleanup function to handle read-only files in .git directories during test teardown. Uses progressive fallback strategy: normal removal -> permission fixing -> ignore errors. Co-authored-by: zeiler <2138258+zeiler@users.noreply.github.com>
Fixed the Windows test failures! The issue was with test cleanup of temporary directories containing Commit: c957bc6 |
Minimum allowed line rate is |
This PR implements automatic git repository detection and metadata attachment during model uploads to provide complete traceability of model versions to their source code state.
What's Changed
When using
clarifai model upload
, the ModelBuilder now automatically:Detects git repository information - Checks if the model path is within a git repository and extracts:
remote.origin.url
)Warns about uncommitted changes in model directory only - Detects uncommitted changes using
git status --porcelain .
limited to the model path and prompts the user:Attaches git metadata to model version - Includes git information in the model version metadata under the
git_registry
key for full traceability.Key Features
Example Usage
Implementation Details
ModelBuilder
class for git integrationgit status --porcelain .
withcwd=model_folder
Testing
Added comprehensive unit tests covering:
Fixes #761.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.