-
Notifications
You must be signed in to change notification settings - Fork 88
[FEATURE] Add ImageReward Metric #133
Copy link
Copy link
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
✨ What You’ll Do
Adding more metrics makes Pruna’s evaluations way more insightful, so we’re super excited to welcome ImageReward (paper) (repo) into our metric lineup!
🛠️ Dependency
- Add
image-rewardto yourpyproject.tomlso that the ImageReward model can be imported.
📐 Metric Class
For the full deep-dive on Pruna metrics (class structure, state handling, tests, registration), check out our guide:
Customize a Metric
Quick Overview
-
File & Class
- Create
pruna/evaluation/metrics/metric_image_reward.py - Inherit from
StatefulMetric
- Create
-
Configuration
- Choose a sensible
call_typeand setmetric_name = "image_reward" - Define and register any internal state via
self.add_state(...)
- Choose a sensible
-
Implement Core Methods
update(x, gt, outputs)- Receive inputs, ground truths, and model outputs
- Feed the generated images into the ImageReward model to compute per-image scores
- Accumulate scores in your state variables
compute()- Aggregate your state (e.g., average all scores)
- Return a result with name
"image_reward"and the aggregated float
-
Registration
- Use the
@MetricRegistry.register("image_reward")decorator so users can invoke your metric by name
- Use the
-
Testing & Docs
- Write unit tests under
tests/evaluation/metrics/test_image_reward.py - Update
user_manual/evaluation.rstto mention"image_reward"
- Write unit tests under
✅ Acceptance Criteria
- Single Load: The ImageReward model is loaded once in the metric’s constructor.
- Correct Output:
compute(...)returns a sensible result (e.g. if available a public benchmark score!) - Tests & Docs: All existing and new unit tests pass, and the documentation is updated!
❓ Questions?
Feel free to jump into our Discord channel if you hit any roadblocks, can’t wait to see your contribution! 🎉
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers