File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 11import os
22import torch
3+ import shutil
4+ import inspect
35from graph_net .torch .fx_graph_module_util import get_torch_module_and_inputs
46from graph_net .torch .fx_graph_parse_util import parse_sole_graph_module
57from graph_net .tensor_meta import TensorMeta
68from pathlib import Path
7- import shutil
89from graph_net .torch .utils import apply_templates
910from graph_net .imp_util import load_module
10- import inspect
11+ from graph_net . hash_util import get_sha256_hash
1112
1213
1314class GraphVariableRenamer :
@@ -96,6 +97,8 @@ def _try_run(self, model_path):
9697 def _update_model_py_file (self , graph_module , model_path ):
9798 py_code = apply_templates (graph_module .code )
9899 (Path (model_path ) / "model.py" ).write_text (py_code )
100+ file_hash = get_sha256_hash (py_code )
101+ (Path (model_path ) / "graph_hash.txt" ).write_text (file_hash )
99102
100103 def _update_weight_meta_py_file (self , src_model_path , dst_model_path ):
101104 old_name_to_new_name = self ._get_original_name_to_new_name (
You can’t perform that action at this time.
0 commit comments