We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
复现代码
import tempfile import oneflow as flow from oneflow_onnx.oneflow2onnx.util import convert_to_onnx_and_check from flowvision.models.face_recognition import iresnet50 model = iresnet50().to("cuda") class ModelGraph(flow.nn.Graph): def __init__(self, model): super().__init__() self.config.allow_fuse_add_to_output(True) self.backbone = model def build(self, x): x = x.to("cuda") out = self.backbone(x) return out model.eval() model_graph = ModelGraph(model) model_graph._compile(flow.randn(1, 3, 112, 112)) with tempfile.TemporaryDirectory() as tmpdirname: flow.save(model.state_dict(), tmpdirname) convert_to_onnx_and_check( model_graph, flow_weight_dir=tmpdirname, onnx_model_path="./", print_outlier=True)
报错
File ~/miniconda/lib/python3.9/site-packages/oneflow_onnx/oneflow2onnx/util.py:102, in compare_result(a, b, rtol, atol, print_outlier) 100 if np.abs(a[i] - b[i]) > atol + rtol * np.abs(b[i]): 101 print("a[{}]={}, b[{}]={}".format(i, a[i], i, b[i])) --> 102 assert np.allclose(a, b, rtol=rtol, atol=atol) AssertionError:
但是 self.config.allow_fuse_add_to_output(True) 这一行注释掉就可以成功转换。
self.config.allow_fuse_add_to_output(True)
The text was updated successfully, but these errors were encountered:
随机初始化的模型,设置成eval时候,bn的running stat可能不稳定导致参数爆炸,可以用预训练的模型权重倒入再测试
Sorry, something went wrong.
No branches or pull requests
复现代码
报错
但是
self.config.allow_fuse_add_to_output(True)
这一行注释掉就可以成功转换。The text was updated successfully, but these errors were encountered: