-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Closed
Labels
oncall: pt2triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
Issue description
I intended to use torch.nn.Transformer to build my model, and use torch.compile to compile it. But I found that the model is still eager mode even if I used torch.compile
Code example
import torch
device = "cpu"
model = torch.nn.Transformer(nhead=2, num_encoder_layers=2, d_model=6, dim_feedforward=4).to(device)
print(model)
src = torch.rand(2, 4, 6).to(device)
tgt = torch.rand(4, 4, 6).to(device)
compiled_model = torch.compile(model)
out = compiled_model(src, tgt)
print(out)
- PyTorch or Caffe2: Pytorch
- PyTorch version: 2.0.0
- Python version: 3.8
cc @jbschlosser @bhosmer @cpuhrsch @erichan1 @drisspg @ezyang @msaroufim @wconstab @ngimel @bdhirsh @anijain2305
Metadata
Metadata
Assignees
Labels
oncall: pt2triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module