Keras example saves .keras ObjectStore keys but searches for keys without the extension

未关闭 适合新手
#10,216 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

从 Algorithm.Python/KerasNeuralNetworkAlgorithm.py 开始:initialize(大约第 34-40 行)将 ObjectStore 的键与 f'{symbol}_model' 比较,而 on_end_of_algorithm(大约第 58-64 行)保存 f'{symbol}_model.keras'。选择一种键的约定,并让两条路径都使用它。当某次运行中保存的模型在重启时能被找到并由 keras.models.load_model 加载,且有往返测试覆盖该契约时,即完成。

由索引模型根据 Issue 内容生成。

描述

priority:p2
Problem

KerasNeuralNetworkAlgorithm saves models under keys that its initialization never accepts:

Consequently, restarting with models saved by the example skips keras.models.load_model for every saved model. The extension was added to the saving path in #8658, but not to the loading comparison.

Reproduction and evidence
  1. Run the example until it trains and saves a model.
  2. Restart with the same ObjectStore.
  3. The saved SPY_model.keras key does not equal the expected SPY_model, so initialization continues without restoring it.

Evaluating the actual key-assignment AST expressions from the current source with symbol='SPY' produces:

initialize: SPY_model
on_end_of_algorithm: SPY_model.keras

This verifies the key mismatch independently of TensorFlow execution; a complete training/restart run was not performed.

Required result

A model saved by the example must be discovered and restored on the next run, using a compatible Keras filename and preserving its trained weights. Add a round-trip regression test for the save/load key contract.

主要语言
C#
星标
22.6k
派生
5.4k
平均合并
11 小时 39 分钟
30 天内合并 PR
104

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

QuantConnect/Lean 的其他 Issue

查看 QuantConnect/Lean 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。