Error when splitting onnx model
I encountered an error while attempting to run tract on a split of a model (produced by onnx.utils.extract_model).
The steps to reproduce the error are as follows:
I have an ONNX model named "network_complete.onnx" (the file is attached).
- Splittiing the model (network_complete.onnx)
input_path = "network_complete.onnx"
output_path = "network_split_0.onnx"
input_names = ["input"]
output_names = ["/Add_output_0"]
onnx.utils.extract_model(input_path, output_path, input_names, output_names, check_model=False)
output_path = "network_split_1.onnx"
input_names = ["/Add_output_0"]
output_names = ["output"]
onnx.utils.extract_model(input_path, output_path, input_names, output_names,check_model=False)
- Using tract by
tract -O network_split_0.onnx -i 1,3,224,224 dump
will produce error:
0 Source input ┃ ━━━ 1,3,224,224,F32 ┣┓ ┃┣ 5 Shape /Shape ┃┃ ━━━ 4,TDim 1, 3, 224, 224 ┃┣┻ 7 Gather /Gather ┃┃ ━━━ ,TDim 1 ┃┣ 18 AddDims /Unsqueeze ┃┃ ━━━ 1,TDim 1 ┃┣┻┻ 21 InferenceConcat /Concat ┃┃ ━━━ 3,TDim 1, -1, -1 ┃┣┻ 23 Reshape /Reshape ┃┣┓ ┃┃┣ 24 Shape /Shape_1 ┃┃┃ ━━━ 1,TDim 3 ┃┃┣ 25 ConstantOfShape /ConstantOfShape ┃┃┃ ━━━ unk__0,? ┃┃┣┓ ┃┃┃┣┻ 27 Mul /Mul
┃┣━━┓┃ ┃┃┃┣┻ 28 Equals /Equal ┃┃┃┃ ━━━ 3,Bool ┃┗━┓ ┃┗┓┃ ┃┣┻┻ 29 Iff /Where ┃┃ ━━━ 3,? ┃┣┻ 30 MultiBroadcastTo /Expand ┃┃ ━━━ unk__1,unk__2,192,F32 ┗┓ ┃┣┻┻ 8 ConvHir /patch_embed/proj/Conv ┃┃ ━━━ 1,192,14,14,F32 ┃┣┓ ┃┃┣ 9 Shape /patch_embed/Shape ┃┃┃ ━━━ 4,TDim 1, 192, 14, 14 ┃┃┣┻┻┻ 13 StridedSlice /patch_embed/Slice ┃┃┃ ━━━ 2,TDim 1, 192 ┃┃┣┻ 15 InferenceConcat /patch_embed/Concat ┃┃┃ ━━━ 3,TDim 1, 192, -1 ┃┣┻ 16 Reshape /patch_embed/Reshape ┃┃ ━━━ 1,192,196,F32 ┃┣ 17 PermuteAxes /patch_embed/Transpose ┃┃ ━━━ 1,196,192,F32 ┣┻ 31 InferenceConcat /Concat_1 ┃ ━━━ ..,F32 ┣┻ 32 Add /Add ━━━ ..,F32 [2024-04-08T16:01:42.287634759Z ERROR tract] Error at stage "analyse"
Caused by:
0: ModelBuildingError
1: Failed analyse for node #25 "/ConstantOfShape" ConstantOfShape
2: Infering facts
3: Applying rule outputs[0].shape[0] == Val(3)
4: Impossible to unify Sym(unk__0) with Val(3).
Also running tract on the second part of the network will face error:
tract -O network_split_1.onnx -i 1,197,192 dump
┏ 0 Source /Add_output_0 ┃ ━━━ 1,197,192,F32 ┣┓ ┃┣ 29 Reduce<Mean> /blocks.0/ReduceMean ┃┃ ━━━ 1,197,F32 ┃┣ 30 AddDims /blocks.0/Unsqueeze ┃┃ ━━━ 1,197,1,F32 ┣━┓ ┃┃┣ 31 Shape /blocks.0/Shape ┃┃┃ ━━━ unk__3,? ┃┃┣┻ 33 Gather /blocks.0/Gather ┃┃┃ ━━━ ? ┃┃┣┓ ┃┃┃┣ 36 AddDims /blocks.0/Unsqueeze_1 ┃┃┃┃ ━━━ 1,? ┃┃┃┣┻┻ 37 InferenceConcat /blocks.0/Concat ┃┃┃┃ ━━━ 3,? ┃┃┃┣┻ 39 Reshape /blocks.0/Reshape ┃┃┃┣┓ ┃┃┃┃┣ 40 Shape /blocks.0/Shape_1 ┃┃┃┃┃ ━━━ 1,TDim 3 ┃┃┃┃┣ 41 ConstantOfShape /blocks.0/ConstantOfShape ┃┃┃┃┃ ━━━ unk__4,? ┃┃┃┃┣┓ ┃┃┃┃┃┣┻ 43 Mul /blocks.0/Mul
┃┃┃┣━━┓┃ ┃┃┃┃┃┣┻ 44 Equals /blocks.0/Equal ┃┃┃┃┃┃ ━━━ 3,Bool ┃┃┃┗━┓ ┃┃┃┗┓┃ ┃┃┃┣┻┻ 45 Iff /blocks.0/Where ┃┃┃┃ ━━━ 3,? ┃┗┓┃ ┃┃┣┻ 46 MultiBroadcastTo /blocks.0/Expand ┃┃┃ ━━━ ..,F32
┣━━┓┃ ┃┃┣┻ 47 Sub /blocks.0/Sub ┃┃┃ ━━━ ..,F32 ┃┃┣┓ ┃┃┃┣┻ 49 Pow /blocks.0/Pow ┃┃┃┣ 50 Reduce<Mean> /blocks.0/ReduceMean_1 ┃┃┃┣ 51 Sqrt /blocks.0/Sqrt ┃┃┃┣ 52 AddDims /blocks.0/Unsqueeze_2 ┃┗━┓ ┃┃┃┣ 55 AddDims /blocks.0/Unsqueeze_3 ┃┃┃┃ ━━━ 1,? ┃┃┃┣┻┻ 56 InferenceConcat /blocks.0/Concat_1 ┃┃┃┃ ━━━ 3,? ┃┃┃┣┻ 58 Reshape /blocks.0/Reshape_1 ┃┃┃┣┓ ┃┃┃┃┣ 59 Shape /blocks.0/Shape_2 ┃┃┃┃┃ ━━━ 1,TDim 3 ┃┃┃┃┣ 60 ConstantOfShape /blocks.0/ConstantOfShape_1 ┃┃┃┃┃ ━━━ unk__5,? ┃┃┃┃┣┓ ┃┃┃┃┃┣┻ 62 Mul /blocks.0/Mul_1
┃┃┃┣━━┓┃ ┃┃┃┃┃┣┻ 63 Equals /blocks.0/Equal_1 ┃┃┃┃┃┃ ━━━ 3,Bool ┃┃┃┗━┓ ┃┃┃┗┓┃ ┃┃┃┣┻┻ 64 Iff /blocks.0/Where_1 ┃┃┃┃ ━━━ 3,? ┃┃┣┻ 65 MultiBroadcastTo /blocks.0/Expand_1 ┃┃┣┻ 67 Add /blocks.0/Add ┃┣┻ 68 Div /blocks.0/Div ┃┣┻ 69 Mul /blocks.0/Mul_2 ┃┣┻ 70 Add /blocks.0/Add_1 ┃┣┓ ┃┃┣┻ 80 MatMulInference /blocks.0/attn/qkv/MatMul ┃┃┣┻ 81 Add /blocks.0/attn/qkv/Add ┃┃┃ ━━━ ..,F32 ┃┃┣┓ ┃┃┃┣┻┻┻┻ 86 StridedSlice /blocks.0/attn/Slice ┃┣━━┓ ┃┃┃┃┣ 71 Shape /blocks.0/attn/Shape ┃┃┃┃┃ ━━━ unk__6,TDim ┃┃┃┃┣┻ 73 Gather /blocks.0/attn/Gather ┃┃┃┃┃ ━━━ TDim ┃┃┃┃┣┓ ┃┃┃┃┃┣ 101 AddDims /blocks.0/attn/Unsqueeze ┃┃┃┃┃┃ ━━━ 1,TDim ┃┣━━━━┓ ┃┃┃┃┃┃┣ 74 Shape /blocks.0/attn/Shape_1 ┃┃┃┃┃┃┃ ━━━ unk__7,TDim ┃┃┃┃┃┃┣┻ 76 Gather /blocks.0/attn/Gather_1 ┃┃┃┃┃┃┃ ━━━ TDim ┃┃┃┃┃┃┣┓ ┃┃┃┃┃┃┃┣ 102 AddDims /blocks.0/attn/Unsqueeze_1 ┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┗━━━━━┓ ┃┃┃┃┃┃┃┣ 77 Shape /blocks.0/attn/Shape_2 ┃┃┃┃┃┃┃┃ ━━━ unk__8,TDim ┃┃┃┃┃┃┃┣┻ 79 Gather /blocks.0/attn/Gather_2 ┃┃┃┃┃┃┃┃ ━━━ TDim ┃┃┃┃┃┃┃┣┓ ┃┃┃┃┃┃┃┃┣┻ 98 Div /blocks.0/attn/Div ┃┃┃┃┃┃┃┃┣ 99 onnx.Cast /blocks.0/attn/Cast ┃┃┃┃┃┃┃┃┣ 100 onnx.Cast /blocks.0/attn/Cast_1 ┃┃┃┃┃┃┃┃┣┓ ┃┃┃┃┃┃┃┃┃┣ 104 AddDims /blocks.0/attn/Unsqueeze_2 ┃┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim
┃┃┃┃┃┃┗━┓ ┃ ┃┃┃┃┗━━┓┃ ┃ ┃┃┃┃┃┃┃┣┻┻┻ 105 InferenceConcat /blocks.0/attn/Concat ┃┃┃┃┃┃┃┃ ━━━ 4,TDim ┃┃┗━━━┓┃ ┃┃┃┃┃┃┣┻ 116 Reshape /blocks.0/attn/Reshape ┃┃┃┃┃┃┃ ━━━ ?,?,?,?,F32 ┃┃┃┃┃┃┣ 119 PermuteAxes /blocks.0/attn/Transpose ┃┣━━━━━┓ ┃┃┃┃┃┃┃┣┻┻┻┻ 91 StridedSlice /blocks.0/attn/Slice_1 ┃┃┣━━━━━┓ ┃┃┃┃┃┃┃┃┣ 106 AddDims /blocks.0/attn/Unsqueeze_3 ┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┃┣━━━━━┓ ┃┃┃┃┃┃┃┃┃┣ 107 AddDims /blocks.0/attn/Unsqueeze_4 ┃┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┃┃┃┣━━━━┓ ┃┃┃┃┃┃┃┃┃┃┣ 109 AddDims /blocks.0/attn/Unsqueeze_5 ┃┃┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┃┃┃┃┃┃┣┻┻┻ 110 InferenceConcat /blocks.0/attn/Concat_1 ┃┃┃┃┃┃┃┃┃ ━━━ 4,TDim ┃┃┃┃┃┃┃┣┻ 117 Reshape /blocks.0/attn/Reshape_1 ┃┃┃┃┃┃┃┃ ━━━ ?,?,?,?,F32 ┃┃┃┃┃┃┃┣ 120 PermuteAxes /blocks.0/attn/Transpose_1 ┃┃┃┃┃┃┣┻ 121 MatMulInference /blocks.0/attn/MatMul ┃┃┃┃┃┃┃ ━━━ ..,F32 ┃┃┃┃┃┃┣┻ 123 Mul /blocks.0/attn/Mul ┃┃┃┃┃┃┣ 124 LayerSoftmax /blocks.0/attn/Softmax ┃┗━━━━┓ ┃┃┃┃┃┃┣┻┻┻┻ 96 StridedSlice /blocks.0/attn/Slice_2 ┃┣━━━━━┓ ┃┃┃┃┃┃┃┣ 111 AddDims /blocks.0/attn/Unsqueeze_6 ┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┣━━━━━┓ ┃┃┃┃┃┃┃┃┣ 112 AddDims /blocks.0/attn/Unsqueeze_7 ┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┃┃┗━━━┓ ┃┃┃┃┃┃┃┃┣ 114 AddDims /blocks.0/attn/Unsqueeze_8 ┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┃┃┃┃┣┻┻┻ 115 InferenceConcat /blocks.0/attn/Concat_2 ┃┃┃┃┃┃┃ ━━━ 4,TDim ┃┃┃┃┃┣┻ 118 Reshape /blocks.0/attn/Reshape_2 ┃┃┃┃┃┃ ━━━ ?,?,?,?,F32 ┃┃┃┃┃┣ 125 PermuteAxes /blocks.0/attn/Transpose_2 ┃┃┃┃┣┻ 126 MatMulInference /blocks.0/attn/MatMul_1 ┃┃┃┃┃ ━━━ ?,?,?,?,F32 ┃┃┃┃┣ 127 PermuteAxes /blocks.0/attn/Transpose_3 ┃┗━━┓ ┃┃┃┃┣ 128 AddDims /blocks.0/attn/Unsqueeze_9 ┃┃┃┃┃ ━━━ 1,TDim ┃┗━━┓ ┃┃┃┃┣ 129 AddDims /blocks.0/attn/Unsqueeze_10 ┃┃┃┃┃ ━━━ 1,TDim ┃┗━━┓ ┃┃┃┃┣ 130 AddDims /blocks.0/attn/Unsqueeze_11 ┃┃┃┃┃ ━━━ 1,TDim ┃┃┣┻┻ 131 InferenceConcat /blocks.0/attn/Concat_3 ┃┃┃ ━━━ 3,TDim ┃┣┻ 132 Reshape /blocks.0/attn/Reshape_3 ┃┃ ━━━ ..,F32 ┃┣┻ 133 MatMulInference /blocks.0/attn/proj/MatMul ┃┣┻ 134 Add /blocks.0/attn/proj/Add ┃┃ ━━━ ..,F32 ┣┻ 135 Add /blocks.0/Add_2 ┃ ━━━ ..,F32 ┣┓ ┃┣ 136 Reduce<Mean> /blocks.0/norm2/ReduceMean
┣━┓┃ ┃┣┻ 137 Sub /blocks.0/norm2/Sub ┃┣┓ ┃┃┣┻ 139 Pow /blocks.0/norm2/Pow ┃┃┣ 140 Reduce<Mean> /blocks.0/norm2/ReduceMean_1 ┃┃┣┻ 142 Add /blocks.0/norm2/Add ┃┃┣ 143 Sqrt /blocks.0/norm2/Sqrt ┃┣┻ 144 Div /blocks.0/norm2/Div ┃┣┻ 145 Mul /blocks.0/norm2/Mul ┃┣┻ 146 Add /blocks.0/norm2/Add_1 ┃┣┻ 147 MatMulInference /blocks.0/mlp/fc1/MatMul ┃┣┻ 148 Add /blocks.0/mlp/fc1/Add ┃┃ ━━━ ..,F32 ┃┣┓ ┃┃┣┻ 150 Div /blocks.0/mlp/act/Div ┃┃┣ 151 Erf /blocks.0/mlp/act/Erf ┃┃┣┻ 153 Add /blocks.0/mlp/act/Add ┃┣┻ 154 Mul /blocks.0/mlp/act/Mul ┃┣┻ 156 Mul /blocks.0/mlp/act/Mul_1 ┃┣┻ 157 MatMulInference /blocks.0/mlp/fc2/MatMul ┃┣┻ 158 Add /blocks.0/mlp/fc2/Add ┃┃ ━━━ ..,F32 ┣┻ 159 Add /blocks.0/Add_3 ┣┓ ┃┣ 160 Reduce<Mean> /blocks.1/ReduceMean ┃┣ 161 AddDims /blocks.1/Unsqueeze ┣━┓ ┃┃┣ 162 Shape /blocks.1/Shape ┃┃┃ ━━━ unk__9,TDim ┃┃┣┻ 164 Gather /blocks.1/Gather ┃┃┃ ━━━ TDim ┃┃┣┓ ┃┃┃┣ 167 AddDims /blocks.1/Unsqueeze_1 ┃┃┃┃ ━━━ 1,TDim ┃┃┃┣┻┻ 168 InferenceConcat /blocks.1/Concat ┃┃┃┃ ━━━ 3,TDim ┃┃┃┣┻ 170 Reshape /blocks.1/Reshape ┃┃┃┣┓ ┃┃┃┃┣ 171 Shape /blocks.1/Shape_1 ┃┃┃┃┃ ━━━ 1,TDim 3 ┃┃┃┃┣ 172 ConstantOfShape /blocks.1/ConstantOfShape ┃┃┃┃┃ ━━━ unk__10,? ┃┃┃┃┣┓ ┃┃┃┃┃┣┻ 174 Mul /blocks.1/Mul
┃┃┃┣━━┓┃ ┃┃┃┃┃┣┻ 175 Equals /blocks.1/Equal ┃┃┃┃┃┃ ━━━ 3,Bool ┃┃┃┗━┓ ┃┃┃┗┓┃ ┃┃┃┣┻┻ 176 Iff /blocks.1/Where ┃┃┃┃ ━━━ 3,? ┃┗┓┃ ┃┃┣┻ 177 MultiBroadcastTo /blocks.1/Expand
┣━━┓┃ ┃┃┣┻ 178 Sub /blocks.1/Sub ┃┃┣┓ ┃┃┃┣┻ 180 Pow /blocks.1/Pow ┃┃┃┣ 181 Reduce<Mean> /blocks.1/ReduceMean_1 ┃┃┃┣ 182 Sqrt /blocks.1/Sqrt ┃┃┃┣ 183 AddDims /blocks.1/Unsqueeze_2 ┃┗━┓ ┃┃┃┣ 186 AddDims /blocks.1/Unsqueeze_3 ┃┃┃┃ ━━━ 1,TDim ┃┃┃┣┻┻ 187 InferenceConcat /blocks.1/Concat_1 ┃┃┃┃ ━━━ 3,TDim ┃┃┃┣┻ 189 Reshape /blocks.1/Reshape_1 ┃┃┃┣┓ ┃┃┃┃┣ 190 Shape /blocks.1/Shape_2 ┃┃┃┃┃ ━━━ 1,TDim 3 ┃┃┃┃┣ 191 ConstantOfShape /blocks.1/ConstantOfShape_1 ┃┃┃┃┃ ━━━ unk__11,? ┃┃┃┃┣┓ ┃┃┃┃┃┣┻ 193 Mul /blocks.1/Mul_1
┃┃┃┣━━┓┃ ┃┃┃┃┃┣┻ 194 Equals /blocks.1/Equal_1 ┃┃┃┃┃┃ ━━━ 3,Bool ┃┃┃┗━┓ ┃┃┃┗┓┃ ┃┃┃┣┻┻ 195 Iff /blocks.1/Where_1 ┃┃┃┃ ━━━ 3,? ┃┃┣┻ 196 MultiBroadcastTo /blocks.1/Expand_1 ┃┃┣┻ 198 Add /blocks.1/Add ┃┣┻ 199 Div /blocks.1/Div ┃┣┻ 200 Mul /blocks.1/Mul_2 ┃┣┻ 201 Add /blocks.1/Add_1 ┃┣┓ ┃┃┣┻ 211 MatMulInference /blocks.1/attn/qkv/MatMul ┃┃┣┻ 212 Add /blocks.1/attn/qkv/Add ┃┃┃ ━━━ ..,F32 ┃┃┣┓ ┃┃┃┣┻┻┻┻ 217 StridedSlice /blocks.1/attn/Slice ┃┣━━┓ ┃┃┃┃┣ 202 Shape /blocks.1/attn/Shape ┃┃┃┃┃ ━━━ unk__12,TDim ┃┃┃┃┣┻ 204 Gather /blocks.1/attn/Gather ┃┃┃┃┃ ━━━ TDim ┃┃┃┃┣┓ ┃┃┃┃┃┣ 232 AddDims /blocks.1/attn/Unsqueeze ┃┃┃┃┃┃ ━━━ 1,TDim ┃┣━━━━┓ ┃┃┃┃┃┃┣ 205 Shape /blocks.1/attn/Shape_1 ┃┃┃┃┃┃┃ ━━━ unk__13,TDim ┃┃┃┃┃┃┣┻ 207 Gather /blocks.1/attn/Gather_1 ┃┃┃┃┃┃┃ ━━━ TDim ┃┃┃┃┃┃┣┓ ┃┃┃┃┃┃┃┣ 233 AddDims /blocks.1/attn/Unsqueeze_1 ┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┗━━━━━┓ ┃┃┃┃┃┃┃┣ 208 Shape /blocks.1/attn/Shape_2 ┃┃┃┃┃┃┃┃ ━━━ unk__14,TDim ┃┃┃┃┃┃┃┣┻ 210 Gather /blocks.1/attn/Gather_2 ┃┃┃┃┃┃┃┃ ━━━ TDim ┃┃┃┃┃┃┃┣┓ ┃┃┃┃┃┃┃┃┣┻ 229 Div /blocks.1/attn/Div ┃┃┃┃┃┃┃┃┣ 230 onnx.Cast /blocks.1/attn/Cast ┃┃┃┃┃┃┃┃┣ 231 onnx.Cast /blocks.1/attn/Cast_1 ┃┃┃┃┃┃┃┃┣┓ ┃┃┃┃┃┃┃┃┃┣ 235 AddDims /blocks.1/attn/Unsqueeze_2 ┃┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim
┃┃┃┃┃┃┗━┓ ┃ ┃┃┃┃┗━━┓┃ ┃ ┃┃┃┃┃┃┃┣┻┻┻ 236 InferenceConcat /blocks.1/attn/Concat ┃┃┃┃┃┃┃┃ ━━━ 4,TDim ┃┃┗━━━┓┃ ┃┃┃┃┃┃┣┻ 247 Reshape /blocks.1/attn/Reshape ┃┃┃┃┃┃┃ ━━━ ?,?,?,?,F32 ┃┃┃┃┃┃┣ 250 PermuteAxes /blocks.1/attn/Transpose ┃┣━━━━━┓ ┃┃┃┃┃┃┃┣┻┻┻┻ 222 StridedSlice /blocks.1/attn/Slice_1 ┃┃┣━━━━━┓ ┃┃┃┃┃┃┃┃┣ 237 AddDims /blocks.1/attn/Unsqueeze_3 ┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┃┣━━━━━┓ ┃┃┃┃┃┃┃┃┃┣ 238 AddDims /blocks.1/attn/Unsqueeze_4 ┃┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┃┃┃┣━━━━┓ ┃┃┃┃┃┃┃┃┃┃┣ 240 AddDims /blocks.1/attn/Unsqueeze_5 ┃┃┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┃┃┃┃┃┃┣┻┻┻ 241 InferenceConcat /blocks.1/attn/Concat_1 ┃┃┃┃┃┃┃┃┃ ━━━ 4,TDim ┃┃┃┃┃┃┃┣┻ 248 Reshape /blocks.1/attn/Reshape_1 ┃┃┃┃┃┃┃┃ ━━━ ?,?,?,?,F32 ┃┃┃┃┃┃┃┣ 251 PermuteAxes /blocks.1/attn/Transpose_1 ┃┃┃┃┃┃┣┻ 252 MatMulInference /blocks.1/attn/MatMul ┃┃┃┃┃┃┃ ━━━ ..,F32 ┃┃┃┃┃┃┣┻ 254 Mul /blocks.1/attn/Mul ┃┃┃┃┃┃┣ 255 LayerSoftmax /blocks.1/attn/Softmax ┃┗━━━━┓ ┃┃┃┃┃┃┣┻┻┻┻ 227 StridedSlice /blocks.1/attn/Slice_2 ┃┣━━━━━┓ ┃┃┃┃┃┃┃┣ 242 AddDims /blocks.1/attn/Unsqueeze_6 ┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┣━━━━━┓ ┃┃┃┃┃┃┃┃┣ 243 AddDims /blocks.1/attn/Unsqueeze_7 ┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┃┃┗━━━┓ ┃┃┃┃┃┃┃┃┣ 245 AddDims /blocks.1/attn/Unsqueeze_8 ┃┃┃┃┃┃┃┃┃ ━━━ 1,TDim ┃┃┃┃┃┃┣┻┻┻ 246 InferenceConcat /blocks.1/attn/Concat_2 ┃┃┃┃┃┃┃ ━━━ 4,TDim ┃┃┃┃┃┣┻ 249 Reshape /blocks.1/attn/Reshape_2 ┃┃┃┃┃┃ ━━━ ?,?,?,?,F32 ┃┃┃┃┃┣ 256 PermuteAxes /blocks.1/attn/Transpose_2 ┃┃┃┃┣┻ 257 MatMulInference /blocks.1/attn/MatMul_1 ┃┃┃┃┃ ━━━ ?,?,?,?,F32 ┃┃┃┃┣ 258 PermuteAxes /blocks.1/attn/Transpose_3 ┃┗━━┓ ┃┃┃┃┣ 259 AddDims /blocks.1/attn/Unsqueeze_9 ┃┃┃┃┃ ━━━ 1,TDim ┃┗━━┓ ┃┃┃┃┣ 260 AddDims /blocks.1/attn/Unsqueeze_10 ┃┃┃┃┃ ━━━ 1,TDim ┃┗━━┓ ┃┃┃┃┣ 261 AddDims /blocks.1/attn/Unsqueeze_11 ┃┃┃┃┃ ━━━ 1,TDim ┃┃┣┻┻ 262 InferenceConcat /blocks.1/attn/Concat_3 ┃┃┃ ━━━ 3,TDim ┃┣┻ 263 Reshape /blocks.1/attn/Reshape_3 ┃┃ ━━━ ..,F32 ┃┣┻ 264 MatMulInference /blocks.1/attn/proj/MatMul ┃┣┻ 265 Add /blocks.1/attn/proj/Add ┃┃ ━━━ ..,F32 ┣┻ 266 Add /blocks.1/Add_2 ┣┓ ┃┣ 267 Reduce<Mean> /blocks.1/norm2/ReduceMean
┣━┓┃ ┃┣┻ 268 Sub /blocks.1/norm2/Sub ┃┣┓ ┃┃┣┻ 270 Pow /blocks.1/norm2/Pow ┃┃┣ 271 Reduce<Mean> /blocks.1/norm2/ReduceMean_1 ┃┃┣┻ 273 Add /blocks.1/norm2/Add ┃┃┣ 274 Sqrt /blocks.1/norm2/Sqrt ┃┣┻ 275 Div /blocks.1/norm2/Div ┃┣┻ 276 Mul /blocks.1/norm2/Mul ┃┣┻ 277 Add /blocks.1/norm2/Add_1 ┃┣┻ 278 MatMulInference /blocks.1/mlp/fc1/MatMul ┃┣┻ 279 Add /blocks.1/mlp/fc1/Add ┃┃ ━━━ ..,F32 ┃┣┓ ┃┃┣┻ 281 Div /blocks.1/mlp/act/Div ┃┃┣ 282 Erf /blocks.1/mlp/act/Erf ┃┃┣┻ 284 Add /blocks.1/mlp/act/Add ┃┣┻ 285 Mul /blocks.1/mlp/act/Mul ┃┣┻ 287 Mul /blocks.1/mlp/act/Mul_1 ┃┣┻ 288 MatMulInference /blocks.1/mlp/fc2/MatMul ┃┣┻ 289 Add /blocks.1/mlp/fc2/Add ┃┃ ━━━ ..,F32 ┣┻ 290 Add /blocks.1/Add_3 ┣┓ ┃┣ 291 Reduce<Mean> /norm/ReduceMean ┣┻ 292 Sub /norm/Sub ┣┓ ┃┣┻ 294 Pow /norm/Pow ┃┣ 295 Reduce<Mean> /norm/ReduceMean_1 ┃┣┻ 297 Add /norm/Add ┃┣ 298 Sqrt /norm/Sqrt ┣┻ 299 Div /norm/Div ┣┻ 300 Mul /norm/Mul ┣┻ 301 Add /norm/Add_1 ┃ ━━━ ?,?,?,F32 ┣┻ 303 Gather /Gather_1 ┃ ━━━ ?,192,F32 ┣┻┻ 304 Gemm /head/Gemm ━━━ ?,1000,F32 [2024-04-08T17:07:07.640304749Z ERROR tract] Error at stage "analyse"
Caused by:
0: ModelBuildingError
1: Failed analyse for node #31 "/blocks.0/Shape" Shape
2: Infering facts
3: Applying rule outputs[0] == 3,TDim 1, 197, 192
4: while setting outputs[0]
5: Unifying shapes unk__3 and 3
6: Impossible to unify Sym(unk__3) with Val(3).
Hello, thanks for your interest in tract.
I believe this issue is gone with recent versions of tract. It did not reproduce with my top of tree, at least (tried the first half).
It think the error is a mismatch between a dimension that you fixed through the command line (the 3) and unk__3 which is a placeholder variable that whatever genereted the ONNX file use to represent a dimension. We started ignoring these relatively recentely, so this is problably the explanation.
Please check with the top of three and tell me if you can still reproduce.