Skip to content
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

[WIP] TODO list #2

Closed
8 of 16 tasks
gglin001 opened this issue Feb 15, 2023 · 8 comments
Closed
8 of 16 tasks

[WIP] TODO list #2

gglin001 opened this issue Feb 15, 2023 · 8 comments

Comments

@gglin001
Copy link
Collaborator

gglin001 commented Feb 15, 2023

  • 基于 PEP-523 支持基本的 Python frame catch (极简版本的 torchdynamo )
  • 构造一个能够表达简单模型的 paddlefx IR (极简版本 的 torch.fx 模块)
  • 利用 monkey-patch 的方式实现 简单 paddle 模型的 IR 转换
    • 对所有的paddle的functions做patch:see todo here
    • symbolic_trace 支持传入callable 和 keyword args: see todo here
    • 把graph封装进一个GraphLayer
    • 补充单测:收集10个左右的paddle的模型,能够trace成功,并对比trace前后的结果可以运行一致。
    • 补充文档
    • 支持对symboic_trace到的IR进行编辑操作(add/delete/change nodes)
    • More examples,例如:修改trace后的Graph,得到新的GraphLayer,用paddlefx方便的提取模型中间的特征表示;把trace到的IR转成torch.fx IR(或者相反方向)
  • 能够覆盖torch.fx examples中的部分examples。 (理想情况下,全部)
  • Graph Visualize。 Ref: FxGraphDrawerpytorchviz
  • 实现上述简单 paddle 模型的 lowering, TODO: 设定 lowering 的目标
@jzhang533
Copy link
Contributor

Fun finding, it's possible to use torch.fx to trace paddle functions.
e.g.:

import torch
import paddle

def to_trace(x, y):
    z = paddle.add(x, y)
    z = paddle.nn.functional.relu(z)
    return z

tracer = torch.fx.Tracer(
    autowrap_modules=(paddle, paddle.nn.functional,)
)
graph = tracer.trace(to_trace)
name = to_trace.__name__
m = torch.fx.GraphModule(tracer.root, graph, name)

print(m.code)
m.graph.print_tabular()

@jzhang533
Copy link
Contributor

jzhang533 commented Apr 6, 2023

Some contribution items you can pick

@GreatV
Copy link
Collaborator

GreatV commented Apr 6, 2023

认领 fx graph visualisation
PR: #37

@Asthestarsfalll
Copy link
Collaborator

认领bytecode instruction translator coverage : #36

@yangguohao
Copy link
Contributor

认领 improve python code gen in paddlefx.

@GreatV
Copy link
Collaborator

GreatV commented Apr 7, 2023

认领 implement a replace_pattern API

@jzhang533
Copy link
Contributor

我在想,paddlefx的项目的阶段性目标,可以设定为:

  • paddlefx.optimize 可以捕获ResNet模型,将其转为fx graph。
  • fx graph可以lower到另外一个设备(或者backend)上运行。

@zrr1999
Copy link
Contributor

zrr1999 commented Apr 30, 2023

认领 bytecode instruction translator coverage #41

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

No branches or pull requests

6 participants