-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Torch, CI] Support PyTorch 1.7 #6594
Comments
@kevinthesun @yongwww I've taken a look at supporting detection models in 1.6. It turned out we need to convert a function Looking at this code, One of the types of if branch is a zero dim empty tensor of dtype int64 https://github.com/pytorch/vision/blob/6e10e3f88158f12b7a304d3c2f803d2bbdde0823/torchvision/ops/boxes.py#L76 We cannot type check the converted Relay model with Is there a way to turn a static shape tensor to dynamic, when one of |
@yongwww It seems torchvision nms op https://github.com/pytorch/vision/blob/master/torchvision/ops/boxes.py#L35 returns int64 indices, while nms in Relay returns int32 bit indices. We need to cast the output indices to int64, that should resolve the one of typing problem (two branches of |
@masahi That shape problem coming from |
Will generate
while input |
@kevinthesun thanks for pointing this out and providing a minimum test case. I'm going to take a look at what's going on inside type checker and hopefully fix it. With this fixed, I can send a PR to support PyTorch 1.6 mask rcnn and faster rcnn. |
Finding suspicious code was easy, here, when lhs is Returning |
@kevinthesun @jroesch @lixiaoquan @MarisaKirisame I found that this change was introduced in #5795 If I make that above change, that effectively undos that PR and breaks the test case introduced there. Basically, what we want from type checking What should we do about this? I think #5795 should be reverted, since type inference is supposed to pick the most general types. |
Hmmm, I think that PR is an optimization for some cases but is actually not correct since static dim is just a case of In TF frontend there are lots of cases when we want to make expression as static as possible. My guessing is that @lixiaoquan We should revert it? |
Let's summarize steps needed to update our PyTorch support for the latest version, 1.6 (the CI is at 1.4).
Quantization support: It is completely broken due to a bug introduced in 1.6 (see state_dict for quantized models pytorch/pytorch#42497). I found a simple workaround for that problem (finally!) and the fix is WIP. The representation of quantized weights and APIs of quantized ops have changed. To support both 1.6 and older versions, we need to handle both cases (with version check) for now.
torchvision detection model support: Need to add converters for
aten::tensor
,aten::empty
,aten::numel
andaten::IntImplicit
. All of these ops seem trivial. I found that other missing ops I mentioned in [Frontend][Pytorch] Improve Pytorch frontend for object detection models #6449 (comment) can be removed usingtorch._C._jit_pass_onnx_function_substitution(...)
pass. We also need to deal with one functionbatched_nms
that was used to be traced but now it is scripted, see https://github.com/pytorch/vision/blob/6e10e3f88158f12b7a304d3c2f803d2bbdde0823/torchvision/ops/boxes.py#L42-L43We need to solve a typing problem involving
If
and Any type.Disable or fix tests that no longer work. For example, tracing googlenet is broken on Torch 1.5 or higher (see googlenet fires assert for not being an nn.Module with torch.jit.trace() pytorch/vision#2161), so we need to disable googlenet tests.
Upgrade CI docker image
cc @t-vi @siju-samuel @kevinthesun @yongwww @alexwong @tqchen
The text was updated successfully, but these errors were encountered: