-
Notifications
You must be signed in to change notification settings - Fork 61
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
Migrating Pytorch backend to Qiboml #1510
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1510 +/- ##
==========================================
- Coverage 99.72% 99.69% -0.03%
==========================================
Files 80 79 -1
Lines 11784 11631 -153
==========================================
- Hits 11752 11596 -156
- Misses 32 35 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
+------------------+------+---------+-----------+---------+ | ||
| Operating System | qibo | qibojit |Tensorflow | Pytorch | | ||
+==================+======+=========+===========+=========+ | ||
| Linux x86 | Yes | Yes | Yes | Yes | | ||
+------------------+------+---------+-----------+---------+ | ||
| MacOS >= 10.15 | Yes | Yes | Yes | Yes | | ||
+------------------+------+---------+-----------+---------+ | ||
| Windows | Yes | Yes | Yes | Yes | | ||
+------------------+------+---------+-----------+---------+ |
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.
Should this be updated to contemplate the CPU / GPU subdivision? Both qibojit
and qiboml
have backends that work on both.
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.
I don't know, since this is already shown in the backends diagram.
That function is needed to properly have some methods of |
preferred package is installed following `Tensorflow's <https://www.tensorflow.org/install>`_ | ||
or `Pytorch's <https://pytorch.org/get-started/locally/>`_ installation instructions. | ||
|
||
To switch to Tensorflow or Pytorch backend please do: |
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.
Not sure whether it is worth to have details about the ml backends. I would probably place this in the qiboml
docs and link them here.
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.
I agree, I would remove these lines. Probably it is better to wait the moment the Qiboml docs are ready so that we can just link to the proper section.
if backend.platform in ["tensorflow", "pytorch"]: | ||
pytest.skip( | ||
"Tensorflow and Pytorch do not support operations with sparse matrices." | ||
) |
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.
This is not really for this PR, but I think that both of them support sparse matrices to some extent https://pytorch.org/docs/stable/generated/torch.sparse.mm.html
https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/sparse-mat-mul
I am not sure what was causing problems here, but I guess it is more a matter of how the operation is called rather than the impossibility to perform it. Anyway, this is probably out of the scope of this PR.
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.
I just opened an issue with this comment.
(backend.name != "pytorch") or (backend.platform != "tensorflow") | ||
backend.platform not in ["tensorflow", "pytorch"] |
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.
This could become a property of the backend, e.g.:
@property
def support_differentiation(self,):
return False
to avoid checking precisely for which backend this works, but again might be out of scope here.
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.
I think the best thing for Qibo will be to remove all these tests about variational models.
Co-authored-by: Renato Mello <[email protected]>
By my side, I think we can stop modifications here for this PR. Still we need to remove a lot of examples and subsections from the docs, but I would prefer to do that after we populate the Qiboml documentation. Otherwise we will have vacations in the documentation. What you think @renatomello, @BrunoLiegiBastonLiegi? |
We need to update this https://github.com/qiboteam/qiboml/blob/800e800d54f4962f4890716c4b1539014c69c1b5/src/qiboml/backends/__init__.py#L3 BTW, is the |
Done in qiboml, thanks!
That was outdated. Just closed! |
okay it should be just a matter of regenerating the lock here now |
https://github.com/qiboteam/qibo/actions/runs/11888475398/job/33209011064?pr=1510 |
This should have been solved merging qiboteam/qiboml#52 (comment) yesterday. Rerunning the tests to double check :) |
I just removed a gradient test from here and opened a dedicated issue in qiboml. |
You mean after this PR is merged, right? |
Yes, I mean this PR should be solving that problem too. |
Checklist:
Some things to be discussed and still not touched in this PR