Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions graph_net/config/get_fusible_subgraph_sample_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
samples/timm/crossvit_small_240.in1k
samples/timm/poolformerv2_s12.sail_in1k
samples/timm/regnety_080.pycls_in1k
samples/timm/dla46x_c.in1k
samples/timm/mobilenetv1_100.ra4_e3600_r224_in1k
samples/timm/efficientnetv2_rw_s.ra2_in1k
samples/timm/vit_base_patch16_rope_ape_224.naver_in1k
samples/timm/fastvit_t8.apple_dist_in1k
samples/timm/test_byobnet.r160_in1k
samples/timm/mambaout_base.in1k
samples/timm/davit_small
samples/timm/resnet61q.ra2_in1k
samples/timm/coat_tiny
samples/timm/regnetx_004.pycls_in1k
samples/timm/convnextv2_large.fcmae
samples/timm/regnety_640.seer
samples/timm/repvit_m1_1.dist_300e_in1k
samples/timm/tinynet_d.in1k
samples/timm/resnetrs270.tf_in1k
samples/timm/cait_m48_448
samples/timm/legacy_seresnet50.in1k
samples/timm/tinynet_a.in1k
samples/timm/convnext_small.fb_in1k
samples/timm/vit_huge_patch14_clip_quickgelu_224.dfn5b
samples/timm/dpn131.mx_in1k
samples/timm/convnextv2_large.fcmae_ft_in1k
samples/timm/convnextv2_small
samples/timm/repvit_m1.dist_in1k
samples/timm/cs3darknet_s
samples/timm/resnet50d.a1_in1k
samples/timm/dm_nfnet_f6
samples/timm/coatnet_1_rw_224
samples/timm/lcnet_050.ra2_in1k
samples/timm/efficientnet_em.ra2_in1k
samples/timm/dpn48b
samples/timm/semnasnet_075.rmsp_in1k
samples/timm/skresnet34.ra_in1k
samples/timm/crossvit_15_dagger_240.in1k
samples/timm/mnasnet_100.rmsp_in1k
samples/timm/mobilenetv3_rw.rmsp_in1k
samples/timm/xception65p.ra3_in1k
samples/timm/coatnet_0_rw_224
samples/timm/eca_nfnet_l3
samples/timm/deit3_base_patch16_224.fb_in1k
samples/timm/mambaout_base_short_rw.sw_e500_in1k
samples/timm/mobilenetv4_conv_small.e1200_r224_in1k
samples/timm/xception71.tf_in1k
samples/timm/dla60.in1k
samples/timm/repghostnet_130.in1k
samples/timm/mambaout_base_plus_rw.sw_e150_in12k
samples/timm/poolformerv2_s36.sail_in1k
samples/timm/deit3_huge_patch14_224.fb_in1k
samples/timm/vit_base_patch32_clip_224.datacompxl
samples/timm/poolformer_m48.sail_in1k
samples/timm/regnety_006.pycls_in1k
samples/timm/starnet_s4.in1k
samples/timm/poolformer_m36.sail_in1k
samples/timm/vit_huge_patch14_gap_224.in1k_ijepa
samples/timm/efficientnet_b3.ra2_in1k
samples/timm/mobilenetv3_large_150d.ra4_e3600_r256_in1k
samples/timm/hgnetv2_b0.ssld_stage1_in22k_in1k
samples/timm/convnextv2_huge.fcmae
samples/timm/davit_huge
samples/timm/regnetx_004_tv.tv2_in1k
samples/timm/dla34.in1k
samples/timm/convnext_xlarge.fb_in22k
samples/timm/resmlp_12_224.fb_dino
samples/timm/fasternet_t1.in1k
samples/timm/resnetblur50.bt_in1k
samples/timm/res2net50d.in1k
samples/timm/vit_base_patch32_224.augreg_in1k
samples/timm/mambaout_base_wide_rw.sw_e500_in1k
samples/timm/vgg19_bn.tv_in1k
samples/timm/vit_small_patch16_rope_ape_224.naver_in1k
samples/timm/hardcorenas_b.miil_green_in1k
samples/timm/vgg16.tv_in1k
samples/timm/xception41p.ra3_in1k
samples/timm/efficientnet_lite0.ra_in1k
samples/timm/regnetv_064.ra3_in1k
samples/timm/regnety_320.pycls_in1k
samples/timm/convnext_pico.d1_in1k
samples/timm/repvit_m1_0.dist_300e_in1k
samples/timm/resnet50c.gluon_in1k
samples/timm/mobileone_s4.apple_in1k
samples/timm/ghostnet_100.in1k
samples/timm/deit_base_distilled_patch16_384
samples/timm/dpn68b.mx_in1k
samples/timm/dla60_res2next
samples/timm/resnet101d.gluon_in1k
samples/timm/eva02_large_patch14_clip_224.merged2b
samples/timm/fasternet_m.in1k
samples/timm/mobilenetv2_110d.ra_in1k
samples/timm/regnetx_064.pycls_in1k
samples/timm/cspresnet50.ra_in1k
samples/timm/resmlp_24_224.fb_dino
samples/timm/mobileone_s3.apple_in1k
samples/timm/mobileone_s2.apple_in1k
samples/timm/res2net101d
samples/timm/hardcorenas_f.miil_green_in1k
samples/timm/hrnet_w18_ssld.paddle_in1k
101 changes: 101 additions & 0 deletions graph_net/config/small100_torch_samples_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# shuf -n 100 torch_samples_list.txt > small_torch_samples_list.txt
samples/ultralytics/yolov3-tinyu
samples/transformers-auto-model/hf-tiny-model-private_tiny-random-Swinv2ForImageClassification
samples/torchgeometric/RECT_L
samples/transformers-auto-model/opus-mt-en-gv
samples/transformers-auto-model/Visual-Attention-Network_van-tiny
samples/timm/convnextv2_base.fcmae_ft_in1k
samples/torchvision/vgg16_bn
samples/timm/regnety_080_tv.tv2_in1k
samples/transformers-auto-model/internetoftim_dinov2-base
samples/timm/mobilenetv4_conv_aa_large.e230_r384_in12k
samples/ultralytics/yolo12x
samples/transformers-auto-model/opus-mt-eo-it
samples/transformers-auto-model/opus-mt-es-csg
samples/transformers-auto-model/google_byt5_base
samples/transformers-auto-model/Fsoft-AIC_videberta-base
samples/timm/mixer_l16_224.goog_in21k
samples/transformers-auto-model/hf-tiny-model-private_tiny-random-EfficientFormerModel
samples/transformers-auto-model/distilbert_distilbert-base-multilingual-cased
samples/transformers-auto-model/ydshieh_tiny-random-ViTModel
samples/transformers-auto-model/microsoft_beit-base-patch16-384
samples/transformers-auto-model/hf-tiny-model-private_tiny-random-Data2VecVisionModel
samples/transformers-auto-model/kanarya-750m
samples/transformers-auto-model/Helsinki-NLP_opus-mt-zh-en
samples/transformers-auto-model/opus-mt-de-tl
samples/timm/vit_base_patch16_224_miil.in21k
samples/mmseg/SegNeXt-b
samples/transformers-auto-model/OFA-Sys_chinese-clip-vit-large-patch14
samples/mmpose/ViTPose-B
samples/transformers-auto-model/Sayan01_tiny-bert-sst2-distilled
samples/timm/regnety_080.pycls_in1k
samples/ultralytics/yolov9c
samples/transformers-auto-model/opus-mt-bcl-fr
samples/transformers-auto-model/opus-mt-de-ase
samples/timm/eva02_base_patch16_clip_224.merged2b
samples/mmpose/S-ViPNAS-Res50
samples/transformers-auto-model/Lin-Chen_ShareGPT4V-7B_Pretrained_vit-large336-l12
samples/transformers-auto-model/opus-mt-en-tw
samples/timm/hgnet_tiny.paddle_in1k
samples/transformers-auto-model/opus-mt-ase-es
samples/transformers-auto-model/MIT_ast-finetuned-audioset-10-10-0.4593
samples/transformers-auto-model/opus-mt-en-kqn
samples/transformers-auto-model/opus-mt-en-guw
samples/timm/vit_small_patch16_rope_mixed_ape_224.naver_in1k
samples/timm/repvgg_b0.rvgg_in1k
samples/transformers-auto-model/opus-mt-en-crs
samples/transformers-auto-model/opus-mt-en-bat
samples/transformers-auto-model/Francesco_resnet101-224-1k
samples/timm/dpn107.mx_in1k
samples/transformers-auto-model/google/t5-efficient-large-kv128
samples/transformers-auto-model/aimarsg_prueba5
samples/torchvision/resnext50_32x4d
samples/timm/inception_v3.gluon_in1k
samples/transformers-auto-model/mohsenfayyaz_BERT_Warmup
samples/transformers-auto-model/MoritzLaurer_xtremedistil-l6-h256-mnli-fever-anli-ling-binary
samples/transformers-auto-model/pipecat-ai_smart-turn-v2
samples/timm/poolformerv2_m48.sail_in1k
samples/timm/res2net101_26w_4s
samples/transformers-auto-model/opus-mt-ar-es
samples/timm/regnety_002.pycls_in1k
samples/transformers-auto-model/simjo_dummy-model
samples/mmseg/CCNet_R101
samples/transformers-auto-model/opus-mt-tc-bible-big-deu_eng_fra_por_spa-bat
samples/transformers-auto-model/facebook_sam-vit-large
samples/transformers-auto-model/distilbert_distilbert-base-uncased
samples/mmseg/PoolFormer_m36
samples/timm/hgnetv2_b4.ssld_stage1_in22k_in1k
samples/timm/regnetx_160.pycls_in1k
samples/transformers-auto-model/google/bert_uncased_L-6_H-512_A-8
samples/transformers-auto-model/ogoshi2000_stance-nystromformer
samples/timm/resnetv2_18.ra4_e3600_r224_in1k
samples/transformers-auto-model/TinyLlama/TinyLlama-1.1B-Chat-v0.4
samples/timm/resnetaa50d.d_in12k
samples/transformers-auto-model/bge-small-en-v1.5
samples/timm/coatnet_rmlp_0_rw_224
samples/transformers-auto-model/opus-mt-en-sal
samples/mmseg/UPerNet_R101
samples/transformers-auto-model/sentence-transformers/paraphrase-distilroberta-base-v1
samples/transformers-auto-model/opus-mt-en-phi
samples/transformers-auto-model/opus-mt-fi-niu
samples/torchvision/vit_l_16
samples/timm/res2net50_14w_8s.in1k
samples/mmseg/Twins_pcpvt-b_uperhead
samples/transformers-auto-model/google-t5_t5-large
samples/transformers-auto-model/TrustSafeAI_RADAR_Vicuna_7B
samples/torchaudio/wavlm_base
samples/transformers-auto-model/opus-mt-NORTH_EU-NORTH_EU
samples/transformers-auto-model/apple_aimv2-huge-patch14-224
samples/timm/resnetrs270.tf_in1k
samples/transformers-auto-model/opus-mt-de-no
samples/transformers-auto-model/opus-mt-tc-bible-big-gmw-deu_eng_fra_por_spa
samples/timm/repghostnet_111.in1k
samples/mmseg/DeepLabV3+_R101
samples/transformers-auto-model/microsoft_swin-base-patch4-window12-384-in22k
samples/transformers-auto-model/opus-mt-es-de
samples/transformers-auto-model/nvidia_mit-b4
samples/transformers-auto-model/opus-mt-tc-bible-big-ine-deu_eng_fra_por_spa
samples/mmpose/pose_swin_b
samples/transformers-auto-model/opus-mt-bi-en
samples/transformers-auto-model/all-mpnet-base-v2
samples/transformers-auto-model/Neurora_opus-tatoeba-heb-eng
10 changes: 10 additions & 0 deletions graph_net/config/small_sample_list_for_get_fusible_subgraph.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#samples/timm/crossvit_small_240.in1k
#samples/timm/poolformerv2_s12.sail_in1k
#samples/timm/regnety_080.pycls_in1k
#samples/timm/dla46x_c.in1k
#samples/timm/mobilenetv1_100.ra4_e3600_r224_in1k
samples/timm/efficientnetv2_rw_s.ra2_in1k
samples/timm/vit_base_patch16_rope_ape_224.naver_in1k
#samples/timm/fastvit_t8.apple_dist_in1k
#samples/timm/test_byobnet.r160_in1k
#samples/timm/mambaout_base.in1k
4 changes: 0 additions & 4 deletions graph_net/config/small_torch_samples_list.txt

This file was deleted.

2 changes: 1 addition & 1 deletion graph_net/subgraph_decompose_and_evaluation_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def run_decomposer_for_single_model(
"decorator_path": f"{graphnet_root}/graph_net/{framework}/extractor.py",
"decorator_config": {
"name": model_name,
"custom_extractor_path": f"{graphnet_root}/graph_net/{framework}/naive_graph_decomposer.py",
"custom_extractor_path": f"{graphnet_root}/graph_net/{framework}/graph_decomposer.py",
"custom_extractor_config": {
"output_dir": output_dir,
"split_positions": split_positions,
Expand Down
5 changes: 5 additions & 0 deletions graph_net/tensor_meta.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def serialize_to_py_str(self) -> str:
lines = [
(f"class {self.record_class_name}:"),
(f'\tname = "{self.name}"'),
*(
[f'\toriginal_name = "{self.original_name}"']
if self.original_name is not None
else []
),
(f"\tshape = {self.shape}"),
(f'\tdtype = "{self.dtype}"'),
(f'\tdevice = "{self.device}"'),
Expand Down
2 changes: 1 addition & 1 deletion graph_net/test/chain_naive_graph_decomposer_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ decorator_config_json_str=$(cat <<EOF
"decorator_path": "$GRAPH_NET_ROOT/torch/extractor.py",
"decorator_config": {
"name": "$MODEL_NAME",
"custom_extractor_path": "$GRAPH_NET_ROOT/torch/naive_graph_decomposer.py",
"custom_extractor_path": "$GRAPH_NET_ROOT/torch/graph_decomposer.py",
"custom_extractor_config": {
"output_dir": "/tmp/chain_naive_decompose_workspace",
"split_positions": [8, 16, 32],
Expand Down
2 changes: 1 addition & 1 deletion graph_net/test/decomposer_validator_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extractor_config_json_str=$(cat <<EOF
"decorator_path": "$GRAPH_NET_ROOT/torch/extractor.py",
"decorator_config": {
"name": "$MODEL_NAME",
"custom_extractor_path": "$GRAPH_NET_ROOT/torch/naive_graph_decomposer.py",
"custom_extractor_path": "$GRAPH_NET_ROOT/torch/graph_decomposer.py",
"custom_extractor_config": {
"output_dir": "$OUTPUT_DIR/${MODEL_NAME}_decomposed",
"split_positions": [8, 16, 32],
Expand Down
33 changes: 33 additions & 0 deletions graph_net/test/fully_fusible_subgraph_extractor_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

GRAPH_NET_ROOT=$(python3 -c "import graph_net; import os; print(
os.path.dirname(graph_net.__file__))")

# input model path
MODEL_NAME=resnet18
MODEL_PATH_IN_SAMPLES=/timm/$MODEL_NAME
# INPUT_MODEL_LIST=$GRAPH_NET_ROOT/config/get_fusible_subgraph_sample_list.txt
INPUT_MODEL_LIST=$GRAPH_NET_ROOT/config/small_sample_list_for_get_fusible_subgraph.txt

OUTPUT_DIR="/tmp/find_fully_fusible_output"
config_json_str=$(cat <<EOF
{
"handler_path": "$GRAPH_NET_ROOT/torch/fully_fusible_subgraph_extractor.py",
"handler_class_name":"FullyFusibleSubgraphExtractor",
"handler_config": {
"resume": false,
"model_path_prefix": "$GRAPH_NET_ROOT/../",
"output_dir": "$OUTPUT_DIR",
"nn_module_fully_fusible_decorator_path": "$GRAPH_NET_ROOT/torch/count_kernels_util.py",
"nn_module_fully_fusible_decorator_class_name": "TorchSubModuleFullyFusibleDecorator",
"max_step": 3,
"min_step": 2,
"max_nodes": 4
}
}
EOF
)
CONFIG=$(echo $config_json_str | base64 -w 0)

# python3 -m graph_net.model_path_handler --model-path $GRAPH_NET_ROOT/../samples/$MODEL_PATH_IN_SAMPLES --handler-config=$CONFIG
python3 -m graph_net.model_path_handler --model-path-list $INPUT_MODEL_LIST --handler-config=$CONFIG

This file was deleted.

27 changes: 27 additions & 0 deletions graph_net/test/graph_variable_rename_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

GRAPH_NET_ROOT=$(python3 -c "import graph_net; import os; print(
os.path.dirname(graph_net.__file__))")

# input model path
MODEL_NAME=resnet18
MODEL_PATH_IN_SAMPLES=/timm/$MODEL_NAME
config_json_str=$(cat <<EOF
{
"handler_path": "$GRAPH_NET_ROOT/torch/graph_variable_renamer.py",
"handler_class_name": "GraphVariableRenamer",
"handler_config": {
"model_path_prefix": "$GRAPH_NET_ROOT/../",
"data_input_predicator_filepath": "$GRAPH_NET_ROOT/torch/constraint_util.py",
"data_input_predicator_class_name": "NaiveDataInputPredicator",
"model_runnable_predicator_filepath": "$GRAPH_NET_ROOT/torch/constraint_util.py",
"model_runnable_predicator_class_name": "ModelRunnablePredicator",
"output_dir": "/tmp/graph_variable_rename_workspace"
}
}
EOF
)
CONFIG=$(echo $config_json_str | base64 -w 0)

python3 -m graph_net.model_path_handler --model-path samples/$MODEL_PATH_IN_SAMPLES --handler-config=$CONFIG
# python3 -m graph_net.model_path_handler --model-path-list $GRAPH_NET_ROOT/config/decomposition_error_tmp_torch_samples_list.txt --handler-config=$CONFIG
2 changes: 1 addition & 1 deletion graph_net/test/naive_check_if_fully_fusionabale.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MODEL_PATH_IN_SAMPLES=/timm/$MODEL_NAME
checker_config_json_str=$(cat <<EOF
{
"post_extract_process_config": {
"post_extract_process_path":"$GRAPH_NET_ROOT/torch/post_extract_process_count_kernels.py",
"post_extract_process_path":"$GRAPH_NET_ROOT/torch/count_kernels_util.py",
"post_extract_process_class_name": "GraphFullyFusionable"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ decorator_config_json_str=$(cat <<EOF
"decorator_path": "$GRAPH_NET_ROOT/torch/extractor.py",
"decorator_config": {
"name": "$MODEL_NAME",
"custom_extractor_path": "$GRAPH_NET_ROOT/torch/naive_graph_decomposer.py",
"custom_extractor_path": "$GRAPH_NET_ROOT/torch/graph_decomposer.py",
"custom_extractor_config": {
"output_dir": "/tmp/naive_decompose_workspace",
"split_positions": [8, 16, 32],
"group_head_and_tail": true,
"filter_path":"$GRAPH_NET_ROOT/torch/naive_subgraph_filter.py",
"filter_config": {},
"post_extract_process_path":"$GRAPH_NET_ROOT/torch/post_extract_process_count_kernels.py",
"post_extract_process_path":"$GRAPH_NET_ROOT/torch/count_kernels_util.py",
"post_extract_process_class_name": "GraphFullyFusible"
}
}
Expand Down
4 changes: 2 additions & 2 deletions graph_net/test/naive_graph_decomposer_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MODEL_NAME=resnet18
MODEL_PATH_IN_SAMPLES=/timm/$MODEL_NAME
config_json_str=$(cat <<EOF
{
"handler_path": "$GRAPH_NET_ROOT/torch/naive_graph_decomposer.py",
"handler_path": "$GRAPH_NET_ROOT/torch/graph_decomposer.py",
"handler_class_name": "NaiveDecomposerExtractor",
"handler_config": {
"model_path_prefix": "$GRAPH_NET_ROOT/../",
Expand All @@ -23,4 +23,4 @@ EOF
CONFIG=$(echo $config_json_str | base64 -w 0)

# python3 -m graph_net.model_path_handler --model-path $GRAPH_NET_ROOT/../samples/$MODEL_PATH_IN_SAMPLES --handler-config=$CONFIG
python3 -m graph_net.model_path_handler --model-path-list $GRAPH_NET_ROOT/config/decomposition_error_tmp_torch_samples_list.txt --handler-config=$CONFIG
python3 -m graph_net.model_path_handler --model-path-list $GRAPH_NET_ROOT/test/dev_model_list/decomposition_error_tmp_torch_samples_list.txt --handler-config=$CONFIG
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ EOF
)
CONFIG=$(echo $config_json_str | base64 -w 0)

python3 -m graph_net.model_path_handler --model-path-list $GRAPH_NET_ROOT/config/small_torch_samples_list.txt --handler-config=$CONFIG
python3 -m graph_net.model_path_handler --model-path-list $GRAPH_NET_ROOT/config/small100_torch_samples_list.txt --handler-config=$CONFIG
Loading
Loading