File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 3
3
import importlib .util
4
4
import inspect
5
5
import torch
6
+ import logging
6
7
from pathlib import Path
7
8
from typing import Type , Any
8
9
import sys
@@ -65,6 +66,16 @@ def main(args):
65
66
params = inputs_params ["weight_info" ]
66
67
state_dict = {k : utils .replay_tensor (v ) for k , v in params .items ()}
67
68
69
+ explain = torch ._dynamo .explain (model )(** state_dict )
70
+ if explain .graph_count != 1 or len (explain .break_reasons ) != 0 :
71
+ logging .error (
72
+ f"Failed to generate a complete graph. The extraction process resulted in an incomplete graph, which was broken into { explain .graph_count } subgraphs."
73
+ )
74
+ logging .error (f"Reason(s): { explain .break_reasons } ." )
75
+ raise ValueError (
76
+ f"Graph extraction failed. The resulting graph is incomplete, broken into { explain .graph_count } subgraphs."
77
+ )
78
+
68
79
y = model (** state_dict )[0 ]
69
80
70
81
print (torch .argmin (y ), torch .argmax (y ))
You can’t perform that action at this time.
0 commit comments