Skip to content
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

Add support for pulser-diff backend #686

Merged
merged 8 commits into from
May 29, 2024
Merged

Conversation

vytautas-a
Copy link
Collaborator

Modify pulser-core to support all current features of differentiable torch backend.

@vytautas-a vytautas-a requested a review from HGSilveri May 21, 2024 08:14
Copy link
Collaborator

@HGSilveri HGSilveri left a comment

Choose a reason for hiding this comment

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

I think you had some changes that I ended up doing but they got applied anyway. I'll let you decided which ones actually make sense to keep

Copy link
Collaborator

@HGSilveri HGSilveri left a comment

Choose a reason for hiding this comment

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

New changes are looking 👌

Copy link
Collaborator

@HGSilveri HGSilveri left a comment

Choose a reason for hiding this comment

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

Last comment and we can merge, great job!

Copy link
Collaborator

@HGSilveri HGSilveri left a comment

Choose a reason for hiding this comment

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

Perfect, let's merge! Thanks a lot for your efforts

@HGSilveri HGSilveri marked this pull request as ready for review May 29, 2024 14:48
@HGSilveri HGSilveri merged commit 30e562d into abstract-array May 29, 2024
3 of 7 checks passed
@HGSilveri HGSilveri deleted the va/pulser-diff branch May 29, 2024 14:49
HGSilveri pushed a commit that referenced this pull request May 30, 2024
* works with basic features of pulser-diff

* Fixed phase attribute setting; removed debugging code; reverted unnecessary changes

* Modified register creation code to work with AbstractArray; register coordinates are differentiable with pulser-diff

* Fixed type hints

* Minor fixes and refactoring

* Modified ParamObj code to work with quantum model training in pulser-diff

* Minor refactoring; add possibility to ensure 0D AbstractArray is reshaped into 1D

* Force array only for scalars
HGSilveri pushed a commit that referenced this pull request Jun 13, 2024
* works with basic features of pulser-diff

* Fixed phase attribute setting; removed debugging code; reverted unnecessary changes

* Modified register creation code to work with AbstractArray; register coordinates are differentiable with pulser-diff

* Fixed type hints

* Minor fixes and refactoring

* Modified ParamObj code to work with quantum model training in pulser-diff

* Minor refactoring; add possibility to ensure 0D AbstractArray is reshaped into 1D

* Force array only for scalars
HGSilveri pushed a commit that referenced this pull request Jun 13, 2024
* works with basic features of pulser-diff

* Fixed phase attribute setting; removed debugging code; reverted unnecessary changes

* Modified register creation code to work with AbstractArray; register coordinates are differentiable with pulser-diff

* Fixed type hints

* Minor fixes and refactoring

* Modified ParamObj code to work with quantum model training in pulser-diff

* Minor refactoring; add possibility to ensure 0D AbstractArray is reshaped into 1D

* Force array only for scalars
HGSilveri pushed a commit that referenced this pull request Jun 26, 2024
* works with basic features of pulser-diff

* Fixed phase attribute setting; removed debugging code; reverted unnecessary changes

* Modified register creation code to work with AbstractArray; register coordinates are differentiable with pulser-diff

* Fixed type hints

* Minor fixes and refactoring

* Modified ParamObj code to work with quantum model training in pulser-diff

* Minor refactoring; add possibility to ensure 0D AbstractArray is reshaped into 1D

* Force array only for scalars
HGSilveri added a commit that referenced this pull request Sep 17, 2024
* Defining pulser.math and AbstractArray

* POC: Differentiable constant pulse amp

Typing is still failing

* Fix typing in waveforms

* Fix all typing errors in POC

* Pass all existing UTs

* Pass all UTs without array support

* Fix typing

* All tests pass with torch installed

* Add support for pulser-diff backend (#686)

* works with basic features of pulser-diff

* Fixed phase attribute setting; removed debugging code; reverted unnecessary changes

* Modified register creation code to work with AbstractArray; register coordinates are differentiable with pulser-diff

* Fixed type hints

* Minor fixes and refactoring

* Modified ParamObj code to work with quantum model training in pulser-diff

* Minor refactoring; add possibility to ensure 0D AbstractArray is reshaped into 1D

* Force array only for scalars

* Fix UTs after pulser-diff changes

* Avoid using AbstractArrayLike outside of pulser.math

* Preserve gradient in EOM mode

* Add torch as an optional requirement

* Support waveform multiplication with abstract array

* Explicitly marking the differentiable parameters

* Remove __array_wrap__

* Pass relevant UTs without array support

* Support new features

* Using pm.Differentiable whenever possible

* Simplifying Waveform.__getitem__() type hint

* UTs for new features outside of pulser.math

* Write torch UTs for registers

* Write UTs for waveforms

* UTs for pulse

* UTs for EOM

* UTs on internal functionality

* UTs for Sequence with autograd

* Implicitly cover math functions

* Removing AbstractArray.__hash__() and differentiable phase shifts

* Finish unit tests

* Update CI to run tests with and without torch

* Fix CI errors

* Fix failing no-torch UT

* Minor corrections

* Include pulser[torch] installation in the README

* Fix warning in UT after merge

* Incorporating the latest changes

* Fix typing

* Addressing review comments

* Including `detach()` in Differentiable protocol

* Differentiable -> TensorLike

* Tentatively allow waveform division by array

* Full coverage

---------

Co-authored-by: Vytautas Abramavicius <145791635+vytautas-a@users.noreply.github.com>
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.

2 participants