coremltools
coremltools copied to clipboard
PyTorch to CoreML BatchNorm model SCRIPT conversion v4 fails with "temporary: the only valid use of a module is looking up an attribute but found = prim::SetAttr[name="num_batches_tracked"](%13, %80)"
Relevance:-----------------------------------------------------------
Firstly, while the JIT conversion of the attached test modeland code works fine, the torch.jit.script() fails on the BatchNorm conversion. The conversion of both BatchNorm1D and BatchNorm2D fails which is a blocker for using the script mode and converting dynamic models.
Secondly, I have seen another error on prim::SetAttr mentioned in Issue #802 on FasterRCNN conversion which may or may not be related.
Reproducible:-----------------------------------------------------------
Yes
Testcase:-----------------------------------------------------------
Attached. testScripting.bn.txt
Run e.g. as
python3 -O testScripting.bn.py
We see the error with useScriptingFlag = True but you could compare to the JIT models and behavior when used with useScriptingFlag = False
PS: Use can change self.use1DBatchNorm = True to check whether there is any difference in behavior on 1D or 2D BatchNorm. Both give the same error.
Error message/ Log:-----------------------------------------------------------
Traceback (most recent call last):
File "testScripting.bn.py", line 64, in
Same issue 4.0b3 and PyTorch 1.6.0
Hello, have you been able to resolve this issue? @leovinus2001
This is still an issue with coremltools 5.0
Hello, have you been able to resolve this issue? @leovinus2001