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 33import importlib .util
44import inspect
55import torch
6+ import logging
67from pathlib import Path
78from typing import Type , Any
89import sys
@@ -65,6 +66,16 @@ def main(args):
6566 params = inputs_params ["weight_info" ]
6667 state_dict = {k : utils .replay_tensor (v ) for k , v in params .items ()}
6768
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+
6879 y = model (** state_dict )[0 ]
6980
7081 print (torch .argmin (y ), torch .argmax (y ))
You can’t perform that action at this time.
0 commit comments