Skip to content

Conversation

Shixiaowei02
Copy link
Collaborator

@Shixiaowei02 Shixiaowei02 commented Dec 7, 2020

本提交更新了权重格式(如下图),支持顺序加载。
修改后,权重初始化的内存占用降低(50% 以上),时延有所下降(x86 测试提速约 30%,android 提速不明显),模型体积基本不变。


截屏2020-12-0820 12 15

@@ -39,9 +39,35 @@

namespace paddle {
namespace lite {
namespace model_parser {
Copy link
Collaborator

Choose a reason for hiding this comment

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

新增接口:

Buffer model_parser::LoadFile
void model_parser::SaveFile

只修改内部实现的:

LoadLoDTensor
LoadCombinedParamsPb
SaveModelNaive

#include <set>
#include <string>
#include <vector>
#include "lite/core/scope.h"
#include "lite/core/tensor.h"
#include "lite/core/variable.h"
#include "lite/model_parser/flatbuffers/param_desc.h"
#include "lite/model_parser/flatbuffers/program_desc.h"

namespace paddle {
namespace lite {
namespace fbs {

Copy link
Collaborator

Choose a reason for hiding this comment

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

fbs::LoadFilefbs:: SaveFile
修改为
SetTensorWithParam SetParamWithTensor

Superjomn
Superjomn previously approved these changes Dec 11, 2020
Copy link
Contributor

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

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

LGTM

DannyIsFunny
DannyIsFunny previously approved these changes Dec 14, 2020
Copy link
Collaborator

@DannyIsFunny DannyIsFunny left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@DannyIsFunny DannyIsFunny left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants