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

Check if torch is installed on tests #55

Merged
merged 3 commits into from
Apr 19, 2021

Conversation

manoelmarques
Copy link
Contributor

Summary

Fixes #54

Details and comments

@manoelmarques manoelmarques added the type: bug 🐞 Something isn't working label Apr 16, 2021
@manoelmarques manoelmarques self-assigned this Apr 16, 2021
drewrisinger
drewrisinger previously approved these changes Apr 16, 2021
Copy link

@drewrisinger drewrisinger left a comment

Choose a reason for hiding this comment

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

  • Diff LGTM
  • CI Tests pass

Looks like your solution was to wrap the test in a try/catch block. I was wondering if a fixture something like https://github.com/Qiskit/qiskit-terra/blob/0fc83f44a6e80969875c738b2cee7bc33223e45f/qiskit/test/decorators.py#L66-L76
would be a better way to do it, but that could be a later step.

@woodsp-ibm
Copy link
Member

I noticed, via the CI change to uninstall what we install as extras, that we torchvision as an extra requires. From what I can tell torchvision is only used in the notebook tutorial, not in the core library code. But if the user installs torch via the pip install qiskit-machine-learning[torch] they will get torchvision that the library does not use/need. I think the extra requires should be limited to what the library needs/can use i.e. torch and should not install torchvision that maybe a user does not want and certainly does not need for the core library. We can install torchvision in the CI for running notebooks (or any other library that the notebook examples may use in the future that the core does include/need).

@manoelmarques
Copy link
Contributor Author

I removed torchvision from extra requires.

@manoelmarques manoelmarques merged commit 89bc430 into qiskit-community:master Apr 19, 2021
@manoelmarques manoelmarques deleted the torch branch April 19, 2021 15:15
drewrisinger added a commit to drewrisinger/nur-packages that referenced this pull request Apr 19, 2021
gentinettagian pushed a commit to gentinettagian/qiskit-machine-learning that referenced this pull request Dec 14, 2021
* Check if torch is installed on tests

* Add extra library test decorator

* Remove torchvision from extra requires
edoaltamura pushed a commit that referenced this pull request Nov 18, 2024
* Cleanup and bugfix for different primitives support (#55)

* Quick fix and lint for unit tests.

* Fixed a bug in ComputeUncompute and lint corrections.

* Fix formatting for algorithm tests

* Reformatting some variables to make lint compliant.

* Refactor: Cleanup code, preserve existing formatting, apply minor bug fixes, and update missing documentation

* Removing unsupported classes.

* Fix for lint

* Fix lint errors uncovered during workflow checks

* Adjust a unit test to accomodate noise-related variations
mergify bot pushed a commit that referenced this pull request Nov 18, 2024
* Cleanup and bugfix for different primitives support (#55)

* Quick fix and lint for unit tests.

* Fixed a bug in ComputeUncompute and lint corrections.

* Fix formatting for algorithm tests

* Reformatting some variables to make lint compliant.

* Refactor: Cleanup code, preserve existing formatting, apply minor bug fixes, and update missing documentation

* Removing unsupported classes.

* Fix for lint

* Fix lint errors uncovered during workflow checks

* Adjust a unit test to accomodate noise-related variations

(cherry picked from commit 2f7e19c)
edoaltamura pushed a commit that referenced this pull request Nov 18, 2024
* Cleanup and bugfix for different primitives support (#55)

* Quick fix and lint for unit tests.

* Fixed a bug in ComputeUncompute and lint corrections.

* Fix formatting for algorithm tests

* Reformatting some variables to make lint compliant.

* Refactor: Cleanup code, preserve existing formatting, apply minor bug fixes, and update missing documentation

* Removing unsupported classes.

* Fix for lint

* Fix lint errors uncovered during workflow checks

* Adjust a unit test to accomodate noise-related variations

(cherry picked from commit 2f7e19c)

Co-authored-by: M. Emre Sahin <[email protected]>
OkuyanBoga added a commit that referenced this pull request Dec 9, 2024
* Fix StackOverflow formatting typo in `README.md` (#847)

* Fix StackOverflow formatting typo

* Bump numpy version to 2

* Post release 0.8 (#844)

* Change version and activate stable tutorial tests

* Bump VERSION.txt

* Cleanup and bugfix to support different primitives. (#55) (#855)

* Cleanup and bugfix for different primitives support (#55)

* Quick fix and lint for unit tests.

* Fixed a bug in ComputeUncompute and lint corrections.

* Fix formatting for algorithm tests

* Reformatting some variables to make lint compliant.

* Refactor: Cleanup code, preserve existing formatting, apply minor bug fixes, and update missing documentation

* Removing unsupported classes.

* Fix for lint

* Fix lint errors uncovered during workflow checks

* Adjust a unit test to accomodate noise-related variations

* Docs 0p8 clean (#857)

* Reducing numpy version for deploy-docs.yml to fix numpy 2.0 bug (#851)

* Update deploy-docs.yml (#853)

- Updated Python version from 3.9 to 3.10.
- Removed version constraint on torchvision.
- Removed Numpy version constraint.

* Update deploy-docs.yml to '3.10' (#854)

---------

Co-authored-by: M. Emre Sahin <[email protected]>
Co-authored-by: Oscar <[email protected]>

* Remove `fastdtw` (#861)

* ci(mergify): upgrade configuration to current format (#860)

Co-authored-by: Mergify <37929162+mergify[bot]@users.noreply.github.com>

* [Docs] Fix TOCs and update QNN derived primitives (#862)

* Fix docs and update QNN derived primitives

* Fix LearningRate in TOCs

* Fix string formatting

* Fix spelling

* Fix spelling

* Fix spelling

* Fix copyright

* Pin Qiskit to `<1.3` (#865)

* Added callback function support for adam-amsgrad optimizer. (#869)

* Added callback functionality to ADAM optimiser

* Added unittest for callback function

* Cumulative update to extend the V2 support for algorithms, updated tutorials, and partial multiclass support for VQC. (#870)

* Added migration guide for 0.8

* Added V2 support for algorithms

* V2 support added for unit tests of the algorithms and tutorials are updated for V2

* Spell check and lint

* Update 02_migration_guide_0.8.rst

* Update 02_migration_guide_0.8.rst

adding optimisation level

* Bugfix for V2 primitives without transpilation

* Fix tutorials and release notes

* Update 04_torch_qgan.ipynb

* Bugfix for Qiskit 1.x register name ambiguity

* Restored docs

* Typo fix in gradients

---------

Co-authored-by: smens <[email protected]>
Co-authored-by: Oscar <[email protected]>

* Add predict_proba Support to PegasosQSVC and NeuralNetworkClassifier (#871)

* Adding a predict_proba function to classifiers. (#57)

* Update README.md

* Predict proba for NNC and PegQSVC

* Rewriting predict proba features and docstring

It was very inefficient before and didn't have the validation checks needed. The code is now more clear and docstring has been added.

* Tweak documentation for NNC and PegasosQSVC, silence lint E1101 on torch connector

* Update test with `QNN.predict_proba`

* Update test with `PegasosESVC.predict_proba`

* Added a release note and solved conflicts with main

---------

Co-authored-by: FrancescaSchiav <[email protected]>
Co-authored-by: oscar-wallis <[email protected]>
Co-authored-by: Edoardo Altamura <[email protected]>
Co-authored-by: smens <[email protected]>

* Reformatted docs

* Fix usage of sklearn

---------

Co-authored-by: FrancescaSchiav <[email protected]>
Co-authored-by: oscar-wallis <[email protected]>
Co-authored-by: Edoardo Altamura <[email protected]>
Co-authored-by: smens <[email protected]>

* Bump version to 0.8.1

Update version for bug-fix release

---------

Co-authored-by: Edoardo Altamura <[email protected]>
Co-authored-by: Oscar <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: smens <[email protected]>
Co-authored-by: FrancescaSchiav <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests (Torch): test_batch_gradients fails if pytorch not installed
3 participants