Commit 8b2ca6f
committed
[tmva][sofie] Run PyTorch ONNX export in a separate process in tutorial
The tutorial exported a PyTorch model to ONNX and then parsed it with
SOFIE in the same process. `torch.onnx` and ROOT's SOFIE ONNX parser are
both linked against protobuf, but generally against different versions,
so loading them into one process causes a symbol clash and aborts.
Move the model creation, training and ONNX export into a small standalone
script that runs in its own Python process via subprocess, before ROOT is
imported, so the two protobuf copies are never loaded together.
The parent detects success by the presence of the generated .onnx file
and raises a RuntimeError if it is missing.
(cherry picked from commit ce08cbb)1 parent b9ad203 commit 8b2ca6f
1 file changed
Lines changed: 32 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
15 | 22 | | |
16 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
17 | 31 | | |
18 | 32 | | |
| 33 | + | |
19 | 34 | | |
20 | | - | |
21 | | - | |
22 | 35 | | |
23 | 36 | | |
24 | 37 | | |
| 38 | + | |
| 39 | + | |
25 | 40 | | |
26 | 41 | | |
27 | 42 | | |
28 | | - | |
| 43 | + | |
29 | 44 | | |
30 | | - | |
31 | | - | |
| 45 | + | |
32 | 46 | | |
33 | 47 | | |
34 | 48 | | |
| |||
97 | 111 | | |
98 | 112 | | |
99 | 113 | | |
100 | | - | |
101 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
102 | 119 | | |
103 | 120 | | |
104 | 121 | | |
| |||
127 | 144 | | |
128 | 145 | | |
129 | 146 | | |
130 | | - | |
| 147 | + | |
| 148 | + | |
131 | 149 | | |
132 | 150 | | |
133 | 151 | | |
134 | 152 | | |
135 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
136 | 158 | | |
137 | 159 | | |
138 | 160 | | |
| |||
0 commit comments