Skip to content

Commit 4ebde39

Browse files
committed
Update bypass user name, check_validate ci and count_samples tools.
1 parent 00bed60 commit 4ebde39

3 files changed

Lines changed: 20 additions & 10 deletions

File tree

.github/actions/check-bypass/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: "Check bypass"
2-
description: "A custom action to encapsulate PFCCLab/ci-bypass"
2+
description: "A custom action to encapsulate GraphNet"
33
inputs:
44
github-token:
55
description: "GitHub token"
@@ -18,7 +18,7 @@ runs:
1818
- id: check-bypass
1919
name: Check Bypass
2020
env:
21-
CI_TEAM_MEMBERS: '["SigureMo", "risemeup1", "tianshuo78520a", "0x3878f", "swgu98", "luotao1", "XieYunshen"]'
21+
CI_TEAM_MEMBERS: '["lixinqi", "Xreki"]'
2222
uses: PFCCLab/ci-bypass@v1
2323
with:
2424
github-token: ${{ inputs.github-token }}

tools/ci/check_validate.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export PYTHONPATH=${GRAPH_NET_EXTRACT_WORKSPACE}:$PYTHONPATH
1616
function check_paths_without_spaces() {
1717
LOG "[INFO] Checking for spaces in modified file paths..."
1818
git config --global --add safe.directory "*"
19-
mapfile -t MODIFIED_FILES < <(git diff --name-only develop | grep -E "\bsamples\b/|\bpaddle_samples\b/")
19+
mapfile -t MODIFIED_FILES < <(git diff --diff-filter=ACM --name-only develop | grep -E "\bsamples\b/|\bpaddle_samples\b/")
2020

2121
for file in "${MODIFIED_FILES[@]}"; do
2222
if [[ "${file}" == *" "* ]]; then
@@ -30,7 +30,7 @@ function check_paths_without_spaces() {
3030

3131
function prepare_torch_env() {
3232
git config --global --add safe.directory "*"
33-
num_changed_samples=$(git diff --name-only develop | grep -E "\bsamples\b/.*/(model\.py|input_meta\.py|weight_meta\.py)$" | wc -l)
33+
num_changed_samples=$(git diff --diff-filter=ACM --name-only develop | grep -E "\bsamples\b/.*/(model\.py|input_meta\.py|weight_meta\.py)$" | wc -l)
3434
if [ ${num_changed_samples} -ne 0 ]; then
3535
LOG "[INFO] Device Id: ${CUDA_VISIBLE_DEVICES}"
3636
# Update pip
@@ -48,7 +48,7 @@ function prepare_torch_env() {
4848

4949
function prepare_paddle_env() {
5050
git config --global --add safe.directory "*"
51-
num_changed_paddle_samples=$(git diff --name-only develop | grep -E "\bpaddle_samples\b/.*/(model\.py|input_meta\.py|weight_meta\.py)$" | wc -l)
51+
num_changed_paddle_samples=$(git diff --diff-filter=ACM --name-only develop | grep -E "\bpaddle_samples\b/.*/(model\.py|input_meta\.py|weight_meta\.py)$" | wc -l)
5252
if [ ${num_changed_paddle_samples} -ne 0 ]; then
5353
LOG "[INFO] Device Id: ${CUDA_VISIBLE_DEVICES}"
5454
# Update pip
@@ -70,7 +70,7 @@ function prepare_paddle_env() {
7070
function check_torch_validation() {
7171
LOG "[INFO] Start run validate for changed torch samples ..."
7272
MODIFIED_MODEL_PATHS=()
73-
for file in $(git diff --name-only develop | grep -E "\bsamples\b/.*/(model\.py|input_meta\.py|weight_meta\.py)$")
73+
for file in $(git diff --diff-filter=ACM --name-only develop | grep -E "\bsamples\b/.*/(model\.py|input_meta\.py|weight_meta\.py)$")
7474
do
7575
LOG "[INFO] Found ${file} modified."
7676
model_path=$(dirname ${file})
@@ -104,7 +104,7 @@ function check_torch_validation() {
104104
function check_paddle_validation() {
105105
LOG "[INFO] Start run validate for changed paddle samples ..."
106106
MODIFIED_MODEL_PATHS=()
107-
for file in $(git diff --name-only develop | grep -E "\bpaddle_samples\b/.*/(model\.py|input_meta\.py|weight_meta\.py)$")
107+
for file in $(git diff --diff-filter=ACM --name-only develop | grep -E "\bpaddle_samples\b/.*/(model\.py|input_meta\.py|weight_meta\.py)$")
108108
do
109109
LOG "[INFO] Found ${file} modified."
110110
model_path=$(dirname ${file})

tools/count_sample.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# 统计 samples 目录下, graph_net.json 文件的数量
21
import os
2+
import json
33

44

55
filename = os.path.abspath(__file__)
@@ -15,14 +15,24 @@
1515

1616
graph_net_count = 0
1717
graph_net_dict = {}
18+
model_names_set = set()
1819
for category in model_categories:
1920
category_dir = os.path.join(samples_dir, category)
2021
if os.path.isdir(category_dir):
2122
graph_net_dict[category] = 0
2223
for root, dirs, files in os.walk(category_dir):
2324
if "graph_net.json" in files:
24-
graph_net_count += 1
25-
graph_net_dict[category] += 1
25+
with open(os.path.join(root, "graph_net.json"), "r") as f:
26+
data = json.load(f)
27+
model_name = data.get("model_name", None)
28+
if model_name is not None:
29+
if model_name not in model_names_set:
30+
model_names_set.add(model_name)
31+
graph_net_count += 1
32+
graph_net_dict[category] += 1
33+
else:
34+
graph_net_count += 1
35+
graph_net_dict[category] += 1
2636

2737
print(f"Number of {framework} samples: {graph_net_count}")
2838
for name, number in graph_net_dict.items():

0 commit comments

Comments
 (0)