We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
SOT将来是Paddle动转静的默认状态,但是目前在出现动态Shape的网络中会有重复转写的性能问题。因此 SOT 支持动态Shape是一个重要的功能。
目前的SOT面对动态Shape的网络处理方式如下:
通过上述的fallback机制,我们会识别出那些动态Shape的函数,并放弃他们的静态化。牺牲静态化换取转写时间。 显然上面的方法不是一个非常高效的形式,我们希望做到的最终状态应该是:
def func(x): return x * 2 x1 = paddle.randn((2,2)) x2 = paddle.randn((2,4)) x3 = paddle.randn((2,5)) func(x1) # 针对 x1.shape=(2,2) 进行转写。 func(x2) # 针对 x2.shape和x1的shape,我们直接转写一个 (2, -1) 的 Program func(x3) # 命中第二次转写的 Program,直接复用Program即可
这也是动态Shape的基本思想。
为了解决上述的问题,我设计了一个方案来达到背景中描述的理想状态。目前这个任务将由护航实习生 @diadestiny 主要方案思想分为下面几个大模块:
其实上述方案的核心是:我们会有一个新的变量类别,在组网的时候,使用SIR中存储的Symbolic变量,但是在模拟的时候,还是使用Constant来计算Guard等信息。
这里将进行项目拆解:
MileStone1:熟悉SOT流程,具备基本的SOT debug能力。 成果交付:
MileStone2:掌握SOT的动态Shape方案,并完善细节。 成果交付:
MileStone3:按照方案文档开发,在特定demo组网上跑通动态Shape
MileStone4:完善细节,在Bert上跑通动态Shape方案
MileStone1
The text was updated successfully, but these errors were encountered:
#61486
Sorry, something went wrong.
下载最新的Paddle版本,然后运行下面的代码就是SOT模式的动转静了,可以按照LOG来追溯一下整个SOT的流程。
import os os.environ['MIN_GRAPH_SIZE']='0' os.environ['FLAGS_enable_pir_api']='True' os.environ['SOT_LOG_LEVEL']='3' # open this to access the sot logs import paddle @paddle.jit.to_static def fn(x): tmp = 2 * x tmp = paddle.nn.functional.relu(tmp) return 3 * tmp input_ = paddle.ones([100], dtype="float32") input_.stop_gradient = False output = fn(input_) #print (fn.get_concrete_program(input_)[0].main_program)
No branches or pull requests
问题描述 Please describe your issue
背景
SOT将来是Paddle动转静的默认状态,但是目前在出现动态Shape的网络中会有重复转写的性能问题。因此 SOT 支持动态Shape是一个重要的功能。
目前的SOT面对动态Shape的网络处理方式如下:
通过上述的fallback机制,我们会识别出那些动态Shape的函数,并放弃他们的静态化。牺牲静态化换取转写时间。
显然上面的方法不是一个非常高效的形式,我们希望做到的最终状态应该是:
这也是动态Shape的基本思想。
方案文档【待楷浩完善】
为了解决上述的问题,我设计了一个方案来达到背景中描述的理想状态。目前这个任务将由护航实习生 @diadestiny
主要方案思想分为下面几个大模块:
其实上述方案的核心是:我们会有一个新的变量类别,在组网的时候,使用SIR中存储的Symbolic变量,但是在模拟的时候,还是使用Constant来计算Guard等信息。
项目规划和MileStone
这里将进行项目拆解:
MileStone1:熟悉SOT流程,具备基本的SOT debug能力。
成果交付:
MileStone2:掌握SOT的动态Shape方案,并完善细节。
成果交付:
MileStone3:按照方案文档开发,在特定demo组网上跑通动态Shape
MileStone4:完善细节,在Bert上跑通动态Shape方案
年前任务
MileStone1
The text was updated successfully, but these errors were encountered: