Keras example saves .keras ObjectStore keys but searches for keys without the extension
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- machine-learning
Research direction
Start with Algorithm.Python/KerasNeuralNetworkAlgorithm.py: initialize (around lines 34-40) compares ObjectStore keys to f'{symbol}_model', while on_end_of_algorithm (around lines 58-64) saves f'{symbol}_model.keras'. Pick one key convention and make both paths use it. Done when a model saved in one run is found and loaded by keras.models.load_model on restart, and a round-trip test covers that contract.
Written by the indexing model from the issue text.
Description
Problem
KerasNeuralNetworkAlgorithm saves models under keys that its initialization never accepts:
initializecompares each ObjectStore key withf'{symbol}_model'.on_end_of_algorithmsavesf'{symbol}_model.keras'.
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
- Run the example until it trains and saves a model.
- Restart with the same ObjectStore.
- The saved
SPY_model.keraskey does not equal the expectedSPY_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.
- Dominant language
- C#
- Stars
- 22.6k
- Forks
- 5.4k
- Avg merge
- 11h 39m
- Merged PRs (30d)
- 104
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from QuantConnect/Lean
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
QuantConnect/Lean#10206 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
QuantConnect/Lean#10199 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
QuantConnect/Lean#10198 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
QuantConnect/Lean#10197 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
QuantConnect/Lean#10191 · 1 comment ·
Maintainers usually reply within 1 day
All issues in QuantConnect/Lean
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
dotnet-outdated/dotnet-outdated#871 ·
Maintainers usually reply within 1 day
-
triage/untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
unoplatform/uno#26676 ·
Maintainers usually reply within 1 day
-
.NET bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
jhaizhou-ops/S2Arm#2177 · 3 comments ·
Maintainers usually reply within 1 day
-
area-CodeGen-coreclr untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
dotnet/runtime#138181 · 1 comment ·
Maintainers usually reply within 1 day