Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions torchtitan/experiments/compiler_toolkit/llama3/parallelize.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ def validate_flex_attention_annotation(joint_with_descriptors):

def annotate_llama() -> None:
from torchtitan.models.attention import FlexAttentionWrapper
from torchtitan.models.llama3.model.model import TransformerBlock

# Mark TransformerBlock.forward as nested_compile_region
TransformerBlock.forward = torch.compiler.nested_compile_region(TransformerBlock.forward)

# annotate flex_attention with compile_with_inductor
FlexAttentionWrapper.forward = annotate_fn(
Expand Down
Loading