facebookresearch / beanmachine

A library that allows for inference on probabilistic models
https://beanmachine.org/
MIT License
264 stars 49 forks source link

Ignore TorchScript warning introduced in PyTorch 1.13 when using NNC #1796

Closed horizon-blue closed 1 year ago

horizon-blue commented 1 year ago

Summary: In PyTorch (and functorch) 1.13, nnc_jit raises the following warning that breaks our CI:

import torch
from functorch.compile import nnc_jit
nnc_jit
def f(x):
    return x ** 2
x0 = torch.tensor(2.0)
print(f(x0))

outputs:

.../lib/python3.8/site-packages/torch/jit/_check.py:181: UserWarning: The TorchScript type system doesn't support instance-level annotations on empty non-base types in `__init__`. Instead, either 1) use a type annotation in the class body, or 2) wrap the type in `torch.jit.Attribute`.
  warnings.warn("The TorchScript type system doesn't support "
tensor(4.)

As a temporary workaround, let's add this warning to our filter warning list to keep our test signal green.

Differential Revision: D40821675

facebook-github-bot commented 1 year ago

This pull request was exported from Phabricator. Differential Revision: D40821675