|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -GRAPH_NET_ROOT=$(python3 -c "import graph_net; import os; print( |
4 | | -os.path.dirname(graph_net.__file__))") |
5 | | -WORKSPACE=/tmp/graph_variable_rename_workspace |
| 3 | +GRAPH_NET_ROOT=$(python3 -c "import graph_net; import os; print(os.path.dirname(os.path.dirname(graph_net.__file__)))") |
| 4 | +RENAMED_PATH=/tmp/graph_variable_rename_workspace |
6 | 5 |
|
7 | | -# input model path |
8 | | -MODEL_NAME=resnet18 |
9 | | -MODEL_PATH_IN_SAMPLES=/timm/$MODEL_NAME |
10 | | -config_json_str=$(cat <<EOF |
| 6 | +mkdir -p "$RENAMED_PATH" |
| 7 | +model_list="$GRAPH_NET_ROOT/graph_net/config/small100_torch_samples_list.txt" |
| 8 | + |
| 9 | +python3 -m graph_net.model_path_handler \ |
| 10 | + --model-path-list $model_list \ |
| 11 | + --handler-config=$(base64 -w 0 <<EOF |
11 | 12 | { |
12 | | - "handler_path": "$GRAPH_NET_ROOT/torch/graph_variable_renamer.py", |
| 13 | + "handler_path": "$GRAPH_NET_ROOT/graph_net/torch/graph_variable_renamer.py", |
13 | 14 | "handler_class_name": "GraphVariableRenamer", |
14 | 15 | "handler_config": { |
15 | | - "model_path_prefix": "$GRAPH_NET_ROOT/../", |
16 | | - "data_input_predicator_filepath": "$GRAPH_NET_ROOT/torch/constraint_util.py", |
| 16 | + "device": "cuda", |
| 17 | + "resume": true, |
| 18 | + "model_path_prefix": "$GRAPH_NET_ROOT/", |
| 19 | + "data_input_predicator_filepath": "$GRAPH_NET_ROOT/graph_net/torch/constraint_util.py", |
17 | 20 | "data_input_predicator_class_name": "NaiveDataInputPredicator", |
18 | | - "model_runnable_predicator_filepath": "$GRAPH_NET_ROOT/torch/constraint_util.py", |
| 21 | + "model_runnable_predicator_filepath": "$GRAPH_NET_ROOT/graph_net/torch/constraint_util.py", |
19 | 22 | "model_runnable_predicator_class_name": "ModelRunnablePredicator", |
20 | | - "output_dir": "$WORKSPACE" |
| 23 | + "output_dir": "$RENAMED_PATH" |
21 | 24 | } |
22 | 25 | } |
23 | 26 | EOF |
24 | | -) |
25 | | -CONFIG=$(echo $config_json_str | base64 -w 0) |
26 | | - |
27 | | -python3 -m graph_net.model_path_handler --model-path samples/$MODEL_PATH_IN_SAMPLES --handler-config=$CONFIG |
28 | | -# python3 -m graph_net.model_path_handler --model-path-list $GRAPH_NET_ROOT/config/decomposition_error_tmp_torch_samples_list.txt --handler-config=$CONFIG |
| 27 | +) \ |
| 28 | + 2>&1 | tee "$RENAMED_PATH/graph_rename.log" |
29 | 29 |
|
30 | | -test_compiler_config_json_str=$(cat <<EOF |
| 30 | +python3 -m graph_net.torch.test_compiler \ |
| 31 | + --model-path-prefix $GRAPH_NET_ROOT \ |
| 32 | + --allow-list $model_list \ |
| 33 | + --compiler graph_variable_renamer_validator \ |
| 34 | + --device cuda \ |
| 35 | + --config $(base64 -w 0 <<EOF |
31 | 36 | { |
32 | 37 | "model_path_prefix": "$GRAPH_NET_ROOT", |
33 | | - "renamed_root": "$WORKSPACE" |
| 38 | + "renamed_root": "$RENAMED_PATH" |
34 | 39 | } |
35 | 40 | EOF |
36 | | -) |
37 | | -TEST_COMPILER_CONFIG=$(echo $test_compiler_config_json_str | base64 -w 0) |
38 | | - |
39 | | -python3 -m graph_net.torch.test_compiler \ |
40 | | - --model-path $GRAPH_NET_ROOT/../samples/$MODEL_PATH_IN_SAMPLES \ |
41 | | - --compiler graph_variable_renamer_validator \ |
42 | | - --device cuda \ |
43 | | - --config $TEST_COMPILER_CONFIG \ |
44 | | - > "$WORKSPACE/validation.log" 2>&1 |
| 41 | +) \ |
| 42 | + 2>&1 | tee "$RENAMED_PATH/validation.log" |
45 | 43 |
|
46 | 44 | python3 -m graph_net.plot_ESt \ |
47 | | - --benchmark-path "$WORKSPACE/validation.log" \ |
48 | | - --output-dir "$WORKSPACE" |
| 45 | + --benchmark-path "$RENAMED_PATH/validation.log" \ |
| 46 | + --output-dir "$RENAMED_PATH" |
0 commit comments