Package the quantum LSTM as an installable, tested library - #2
Merged
Conversation
Expose the paper's model as a reusable, torch.nn.LSTM-compatible library alongside the original reproduction code, which stays under src/. - add top-level `qlstm` package: QLSTM, LQLSTM, QLSTMCell, make_vqc, built on current PyTorch and PennyLane with an encode-entangle-measure circuit per gate - add MIT LICENSE, pyproject packaging (pip install qlstm), and CITATION.cff - add tests for shapes, gradient flow to inputs and weights, a learning check, and the API surface (11 passing); add a runnable example and CHANGELOG - add CI on Python 3.10-3.12 - rewrite README around the library; fold the dataset notes into a details block - empty the dead root __init__.py (a broken relative import that also broke test collection) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This turns the repository into a reusable open-source library while keeping the original paper-reproduction code intact.
What changed
qlstmpackage:QLSTM,LQLSTM,QLSTMCell, and amake_vqcfactory. The layers mirror thetorch.nn.LSTMinterface, so they drop into existing models.LICENSE,pyproject.toml(sopip install qlstmworks), and a machine-readableCITATION.cff.examples/quickstart.py,CHANGELOG.md, and CI on Python 3.10-3.12.src/.__init__.py(a relative import that could never resolve, and which broke test collection) is now empty.Verification
pytest -q→ 11 passed.python examples/quickstart.pydrives the loss from 0.10 to 0.0006.uv buildproduces a valid wheel and sdist.