Skip to content

Conversation

HeyDavid633
Copy link
Contributor

@HeyDavid633 HeyDavid633 commented Aug 25, 2025

PR Category

Feature Enhancement

Description

当前 PR 单独提交了 typical_sequence.py 当前代码的目标仍然是只提取单个的模型;还没有泛化到提取所有模型子图。
例如对于 src_model_path 下的模型 GraphNet/samples/torchvision/alexnet,读取其 6 个文件
生成的 dist_model_path 下的 模型应该在目录 GraphNet/subgraphs/torchvision/alexnet/subgraph_<hash>_<count> ,这个目录下复刻整图目录的内容

但是尤其存在以下疑问

  • Line49 所提取出来的 fx_graphs 为什么是多个的? 从整图中提取如果是多个 那不是已经在进行划分了吗
  • Line78 的结构如何在 torch 这里的逻辑下,得到像 Paddle 中的 program_seq_stmts_list

Copy link

paddle-bot bot commented Aug 25, 2025

Thanks for your contribution!

# Extract fx_graphs from src_model_path, type: fx.graphmodule
fx_graphs = [
fx_graph
for leaf_model_path in _get_leaf_model_pathes(src_model_path)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问:所提取出来的 fx_graphs 为什么是多个的?
答:src_model_path 这个路径下可能不止有一个计算图,也许是整个 samples 目录塞进来。


def _get_leaf_model_pathes(src_model_path: str):
# Traverse all submodule (features.0, classifier.6) in src_model_path
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有实现全的代码,一律 return TODO()


# Generate unittests for each sequence
# Each folder: subgraph_<hash_id>_<count_id>.py
SequenceUnittestsGenerator(program_id, seq_stmts, dist_model_path)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

program_id, seq_stmts 这两个变量没有定义,肯定理解错了,应该是program_seq_stmts_list ,这现在是一个 generator。为了便于理解,你可以在这句话前加一行:

program_seq_stmts_list = list(program_seq_stmts_list)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants