11#! /bin/bash
22
33GRAPH_NET_ROOT=$( python3 -c " import graph_net; import os; print(os.path.dirname(os.path.dirname(graph_net.__file__)))" )
4- DECOMPOSE_PATH=$GRAPH_NET_ROOT /decompose_workspace
4+ DECOMPOSE_PATH=/tmp /decompose_workspace
55
66mkdir -p " $DECOMPOSE_PATH "
77
8- temp_model_list=$( mktemp)
9- cat " $GRAPH_NET_ROOT /graph_net/config/torch_samples_list.txt" > " $temp_model_list "
8+ model_list=" $GRAPH_NET_ROOT /graph_net/config/small100_torch_samples_list.txt"
109
1110python3 -m graph_net.torch.typical_sequence_split_points \
12- --model-list " $temp_model_list " \
11+ --model-list " $model_list " \
1312 --device " cuda" \
1413 --window-size 10 \
14+ --fold-policy default \
15+ --fold-times 10 \
1516 --output-json " $DECOMPOSE_PATH /split_results.json"
1617
17- while IFS= read -r MODEL_PATH_IN_SAMPLES; do
18- if [[ -n " $MODEL_PATH_IN_SAMPLES " ]]; then
19- MODEL_FULL_PATH=" $GRAPH_NET_ROOT /$MODEL_PATH_IN_SAMPLES "
20- MODEL_NAME=$( basename " $MODEL_PATH_IN_SAMPLES " )
21-
22- echo " == Decomposing $MODEL_PATH_IN_SAMPLES . =="
23-
24- decomposer_config_json_str=$( cat << EOF
18+ decompose_config_json_str=$( cat << EOF
2519{
26- "split_results_path": "$DECOMPOSE_PATH /split_results.json",
27- "workspace_path": "$DECOMPOSE_PATH ",
28- "chain_style": true,
29- "target_model_name": "$MODEL_NAME "
20+ "handler_path": "$GRAPH_NET_ROOT /graph_net/torch/graph_decomposer.py",
21+ "handler_class_name": "RangeDecomposerExtractor",
22+ "handler_config": {
23+ "model_path_prefix": "$GRAPH_NET_ROOT ",
24+ "output_dir": "$DECOMPOSE_PATH ",
25+ "split_results_path": "$DECOMPOSE_PATH /split_results.json",
26+ "group_head_and_tail": true,
27+ "chain_style": true
28+ }
3029}
3130EOF
32- )
33- DECOMPOSER_CONFIG=$( echo $decomposer_config_json_str | base64 -w 0)
34-
35- python3 -m graph_net.torch.test_compiler \
36- --model-path " $MODEL_FULL_PATH " \
37- --compiler range_decomposer \
38- --device cuda \
39- --config=" $DECOMPOSER_CONFIG "
40-
41- cp -r " $MODEL_FULL_PATH " " $DECOMPOSE_PATH /"
42-
43- echo " == Validating $MODEL_PATH_IN_SAMPLES . =="
31+ )
32+ DECOMPOSE_CONFIG=$( echo $decompose_config_json_str | base64 -w 0)
4433
45- python3 -m graph_net.torch.test_compiler \
46- --model-path " $DECOMPOSE_PATH / $MODEL_NAME " \
47- --compiler range_decomposer_validator \
48- --device cuda > " $DECOMPOSE_PATH / ${MODEL_NAME} _validation.log " 2>&1
34+ python3 -m graph_net.model_path_handler \
35+ --model-path-list $model_list \
36+ --handler-config= $DECOMPOSE_CONFIG \
37+ --use-subprocess
4938
50- echo " == Finished processing $MODEL_PATH_IN_SAMPLES . =="
51- fi
52- done < $temp_model_list
53-
54- rm -f " $temp_model_list "
39+ test_compiler_config_json_str=$( cat << EOF
40+ {
41+ "decomposed_root": "$DECOMPOSE_PATH "
42+ }
43+ EOF
44+ )
45+ TEST_COMPILER_CONFIG=$( echo $test_compiler_config_json_str | base64 -w 0)
5546
56- cat $DECOMPOSE_PATH /* _validation.log >> $DECOMPOSE_PATH /combined.log
47+ python3 -m graph_net.torch.test_compiler \
48+ --allow-list $model_list \
49+ --compiler range_decomposer_validator \
50+ --device cuda \
51+ --config $TEST_COMPILER_CONFIG \
52+ --model-path-prefix $GRAPH_NET_ROOT \
53+ > " $DECOMPOSE_PATH /validation.log" 2>&1
5754
5855python3 -m graph_net.plot_ESt \
59- --benchmark-path " $DECOMPOSE_PATH /combined .log" \
56+ --benchmark-path " $DECOMPOSE_PATH /validation .log" \
6057 --output-dir " $DECOMPOSE_PATH "
0 commit comments