[Improvement] Support for candidate multiple dimensional search constraints.#316
Conversation
|
|
||
| self.top_k_candidates = Candidates() | ||
| if resource_estimator_cfg is None: | ||
| if resource_estimator_cfg: |
There was a problem hiding this comment.
Should it be if resource_estimator_cfg is None?
There was a problem hiding this comment.
default resource_estimator_cfg is dict.
There was a problem hiding this comment.
Then directly use self.estimator = ResourceEstimator(**resource_estimator_cfg)
| crossover_candidate = self._crossover() | ||
|
|
||
| if self._check_constraints(random_subnet=crossover_candidate): | ||
| flag = False |
There was a problem hiding this comment.
reify the flag here as it suits the particular judgment of model constraints.
| any to tuple(any, float, float).""" | ||
|
|
||
| def _format_item(item: Any): | ||
| """Transform any to tuple(any, float).""" |
4fdfa3a to
a1fa920
Compare
mmrazor/engine/runner/utils/check.py
Outdated
| assert hasattr(model, 'set_subnet') and hasattr(model, 'architecture') | ||
| model.set_subnet(subnet) | ||
| fix_mutable = export_fix_subnet(model) | ||
| fix_mutable = export_fix_subnet(model, dump_derived) |
| crossover_candidate = self._crossover() | ||
|
|
||
| if self._check_constraints(random_subnet=crossover_candidate): | ||
| flag = False |
|
update type-hint for Candidate::append, extend, insert. It seems that they must accept Dict as input. |
| return subnet | ||
|
|
||
| def _check_constraints(self, random_subnet: SupportRandomSubnet) -> bool: | ||
| def _check_constraints(self, |
| constraints_range (Dict[str, Any]): Constraints to be used for | ||
| screening candidates. Defaults to dict(flops=(0, 330)). | ||
| resource_estimator_cfg (Dict[str, Any]): Used for building a | ||
| resource estimator. Default to dict(). |
There was a problem hiding this comment.
type: Default -> Defaults
| """The data structure of sampled candidate. The format is [(any, float), | ||
| (any, float), ...]. | ||
| """The data structure of sampled candidate. The format is Union[Dict[Any, | ||
| Dict], List[Dict[Any, Dict]]]. |
There was a problem hiding this comment.
The format is List[Dict[Any, Dict]]
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## autoformer_algo_dev #316 +/- ##
======================================================
Coverage ? 82.84%
======================================================
Files ? 190
Lines ? 8375
Branches ? 1307
======================================================
Hits ? 6938
Misses ? 1175
Partials ? 262
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
* Update mmcls pplnn benchmark * Update supported model list
* support for litehrnet * support ncnn vulkan * update supported models * add docstring * add one ut and fix wrapper * add test_shuffleunit * add test_stem_forward * add last ut * fix flake8 * fix yapf * fix lint * fix yapf * fix comments * unified chunk * mv adaptive_avg_pool * fix lint * move adaptive_avg_pool_ncnn * fix lint * symbolic rewriter of adaptive_avg_pool2d * fix lint * fix yapf * fix ci
|
aptsunny,您好!您在MMRazor项目中给我们提的PR非常重要,感谢您付出私人时间帮助改进开源项目,相信很多开发者会从你的PR中受益。 |
Part of Autoformer algo
Motivation
Continued improvements of EvolutionSearchLoop throught multi-resources constraints.
Use cases (Optional)
Modify the search configs file as follow.
Checklist
After PR: