Skip to content

Commit 3fea5d4

Browse files
committed
merge develop
2 parents e21af2b + 9c02d0a commit 3fea5d4

File tree

69 files changed

+10304
-45
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+10304
-45
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
samples/timm/crossvit_small_240.in1k
2+
samples/timm/poolformerv2_s12.sail_in1k
3+
samples/timm/regnety_080.pycls_in1k
4+
samples/timm/dla46x_c.in1k
5+
samples/timm/mobilenetv1_100.ra4_e3600_r224_in1k
6+
samples/timm/efficientnetv2_rw_s.ra2_in1k
7+
samples/timm/vit_base_patch16_rope_ape_224.naver_in1k
8+
samples/timm/fastvit_t8.apple_dist_in1k
9+
samples/timm/test_byobnet.r160_in1k
10+
samples/timm/mambaout_base.in1k
11+
samples/timm/davit_small
12+
samples/timm/resnet61q.ra2_in1k
13+
samples/timm/coat_tiny
14+
samples/timm/regnetx_004.pycls_in1k
15+
samples/timm/convnextv2_large.fcmae
16+
samples/timm/regnety_640.seer
17+
samples/timm/repvit_m1_1.dist_300e_in1k
18+
samples/timm/tinynet_d.in1k
19+
samples/timm/resnetrs270.tf_in1k
20+
samples/timm/cait_m48_448
21+
samples/timm/legacy_seresnet50.in1k
22+
samples/timm/tinynet_a.in1k
23+
samples/timm/convnext_small.fb_in1k
24+
samples/timm/vit_huge_patch14_clip_quickgelu_224.dfn5b
25+
samples/timm/dpn131.mx_in1k
26+
samples/timm/convnextv2_large.fcmae_ft_in1k
27+
samples/timm/convnextv2_small
28+
samples/timm/repvit_m1.dist_in1k
29+
samples/timm/cs3darknet_s
30+
samples/timm/resnet50d.a1_in1k
31+
samples/timm/dm_nfnet_f6
32+
samples/timm/coatnet_1_rw_224
33+
samples/timm/lcnet_050.ra2_in1k
34+
samples/timm/efficientnet_em.ra2_in1k
35+
samples/timm/dpn48b
36+
samples/timm/semnasnet_075.rmsp_in1k
37+
samples/timm/skresnet34.ra_in1k
38+
samples/timm/crossvit_15_dagger_240.in1k
39+
samples/timm/mnasnet_100.rmsp_in1k
40+
samples/timm/mobilenetv3_rw.rmsp_in1k
41+
samples/timm/xception65p.ra3_in1k
42+
samples/timm/coatnet_0_rw_224
43+
samples/timm/eca_nfnet_l3
44+
samples/timm/deit3_base_patch16_224.fb_in1k
45+
samples/timm/mambaout_base_short_rw.sw_e500_in1k
46+
samples/timm/mobilenetv4_conv_small.e1200_r224_in1k
47+
samples/timm/xception71.tf_in1k
48+
samples/timm/dla60.in1k
49+
samples/timm/repghostnet_130.in1k
50+
samples/timm/mambaout_base_plus_rw.sw_e150_in12k
51+
samples/timm/poolformerv2_s36.sail_in1k
52+
samples/timm/deit3_huge_patch14_224.fb_in1k
53+
samples/timm/vit_base_patch32_clip_224.datacompxl
54+
samples/timm/poolformer_m48.sail_in1k
55+
samples/timm/regnety_006.pycls_in1k
56+
samples/timm/starnet_s4.in1k
57+
samples/timm/poolformer_m36.sail_in1k
58+
samples/timm/vit_huge_patch14_gap_224.in1k_ijepa
59+
samples/timm/efficientnet_b3.ra2_in1k
60+
samples/timm/mobilenetv3_large_150d.ra4_e3600_r256_in1k
61+
samples/timm/hgnetv2_b0.ssld_stage1_in22k_in1k
62+
samples/timm/convnextv2_huge.fcmae
63+
samples/timm/davit_huge
64+
samples/timm/regnetx_004_tv.tv2_in1k
65+
samples/timm/dla34.in1k
66+
samples/timm/convnext_xlarge.fb_in22k
67+
samples/timm/resmlp_12_224.fb_dino
68+
samples/timm/fasternet_t1.in1k
69+
samples/timm/resnetblur50.bt_in1k
70+
samples/timm/res2net50d.in1k
71+
samples/timm/vit_base_patch32_224.augreg_in1k
72+
samples/timm/mambaout_base_wide_rw.sw_e500_in1k
73+
samples/timm/vgg19_bn.tv_in1k
74+
samples/timm/vit_small_patch16_rope_ape_224.naver_in1k
75+
samples/timm/hardcorenas_b.miil_green_in1k
76+
samples/timm/vgg16.tv_in1k
77+
samples/timm/xception41p.ra3_in1k
78+
samples/timm/efficientnet_lite0.ra_in1k
79+
samples/timm/regnetv_064.ra3_in1k
80+
samples/timm/regnety_320.pycls_in1k
81+
samples/timm/convnext_pico.d1_in1k
82+
samples/timm/repvit_m1_0.dist_300e_in1k
83+
samples/timm/resnet50c.gluon_in1k
84+
samples/timm/mobileone_s4.apple_in1k
85+
samples/timm/ghostnet_100.in1k
86+
samples/timm/deit_base_distilled_patch16_384
87+
samples/timm/dpn68b.mx_in1k
88+
samples/timm/dla60_res2next
89+
samples/timm/resnet101d.gluon_in1k
90+
samples/timm/eva02_large_patch14_clip_224.merged2b
91+
samples/timm/fasternet_m.in1k
92+
samples/timm/mobilenetv2_110d.ra_in1k
93+
samples/timm/regnetx_064.pycls_in1k
94+
samples/timm/cspresnet50.ra_in1k
95+
samples/timm/resmlp_24_224.fb_dino
96+
samples/timm/mobileone_s3.apple_in1k
97+
samples/timm/mobileone_s2.apple_in1k
98+
samples/timm/res2net101d
99+
samples/timm/hardcorenas_f.miil_green_in1k
100+
samples/timm/hrnet_w18_ssld.paddle_in1k
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#samples/timm/crossvit_small_240.in1k
2+
#samples/timm/poolformerv2_s12.sail_in1k
3+
#samples/timm/regnety_080.pycls_in1k
4+
#samples/timm/dla46x_c.in1k
5+
#samples/timm/mobilenetv1_100.ra4_e3600_r224_in1k
6+
samples/timm/efficientnetv2_rw_s.ra2_in1k
7+
#samples/timm/vit_base_patch16_rope_ape_224.naver_in1k
8+
#samples/timm/fastvit_t8.apple_dist_in1k
9+
#samples/timm/test_byobnet.r160_in1k
10+
#samples/timm/mambaout_base.in1k

graph_net/test/fully_fusible_subgraph_extractor_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ os.path.dirname(graph_net.__file__))")
66
# input model path
77
MODEL_NAME=resnet18
88
MODEL_PATH_IN_SAMPLES=/timm/$MODEL_NAME
9-
# INPUT_MODEL_LIST=$GRAPH_NET_ROOT/config/get_fusible_subgraph_sample_list.txt
10-
INPUT_MODEL_LIST=$GRAPH_NET_ROOT/config/small_sample_list_for_get_fusible_subgraph.txt
9+
# INPUT_MODEL_LIST=$GRAPH_NET_ROOT/test/dev_model_list/get_fusible_subgraph_sample_list.txt
10+
INPUT_MODEL_LIST=$GRAPH_NET_ROOT/test/dev_model_list/small_sample_list_for_get_fusible_subgraph.txt
1111

1212
OUTPUT_DIR="/tmp/find_fully_fusible_output"
1313
config_json_str=$(cat <<EOF

graph_net/torch/fully_fusible_subgraph_extractor.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ def __call__(self, rel_model_path):
114114
model_path
115115
)
116116
for start_pos, end_pos in self._get_sub_ranges():
117-
logger.warning("fully_fusible_subgraph_predicator-begin")
118117
success = fully_fusible_subgraph_predicator(start_pos, end_pos)
119-
logger.warning("fully_fusible_subgraph_predicator-end")
120118
if not success:
121119
continue
122120
with tempfile.TemporaryDirectory(
@@ -126,9 +124,7 @@ def __call__(self, rel_model_path):
126124
temp_dir, start_pos, end_pos
127125
)
128126
naive_graph_decomposer = NaiveDecomposerExtractor(decomposer_config)
129-
logger.warning("naive_graph_decomposer-begin")
130127
naive_graph_decomposer(rel_model_path)
131-
logger.warning("naive_graph_decomposer-end")
132128
fully_fusible_destination_path = self._copy_from_tmp_dir_to_output_dir(
133129
temp_dir, rel_model_path
134130
)

graph_net/torch/graph_decomposer.py

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,8 @@ def make_config(
4848
output_dir="./tmp/naive_decomposer_dir",
4949
filter_path=None,
5050
filter_config=None,
51-
post_extract_process_path=None,
52-
post_extract_process_class_name=None,
53-
post_extract_process_config=None,
5451
**kwargs,
5552
):
56-
if post_extract_process_config is None:
57-
post_extract_process_config = {}
5853
for pos in split_positions:
5954
assert isinstance(
6055
pos, int
@@ -66,9 +61,6 @@ def make_config(
6661
"output_dir": output_dir,
6762
"filter_path": filter_path,
6863
"filter_config": filter_config if filter_config is not None else {},
69-
"post_extract_process_path": post_extract_process_path,
70-
"post_extract_process_class_name": post_extract_process_class_name,
71-
"post_extract_process_config": post_extract_process_config,
7264
}
7365

7466
def __call__(self, gm: torch.fx.GraphModule, sample_inputs):
@@ -111,14 +103,9 @@ def _make_config(
111103
chain_style=False,
112104
filter_path=None,
113105
filter_config=None,
114-
post_extract_process_path=None,
115-
post_extract_process_class_name=None,
116-
post_extract_process_config=None,
117106
model_path_prefix="",
118107
**kwargs,
119108
):
120-
if post_extract_process_config is None:
121-
post_extract_process_config = {}
122109
for pos in split_positions:
123110
assert isinstance(
124111
pos, int
@@ -130,9 +117,6 @@ def _make_config(
130117
"output_dir": output_dir,
131118
"filter_path": filter_path,
132119
"filter_config": filter_config if filter_config is not None else {},
133-
"post_extract_process_path": post_extract_process_path,
134-
"post_extract_process_class_name": post_extract_process_class_name,
135-
"post_extract_process_config": post_extract_process_config,
136120
"model_path_prefix": model_path_prefix,
137121
}
138122

@@ -146,15 +130,16 @@ def __call__(self, rel_model_path):
146130
module, inputs = get_torch_module_and_inputs(model_path)
147131
gm = parse_immutable_model_path_into_sole_graph_module(model_path)
148132
try:
149-
logger.warning("convert_to_submodules_graph-call-begin")
133+
# logger.warning("convert_to_submodules_graph-call-begin")
150134
rewrited_gm: torch.fx.GraphModule = convert_to_submodules_graph(
151135
gm,
152136
submodule_hook=self.get_naive_decomposer_extractor(model_path),
153137
**config,
154138
)
155139
rewrited_gm(*inputs)
156140
finally:
157-
logger.warning("convert_to_submodules_graph-call-end")
141+
pass
142+
# logger.warning("convert_to_submodules_graph-call-end")
158143

159144
def get_naive_decomposer_extractor(self, model_path):
160145
def fn(submodule, seq_no):
@@ -186,9 +171,6 @@ def _make_config(
186171
output_dir="./tmp/naive_decomposer_dir",
187172
filter_path=None,
188173
filter_config=None,
189-
post_extract_process_path=None,
190-
post_extract_process_class_name=None,
191-
post_extract_process_config=None,
192174
model_path_prefix="",
193175
**kwargs,
194176
):
@@ -198,18 +180,13 @@ def _make_config(
198180
raise ValueError(
199181
f"split_results_path should be a valid JSON file path, but got {split_results_path=}"
200182
)
201-
if post_extract_process_config is None:
202-
post_extract_process_config = {}
203183
return {
204184
"split_results_path": split_results_path,
205185
"group_head_and_tail": group_head_and_tail,
206186
"chain_style": chain_style,
207187
"output_dir": output_dir,
208188
"filter_path": filter_path,
209189
"filter_config": filter_config if filter_config is not None else {},
210-
"post_extract_process_path": post_extract_process_path,
211-
"post_extract_process_class_name": post_extract_process_class_name,
212-
"post_extract_process_config": post_extract_process_config,
213190
"model_path_prefix": model_path_prefix,
214191
}
215192

@@ -274,7 +251,13 @@ def __init__(
274251
),
275252
)
276253
self.filter = self.make_filter(self.config)
277-
self.post_extract_process = self.make_post_extract_process(self.config)
254+
255+
def _get_model_path(self):
256+
return os.path.join(
257+
self.config["output_dir"],
258+
f"{self.parent_graph_name}_decomposed",
259+
self.model_name,
260+
)
278261

279262
def _get_model_path(self):
280263
return os.path.join(
@@ -290,27 +273,15 @@ def forward(self, *args):
290273
self.builtin_extractor(self.submodule, args)
291274
self._post_extract_process()
292275
self.extracted = True
293-
logger.warning("naive decomposer end")
294276
return self.submodule(*args)
295277

296278
def need_extract(self, gm, sample_inputs):
297279
if self.filter is None:
298280
return True
299281
return self.filter(gm, sample_inputs)
300282

301-
def _post_extract_process(self):
302-
model_path = self._get_model_path()
303-
return self.post_extract_process(model_path)
304-
305283
def make_filter(self, config):
306284
if config["filter_path"] is None:
307285
return None
308286
module = imp_util.load_module(config["filter_path"])
309287
return module.GraphFilter(config["filter_config"])
310-
311-
def make_post_extract_process(self, config):
312-
if config.get("post_extract_process_path") is None:
313-
return lambda *args, **kwargs: None
314-
module = imp_util.load_module(config["post_extract_process_path"])
315-
cls = getattr(module, config["post_extract_process_class_name"])
316-
return cls(config["post_extract_process_config"])

0 commit comments

Comments
 (0)