-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
V2 API save and load param with V1 API #3574
Conversation
Test_parameters failed since no gradient machine have initialed, so Will update. And maybe we need add more test case with gradient machine initialed |
@reyoung 要在v2的parameter里面用header,而不是直接写死
请问你觉得什么方式比较好?
|
while buf: # f.write crashes with big data blog. | ||
f.write(buf) | ||
wrote_size += 65535 | ||
if len(self.__gradient_machines__) == 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.
len(self.__gradient_machines__) == 0
和 len(self.__gradient_machines__) != 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.
一般来说,以DeepSpeech2为例,在真正保存参数之前,实际是已经有了self.__gradient_machines__
,所以走进len(self.__gradient_machines__) != 0
的分支。
在现有的单测里面,是会进入len(self.__gradient_machines__) == 0
的分支。
param = __get_parameter_in_gradient_machine__( | ||
each_gradient_machine, name) | ||
assert isinstance(param, api.Parameter) | ||
filename = 'tmp_param_file' |
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.
filename是写死的,每次保存都会覆盖?
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.
是写死的,但是每次用完后会删掉,所以只是一个临时的。
之所以要这么用,是因为已有的V1 API接口目前只提供了从文件名的save
和load
。
由于目前这样的写法和c++端更加紧密了,v2的目的是尽可能和c++端解耦。所以有几个问题:
|
MKLDNN的param里的header format会在MKLDNN layer里面到forward之前才能被确认。默认是0。
不同param间的format是可以不一样的,但是format的确认首先还是在C++端,不过要从Python端取出来是需要另外加接口才可以。 |
如果只是header问题,那么可以写一个接口,这里从c++端获取header即可。 |
Can refine later if necessary. |
fix #3519