-
Notifications
You must be signed in to change notification settings - Fork 36
Add high-frequency subgraph sequence extraction script #372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
Thanks for your contribution! |
| token_tensor[start:end] | ||
| for consecutive_tensor in consecutive_tensors | ||
| for start, end in [get_range(int(consecutive_tensor.size(0)))] | ||
| for start, end in [get_range(len(consecutive_tensor))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前的语义是已知consecutive_tensor 是个 1D的 tensor,其 size(0)其实就是这个张量的长度。
后面的代码看起来意思是一样的,这么改的原因是啥呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeError: 'int' object is not callable
这里语义上是tensor,但是实际上是一个np的数组,这样调用是有问题的
| inputs = [] | ||
| valid_model_names = [] | ||
|
|
||
| for model_path in args.models: | ||
| seq = extract_ops_via_compile(model_path, args.device) | ||
| inputs.append(seq) | ||
| valid_model_names.append(os.path.basename(model_path)) | ||
|
|
||
| rp_parser = RpExprParser( | ||
| window_size=args.window, fold_policy="default", fold_times=0 | ||
| ) | ||
| rp_expr, token_id2primitive_id = rp_parser(inputs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里就是把计算图一起输入的,并不是单个分开输入
| description="Extract graph patterns and split points from multiple models." | ||
| ) | ||
| parser.add_argument( | ||
| "--models", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这种调用方式并不方便。改成 model-dirs-file。从文本里读取多个 model_path
| help="List of paths to model directories (e.g. --models path/to/m1 path/to/m2)", | ||
| ) | ||
| parser.add_argument("--device", type=str, default="cuda") | ||
| parser.add_argument("--window", type=int, default=10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add argument output_split_points.
put results into output_split_points file with scheme like
<model-path> <space> 3,5,7
|
todo things:
|

PR Category
Feature Enhancement
Description
添加高频子图序列提取脚本
运行命令 python split_points.py --models ./samples/torchvision/resnet18 ./samples/torchvision/resnet34
下图为windows为10时,测试的结果