Add Transformer Engine compatibility shim, fallbacks, and modernize TE pins - #2
Open
LilBadger wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
cosmos_predict1/utils/te_compat.pythat exposesRMSNorm,apply_rotary_pos_emb,check_set_window_size,split_along_dim,DotProductAttention(if available), andInferenceParamsfallbacks; it tries public TE APIs first and falls back to pure-PyTorch implementations when needed._RMSNormby switching to the compatRMSNormincosmos_predict1/autoregressive/utils/parallel.pyand using a safe forward path when TE internals are not present.cosmos_predict1/diffusion/module/attention.pyto use the compatRMSNormand the existing compatapply_rotary_pos_embso modules no longer import TE internals directly.requirements.txttotransformer-engine>=2.11,<3andtransformer-engine-torch>=2.11,<3, and updatedscripts/install_blackwell_wsl.shaccordingly.scripts/check_te_compat.pythat imports main inference entrypoints and printsTE_AVAILABLE,TE_DotProductAttention_available, and whether the TE fast-path is enabled (script returns WARN for environment/system-lib import issues instead of failing).Testing
python scripts/check_te_compat.py; the script executed and reportedTE_AVAILABLE=False,TE_DotProductAttention_available=Falsein this environment and returnedcompat_smoke=WARN(imports warned due to missing system liblibGL.so.1in the minimal CI container, not TE symbol breakage).python -m compileall cosmos_predict1/utils/te_compat.py cosmos_predict1/autoregressive/utils/parallel.py cosmos_predict1/diffusion/module/attention.py scripts/check_te_compat.pyand compilation succeeded.from cosmos_predict1.utils import te_compat; te_compat.RMSNorm(16)which returned the fallbackRMSNormtype successfully.Codex Task