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

训练完毕后,模型的存储参数以稀疏(sparse)形式存储的使用场景? #948

Closed
backyes opened this issue Dec 19, 2016 · 2 comments
Assignees

Comments

@backyes
Copy link
Contributor

backyes commented Dec 19, 2016

  CpuVector vec(*bufs_[PARAMETER_VALUE].get());
  Header header;
  header.version = kFormatVersion;
  header.valueSize = sizeof(real);
  header.size = getSize();

  CHECK_EQ(header.size, vec.getSize());

  CHECK(s.write(reinterpret_cast<char*>(&header), sizeof(header)))
      << "Fail to write parameter " << getName();

  CHECK(s.write(reinterpret_cast<char*>(vec.getData()),
                header.size * sizeof(real)))
      << "Fail to write parameter " << getName();
  if (config_.is_sparse()) {
    CpuIVector rows(*intBufs_[PARAMETER_ROWS].get());
    CpuIVector cols(*intBufs_[PARAMETER_COLS].get());
    CHECK(s.write(reinterpret_cast<char*>(rows.getData()),
                  rows.getSize() * sizeof(int)))
        << "Fail to write parameter " << getName();
    CHECK(s.write(reinterpret_cast<char*>(cols.getData()),
                  cols.getSize() * sizeof(int)))
        << "Fail to write parameter " << getName();
  }

  return true;
}

Parameter稀疏存储(特指训练完毕后,存储并用户预测的情况)的使用场景 ?

请给出sparse的全面解释。

@backyes backyes self-assigned this Dec 19, 2016
@qingqing01
Copy link
Contributor

qingqing01 commented Dec 19, 2016

weight是sparse一种场合是Pruning模型压缩方法: https://arxiv.org/abs/1510.00149 。另外fc_layer本身也支持weight是稀疏存储。

@backyes
Copy link
Contributor Author

backyes commented Dec 21, 2016

#890

zhhsplendid pushed a commit to zhhsplendid/Paddle that referenced this issue Sep 25, 2019
* fleet api

* fleet api

* fleet api
wangxicoding pushed a commit to wangxicoding/Paddle that referenced this issue Dec 9, 2021
* modify docs

* modify docs

* del inheritance

* add inheri
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 a pull request may close this issue.

2 participants