# State of symbolic shapes branch

**URL:** https://dev-discuss.pytorch.org/t/state-of-symbolic-shapes-branch/777
**Category:** compiler
**Created:** [September 19, 2022, 5:32pm UTC](https://dev-discuss.pytorch.org/t/state-of-symbolic-shapes-branch/777 "2022-09-19T17:32:53Z")
**Posts on this page:** 1
**Showing post:** 40

<div class="post-metadata">

### Author: ![ezyang](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/ezyang/32/12_2.png) [@ezyang](https://dev-discuss.pytorch.org/u/ezyang)
#### Post date: [February 1, 2023, 6:24pm UTC](https://dev-discuss.pytorch.org/t/state-of-symbolic-shapes-branch/777/40 "2023-02-01T18:24:59Z")

</div>

# Mini-update: Dynamic shapes enablement for OpenNMT

vince62s has been interested in using using dynamic shapes with OpenNMT. I haven’t had a chance to try the full model, but a small extracted example is (mostly) successfully compiling in a size generic way when run with dynamic shapes. Check out my summary comment for more details!

> <https://github.com/pytorch/pytorch/issues/93468#issuecomment-1412520722>
>
> \### 🐛 Describe the bug
> 
> While giving a try with pytorch2 on OpenNMT-py
> 
> using …these two lines:
> \`\`\`
> rawmodel = build\_model(model\_opt, opt, vocabs, checkpoint)
> model = torch.compile(rawmodel, fullgraph=True, backend='nvprims\_aten')
> \`\`\`
> 
> \### Error logs
> 
> getting this:
> \`\`\`
> from user code:
> File "/home/vincent/nlp/OpenNMT-py/onmt/encoders/transformer.py", line 126, in forward
> mask = ~sequence\_mask(src\_len).unsqueeze(1)
> File "/home/vincent/nlp/OpenNMT-py/onmt/utils/misc.py", line 58, in sequence\_mask
> return (torch.arange(0, max\_len, device=lengths.device)
> 
> Set torch.\_dynamo.config.verbose=True for more information
> 
> 
> You can suppress this exception and fall back to eager by setting:
> torch.\_dynamo.config.suppress\_errors = True
> \`\`\`
> 
> \### Minified repro
> 
> \_No response\_
> 
> cc @ezyang @msaroufim @wconstab @bdhirsh @anijain2305 @zou3519 @soumith @ngimel

---

_[View the full topic](https://dev-discuss.pytorch.org/t/state-of-symbolic-shapes-branch/777)._
