Skip to content

Commit 54244cd

Browse files
committed
Merge branch 'develop' of github.com:PaddlePaddle/GraphNet into develop
2 parents 103873e + 023f21e commit 54244cd

32 files changed

+1454
-712
lines changed

graph_net/config/get_fusible_subgraph_sample_list.txt

Lines changed: 0 additions & 100 deletions
This file was deleted.

graph_net/sample_pass/agent_unittest_generator.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{%- endif -%}
2323
{{"\n"}}
2424
import torch
25-
from torch import device
25+
from torch import device, inf
2626
2727
2828
{% macro get_input_tensor_instance(tensor_meta, device) -%}
@@ -36,7 +36,7 @@
3636
{%- if data is not none -%}
3737
torch.tensor({{data}}, dtype={{dtype}}).reshape({{shape}}).to(device='{{device}}')
3838
{%- elif dtype == "torch.bool" -%}
39-
torch.rand({{shape}}, device={{device}}) > 0.5
39+
torch.rand({{shape}}, device='{{device}}') > 0.5
4040
{%- elif dtype in ["torch.int8", "torch.int16", "torch.int32", "torch.int64"] -%}
4141
torch.randint({{min_val}}, {{max_val}} + 1, size={{shape}}, dtype={{dtype}}).to(device='{{device}}')
4242
{%- elif dtype in ["torch.float16", "torch.bfloat16", "torch.float32", "torch.float64"] -%}
@@ -118,7 +118,7 @@ def test_main(self):
118118
{%- if data is not none -%}
119119
paddle.to_tensor({{data}}, dtype='{{dtype}}', shape={{shape}}).to(device='{{device}}')
120120
{%- elif dtype == "bool" -%}
121-
paddle.randint(low=0, high=2, shape={{shape}}, dtype='{{dtype}}')
121+
paddle.randint(low=0, high=2, shape={{shape}}, dtype='{{dtype}}').to(device='{{device}}')
122122
{%- elif dtype in ["int8", "int16", "int32", "int64"] -%}
123123
paddle.randint(low={{min_val}}, high={{max_val}} + 1, shape={{shape}}, dtype='{{dtype}}').to(device='{{device}}')
124124
{%- elif dtype in ["float16", "bfloat16", "float32", "float64"] -%}
@@ -456,13 +456,8 @@ def __call__(self, rel_model_path: str):
456456
self.resumable_handle_sample(rel_model_path)
457457

458458
def sample_handled(self, rel_model_path: str) -> bool:
459-
dst_model_path = Path(self.config["output_dir"]) / rel_model_path
460-
if not dst_model_path.exists():
461-
return False
462459
output_name = self._get_output_name(rel_model_path)
463-
num_model_py_files = len(list(dst_model_path.rglob(output_name)))
464-
assert num_model_py_files <= 1
465-
return num_model_py_files == 1
460+
return self.naive_sample_handled(rel_model_path, search_file_name=output_name)
466461

467462
def _get_output_name(self, rel_model_path: str):
468463
return f"{Path(rel_model_path).name}_test.py"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
GRAPH_NET_ROOT=$(python3 -c "import graph_net; import os; print(os.path.dirname(os.path.dirname(graph_net.__file__)))")
4+
5+
model_path_list=$GRAPH_NET_ROOT/graph_net/test/workspace_cumsum_num_kernels/test_model_list.txt
6+
WORKSPACE_ROOT=/tmp/fusible_subgraphs
7+
CUMSUM_NUM_KERNELS_WORKSPACE=$WORKSPACE_ROOT/workspace_cumsum_num_kernels
8+
FUSIBLE_SUBGRAPH_RANGES_WORKSPACE=$WORKSPACE_ROOT/workspace_fusible_subgraph_ranges
9+
FUSIBLE_SUBGRAPH_SAMPLES_WORKSPACE=$WORKSPACE_ROOT/workspace_fusible_subgraph_samples
10+
resume=false
11+
12+
python3 -m graph_net.model_path_handler \
13+
--model-path-list "$model_path_list" \
14+
--handler-config $(base64 -w 0 <<EOF
15+
{
16+
"handler_path": "$GRAPH_NET_ROOT/graph_net/torch/sample_passes/cumsum_num_kernels_generator.py",
17+
"handler_class_name": "CumSumNumKernelsGenerator",
18+
"handler_config": {
19+
"output_json_file_name": "cumsum_num_kernels.json",
20+
"model_path_prefix": "$GRAPH_NET_ROOT/graph_net/test/workspace_cumsum_num_kernels",
21+
"output_dir": "$CUMSUM_NUM_KERNELS_WORKSPACE",
22+
"resume": $resume
23+
}
24+
}
25+
EOF
26+
)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
samples/timm/resnet18
2+
samples/timm/eca_resnext26ts.ch_in1k
3+
samples/timm/eca_vovnet39b
4+
samples/timm/efficientnet_b0.ra4_e3600_r224_in1k
5+
samples/timm/efficientnet_b1.ft_in1k
6+
samples/timm/efficientnet_b2.ra_in1k
7+
samples/timm/efficientnet_b3.ra2_in1k
8+
samples/timm/efficientnet_b4.ra2_in1k
9+
samples/timm/efficientnet_b5.sw_in12k
10+
samples/timm/efficientnet_el.ra_in1k
11+
samples/timm/efficientnet_em.ra2_in1k
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
samples/transformers-auto-model/dbmdz_electra-large-discriminator-finetuned-conll03-english
2+
samples/timm/test_byobnet.r160_in1k

graph_net/test/dev_model_list/get_fusible_subgraph_sample_list.txt

Lines changed: 0 additions & 100 deletions
This file was deleted.

graph_net/test/dev_model_list/small_sample_list_for_get_fusible_subgraph.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

graph_net/test/fully_fusible_subgraph_extractor_test.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

graph_net/test/naive_check_if_fully_fusionabale.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

graph_net/test/naive_decomposer_and_post_extract_process_test.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)