如何在联合的TensorFlow中节省重量

发布于 2025-02-11 09:45:19 字数 440 浏览 4 评论 0 原文

我只想在损失降低并重用它们进行评估时节省权重。

lowest_loss = Inf

    if loss[round] < lowest_loss:
        lowest_loss = loss[round]

        model_weights = transfer_learning_iterative_process.get_model_weights(state)



eval_metric = federated_eval(model_weights, [fed_valid_data])

在哪里:

  federated_eval = tff.learning.build_federated_evaluation(model_fn)

是否有可能将服务器权重以HDF5格式或检查点保存并重复使用?

I want to save weights only when loss is getting lower and reuse them for evaluation.

lowest_loss = Inf

    if loss[round] < lowest_loss:
        lowest_loss = loss[round]

        model_weights = transfer_learning_iterative_process.get_model_weights(state)



eval_metric = federated_eval(model_weights, [fed_valid_data])

where:

  federated_eval = tff.learning.build_federated_evaluation(model_fn)

Is there a possible way to save server weights in hdf5 format or as a checkpoint and reuse it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

有木有妳兜一样 2025-02-18 09:45:19

是的,这可以使用TFF中的帮助者来完成。通常,这种功能由 tff.program。 ProgramStateManagers 。可以找到保存到文件系统的实现,可以找到 tff.simulation.run_training_process

Yes, this can be done with helpers in TFF. Generally, this kind of functionality is implemented by tff.program.ProgramStateManagers. An implementation which saves to a filesystem can be found here, and example usages can be found in the implementation of tff.simulation.run_training_process.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文