Skip to content

Commit a82dc57

Browse files
committed
refine chain_naive_graph_decomposer_test.sh
1 parent a6b3c15 commit a82dc57

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

graph_net/test/chain_naive_graph_decomposer_test.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@ GRAPH_NET_ROOT=$(python3 -c "import graph_net; import os; print(
44
os.path.dirname(graph_net.__file__))")
55

66
# input model path
7-
MODEL_PATH_IN_SAMPLES=/timm/resnet18
8-
extractor_config_json_str=$(cat <<EOF
7+
MODEL_NAME=resnet18
8+
MODEL_PATH_IN_SAMPLES=/timm/$MODEL_NAME
9+
decorator_config_json_str=$(cat <<EOF
910
{
10-
"custom_extractor_path": "$GRAPH_NET_ROOT/torch/naive_graph_decomposer.py",
11-
"custom_extractor_config": {
12-
"output_dir": "/tmp/chain_naive_decompose_workspace",
13-
"split_positions": [8, 16, 32],
14-
"group_head_and_tail": true,
15-
"chain_style": true
11+
"decorator_path": "$GRAPH_NET_ROOT/torch/extractor.py",
12+
"decorator_config": {
13+
"name": "$MODEL_NAME",
14+
"custom_extractor_path": "$GRAPH_NET_ROOT/torch/naive_graph_decomposer.py",
15+
"custom_extractor_config": {
16+
"output_dir": "/tmp/chain_naive_decompose_workspace",
17+
"split_positions": [8, 16, 32],
18+
"group_head_and_tail": true,
19+
"chain_style": true
20+
}
1621
}
1722
}
1823
EOF
1924
)
20-
EXTRACTOR_CONFIG=$(echo $extractor_config_json_str | base64 -w 0)
25+
DECORATOR_CONFIG=$(echo $decorator_config_json_str | base64 -w 0)
2126

22-
mkdir -p /tmp/naive_decompose_workspace
23-
python3 -m graph_net.torch.single_device_runner --model-path $GRAPH_NET_ROOT/../samples/$MODEL_PATH_IN_SAMPLES --enable-extract True --extract-name resnet18 --dump-graph-hash-key --extractor-config=$EXTRACTOR_CONFIG
27+
python3 -m graph_net.torch.run_model --model-path $GRAPH_NET_ROOT/../samples/$MODEL_PATH_IN_SAMPLES --decorator-config=$DECORATOR_CONFIG

graph_net/test/naive_graph_decomposer_test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ EOF
2525
)
2626
DECORATOR_CONFIG=$(echo $decorator_config_json_str | base64 -w 0)
2727

28-
mkdir -p /tmp/naive_decompose_workspace
2928
python3 -m graph_net.torch.run_model --model-path $GRAPH_NET_ROOT/../samples/$MODEL_PATH_IN_SAMPLES --decorator-config=$DECORATOR_CONFIG

0 commit comments

Comments
 (0)