Skip to content

Add trivial MPS network with generate() and wire generate into NetworkProto - #195

Merged
hzhangxyz merged 4 commits into
mainfrom
copilot/add-mps-network-functionality
Mar 5, 2026
Merged

Add trivial MPS network with generate() and wire generate into NetworkProto#195
hzhangxyz merged 4 commits into
mainfrom
copilot/add-mps-network-functionality

Conversation

Copilot AI commented Mar 5, 2026

Copy link
Copy Markdown
Contributor
  • Add generate method to NetworkProto in model_dict.py with return type tuple[torch.Tensor, torch.Tensor, torch.Tensor, None]
  • Add generate method (raises NotImplementedError) to all 3 WaveFunction classes in mlp.py
  • Add generate method (raises NotImplementedError) to all 3 WaveFunction classes in transformers.py
  • Create qmp/networks/mps.py with WaveFunction class:
    • Constructor params: sites, physical_dim, virtual_dim
    • forward(): compute MPS amplitude via tensor contraction with open boundary conditions
    • generate_unique(): raises NotImplementedError
    • generate(): autoregressive sampling returning (unique_configs, amplitudes, counts, None)
  • Use NotImplementedError (not RuntimeError) in all generate stubs
  • Align generate docstring style with generate_unique across model_dict.py and mps.py
Original prompt

This section details on the original issue you should resolve

<issue_title>添加一个mps.py的网络</issue_title>
<issue_description>里面只含有一个平凡的网络, 输入参数是virtual dim和physical dim , 然后没有generate_unique这个函数(raise not implement error), 但是有一个generate函数. 同时给network proto加上generate函数, generate的输出应该是 tuple[torch.Tensor, torch.Tensor, torch.Tensor, None] 其中第三个参数是这个config被采样到的次数, 前面两个和generate unique一样. 目前已经存在的函数的def generate要raise not implemented error</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…tworks

Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add mps.py network with generate function Add trivial MPS network with generate() and wire generate into NetworkProto Mar 5, 2026

@hzhangxyz hzhangxyz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 NotImplementedError. 另外, generate的注释中, 除非是新的那个返回值, 其他尽量保持和 generate_unique 字母级语言风格一致

…ate_unique

Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>

Copilot AI commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

用 NotImplementedError. 另外, generate的注释中, 除非是新的那个返回值, 其他尽量保持和 generate_unique 字母级语言风格一致

Done in 03984c1. Changed all RuntimeError to NotImplementedError in the generate stubs (mlp.py, transformers.py) and generate_unique stub (mps.py), and aligned the generate docstrings in model_dict.py and mps.py to match the letter-level style of generate_unique.

@hzhangxyz
hzhangxyz marked this pull request as ready for review March 5, 2026 19:50
Copilot AI review requested due to automatic review settings March 5, 2026 19:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@hzhangxyz
hzhangxyz merged commit 92cbab2 into main Mar 5, 2026
7 checks passed
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.

添加一个mps.py的网络

3 participants