-
Notifications
You must be signed in to change notification settings - Fork 270
Refactor IO config to yaml in assets #2311
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
base: main
Are you sure you want to change the base?
Conversation
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 pull request introduces a major refactor of the HuggingFace ONNX I/O configuration system, migrating from hardcoded Python class registries to a flexible YAML-driven approach. The changes enable easier extensibility and clearer configuration management for model optimization workflows.
Changes:
- Replaced Python-based OnnxConfig class registries with YAML configuration files for tasks and diffusers components
- Introduced unified dummy input generators that read specifications from YAML rather than class hierarchies
- Consolidated I/O configuration generation into a single task-driven API with automatic optional input filtering based on model signatures
Reviewed changes
Copilot reviewed 29 out of 34 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| olive/assets/io_configs/tasks.yaml | Defines input/output specifications for 15+ HuggingFace tasks |
| olive/assets/io_configs/diffusers.yaml | Defines I/O specs for diffusers components (SD, SDXL, SD3, Flux, Sana) |
| olive/assets/io_configs/defaults.yaml | Provides default dimension values and attribute aliases for config resolution |
| olive/common/hf/io_config/yaml_loader.py | YAML loading and config resolution utilities with LRU caching |
| olive/common/hf/io_config/task_config.py | New unified API for generating I/O configs and dummy inputs |
| olive/common/hf/io_config/input_generators.py | Refactored to use YAML-driven input generation |
| olive/common/hf/model_io.py | Updated to use new task-driven API |
| olive/common/hf/wrapper.py | Migrated to use resolve_alias for config attribute access |
| test/common/hf/io_config/*.py | Updated tests for new YAML-driven system |
Comments suppressed due to low confidence (1)
olive/common/hf/io_config/task_config.py:1
- Missing check for whether 'with_past' key exists in task_spec before accessing it. This will raise a KeyError if a task doesn't define with_past overrides. Add a check:
if self.use_past_in_inputs and 'with_past' in self.task_spec:
# -------------------------------------------------------------------------
This pull request introduces a major refactor of the HuggingFace ONNX I/O configuration system in Olive. The changes move away from hardcoded Python class registries and instead adopt a YAML-driven approach for specifying input/output configurations for both tasks and diffusers pipelines. This enables easier extensibility and clearer, data-driven configuration management. Additionally, the update adds default dummy input shapes and rich configuration templates for tasks and diffusers components.
The most important changes are:
YAML-based IO Configuration System:
defaults.yaml,tasks.yaml,diffusers.yaml) inolive/assets/io_configs/that define default dummy input shapes, task templates, and diffusers component/pipeline specifications for ONNX export. These files replace the previous Python-based registries and provide a more flexible and maintainable configuration system. [1] [2] [3]Refactor of IO Config Python Interface:
olive/common/hf/io_config/__init__.pyto remove all hardcoded class registries and mapping logic, and instead import new YAML-driven utility functions (generate_dummy_inputs,get_io_config,get_diffusers_io_config, etc.). This greatly simplifies the interface and shifts responsibility to the new YAML configuration system.Legal and Organizational Improvements:
olive/assets/__init__.pyandolive/assets/io_configs/__init__.py.## Describe your changesChecklist before requesting a review
lintrunner -a(Optional) Issue link