Fallback for unsupported Hybrid Engine policies (#8265)
## Summary
- register Hybrid Engine auxiliary Linear/Embedding/LayerNorm policies
only when the model contains a supported complete transformer policy
- allow unsupported architectures such as Qwen2.5 to retain the native
`generate()` fallback
- add CPU-only unit coverage for supported and unsupported policy
registration
Fixes #8263.
## Why
The generic wrappers are auxiliary pieces of a complete transformer
injection policy. Registering them when no transformer layer matches
creates a partial inference path. With a ZeRO-3-partitioned Qwen model,
container construction can then reach `_mark_uc_metadata()` with a
one-dimensional normalization weight and fail on `weight.shape[1]`.
The change first builds the complete-policy map and checks it against
the model's module classes. If no complete policy matches, the map
remains empty, no partial containers are created, and Hybrid Engine
leaves the model's native generation method intact. Supported model
behavior is unchanged.
## Validation
- `pytest -q tests/unit/hybrid_engine/test_he_policy.py` (`2 passed`)
- `pre-commit run --files deepspeed/runtime/hybrid_engine.py
tests/unit/hybrid_engine/test_he_policy.py`
- Qwen2.5-0.5B / Qwen2.5-Math-7B OPSD completed a full prompt epoch and
a separate 200-step run on 8 x MI250 with the fallback
---------
Signed-off-by: LiRunGuo <li19107254665@gmail.com>
Co-authored-by: Ma, Guokai <guokai.ma@gmail.com>