-
Notifications
You must be signed in to change notification settings - Fork 49
Remove mps limit custom mps #1065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Hello. You may have forgotten to update the changelog!
|
multiphaseCFD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @LuisAlfredoNu for the nice work!
| } | ||
|
|
||
| const auto &MPS_shape_dest = tensor_network.getSitesExtents(); | ||
| // print MPS_shape_dest and MPS_shape_source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // print MPS_shape_dest and MPS_shape_source |
| std::cout << "MPS_shape_dest: " << std::endl; | ||
| for (const auto &shape : MPS_shape_dest) { | ||
| for (const auto &dim : shape) { | ||
| std::cout << dim << " "; | ||
| } | ||
| std::cout << std::endl; | ||
| } | ||
|
|
||
| std::cout << "MPS_shape_source: " << std::endl; | ||
| for (const auto &shape : MPS_shape_source) { | ||
| for (const auto &dim : shape) { | ||
| std::cout << dim << " "; | ||
| } | ||
| std::cout << std::endl; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| std::cout << "MPS_shape_dest: " << std::endl; | |
| for (const auto &shape : MPS_shape_dest) { | |
| for (const auto &dim : shape) { | |
| std::cout << dim << " "; | |
| } | |
| std::cout << std::endl; | |
| } | |
| std::cout << "MPS_shape_source: " << std::endl; | |
| for (const auto &shape : MPS_shape_source) { | |
| for (const auto &dim : shape) { | |
| std::cout << dim << " "; | |
| } | |
| std::cout << std::endl; | |
| } |
|
|
||
| _device_options = { | ||
| "mps": ("backend", "max_bond_dim", "cutoff", "cutoff_mode"), | ||
| "mps": ("backend", "max_bond_dim", "cutoff", "cutoff_mode", "bond_dim"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you please update the docstr to add the new arg?
| self._method, | ||
| self._c_dtype, | ||
| device_name=self.name, | ||
| max_bond_dim=self._max_bond_dim, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wondering how max_bond_dim would work in the background if _bond_dim.
| if self._cutoff_mode not in ["rel", "abs"]: | ||
| raise ValueError(f"Unsupported cutoff mode: {self._cutoff_mode}") | ||
|
|
||
| if self._bond_dim is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good as long as it works for algo and product. it would be even better to late initialize TN object util MPSprep is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea, but I am afraid of the potential risk of skipping multiple safety checks because the only way to update the TN object until the call of qml.MPSPrep should be destroy the current MPS and then create a new one with the new bond dims 😕
Before submitting
Please complete the following checklist when submitting a PR:
All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to the
testsdirectory!All new functions and code must be clearly commented and documented.
If you do make documentation changes, make sure that the docs build and
render correctly by running
make docs.Ensure that the test suite passes, by running
make test.Add a new entry to the
.github/CHANGELOG.mdfile, summarizing thechange, and including a link back to the PR.
Ensure that code is properly formatted by running
make format.When all the above are checked, delete everything above the dashed
line and fill in the pull request template.
Context:
Currently, LT only accepts MPS with the following bond dimensions:
Which is a limitation of
MPSPrepgate because it is not possible to pass custom MPS from other softwares that works with different MPS layoutsDescription of the Change:
Remove the checks regarding MPS bond dimension and define the device argument
bond_dimto pass the new bond dimension that will be used in the device initializer to allocate the a custom MPS into the GPU.An example of how to use it:
Benefits:
Possible Drawbacks:
The MPS shape should be symmetric, i.e.
[[2,n] [n,2,m] ... [m,2,n] [n,2]]Related GitHub Issues:
[sc-83835]