DeepSpeed
f47a963d - Avoid circuler import caused by Hybrid Engine and OPT model (#8737)

Commit
32 days ago
Avoid circuler import caused by Hybrid Engine and OPT model (#8737) Importing `transformers.modeling_utils` before DeepSpeed can create a circular import with Transformers 4.51.3. Hybrid Engine eagerly resolves an OPT model class while Transformers is still defining `PreTrainedModel`, so even loading an ordinary, unfused Transformers checkpoint can fail in a fresh process. This PR resolves `OPTLearnedPositionalEmbedding` only when Hybrid Engine populates policies and the Hugging Face OPT policy is available. Keep the existing OPT embedding policy mapping and direct import behavior, while preserving auxiliary policy registration for non-Hugging-Face models. I encountered this issue while reviwing a new test in #8645 and would like to address the root cause rather than work around it in the test. --------- Signed-off-by: Masahiro Tanaka <tanaka.masahiro@gmail.com>
Author
Parents
Loading