Skip to content

Package the quantum LSTM as an installable, tested library - #2

Merged
TravisCao merged 1 commit into
masterfrom
library-packaging
Aug 12, 2026
Merged

Package the quantum LSTM as an installable, tested library#2
TravisCao merged 1 commit into
masterfrom
library-packaging

Conversation

@TravisCao

Copy link
Copy Markdown
Owner

This turns the repository into a reusable open-source library while keeping the original paper-reproduction code intact.

What changed

  • New top-level qlstm package: QLSTM, LQLSTM, QLSTMCell, and a make_vqc factory. The layers mirror the torch.nn.LSTM interface, so they drop into existing models.
  • Built on current PyTorch and PennyLane (tested with torch 2.13, PennyLane 0.45). Each LSTM gate is an encode-entangle-measure variational circuit built from PennyLane templates, which keeps it batching-safe and differentiable; gradients reach both the circuit weights and the inputs.
  • MIT LICENSE, pyproject.toml (so pip install qlstm works), and a machine-readable CITATION.cff.
  • Test suite (11 passing): output shapes, gradient flow to inputs and every parameter, a learning check, and the API surface.
  • Runnable examples/quickstart.py, CHANGELOG.md, and CI on Python 3.10-3.12.
  • README rewritten around the library; the dataset notes are folded into a details block. The paper reproduction stays under src/.
  • The dead root __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.py drives the loss from 0.10 to 0.0006. uv build produces a valid wheel and sdist.

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>
@TravisCao
TravisCao merged commit 91dd4fd into master Aug 12, 2026
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 this pull request may close these issues.

1 participant