fix(inspector): route artifacts to format-specific extractors (#15)#45
Merged
Conversation
- Add format detection via extension + magic bytes before any load attempt - Add TorchExtractor: torch.load(..., weights_only=True), extracts state dict keys, param count, or layer names for full models - Add OnnxExtractor: onnx.load, extracts opset, op types, inputs/outputs with dim_param preserved for dynamic axes - Add SafetensorsExtractor: header-only read via safe_open, extracts tensor keys, shapes, metadata - Add DirectoryExtractor: JSON reads only (config.json, tokenizer_config.json), no model loading - PickleExtractor: joblib.load first, fallback to pickle.load - GenericExtractor: fallback for unknown extensions - Subprocess always exits 0; errors captured per-layer in raw[errors] - Add raw_facts, confidence, inspection_errors to ArtifactMetadata - Add format-specific optional dep groups to pyproject.toml - Add tests covering all new extractors and graceful fallback paths - Install optional extras in CI with uv cache; importorskip guards on all framework-specific tests - Update docs/cli/deploy.md: replace pickle-centric framework table with format/extractor table; fix step 1 description
atkaridarshan04
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the monolithic pickle-only inspector script with format-specific extractors. Fixes crashes on .onnx and .safetensors files (UnpicklingError) and missing state dict / layer metadata for .pt files.
Changes
SafetensorsExtractor (header-only), DirectoryExtractor (JSON reads only), PickleExtractor (joblib → pickle), GenericExtractor fallback;
subprocess always exits 0; adds raw_facts, confidence, inspection_errors to ArtifactMetadata
guards on all framework-specific tests
Type
Testing
Related Issues
Closes #15