From 8cc6af09b4b46b3e57143ae7e91bcae0bebb3792 Mon Sep 17 00:00:00 2001 From: woodsp-ibm Date: Mon, 13 May 2024 08:49:38 -0400 Subject: [PATCH] Fix test for MAc ARM and pin torch --- .github/actions/install-machine-learning/action.yml | 3 ++- test/algorithms/regressors/test_qsvr.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/actions/install-machine-learning/action.yml b/.github/actions/install-machine-learning/action.yml index 494988b69..17dbee841 100644 --- a/.github/actions/install-machine-learning/action.yml +++ b/.github/actions/install-machine-learning/action.yml @@ -1,6 +1,6 @@ # This code is part of a Qiskit project. # -# (C) Copyright IBM 2021, 2023. +# (C) Copyright IBM 2021, 2024. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory @@ -17,6 +17,7 @@ runs: using: "composite" steps: - run : | + pip install torch==2.2.2 pip install -e .[torch,sparse] pip install -U -c constraints.txt -r requirements-dev.txt shell: bash diff --git a/test/algorithms/regressors/test_qsvr.py b/test/algorithms/regressors/test_qsvr.py index a365a3fe1..2f3a6ef21 100644 --- a/test/algorithms/regressors/test_qsvr.py +++ b/test/algorithms/regressors/test_qsvr.py @@ -1,6 +1,6 @@ # This code is part of a Qiskit project. # -# (C) Copyright IBM 2021, 2023. +# (C) Copyright IBM 2021, 2024. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory @@ -51,7 +51,7 @@ def setUp(self): def test_qsvr(self): """Test QSVR""" - qkernel = FidelityQuantumKernel(feature_map=self.feature_map) + qkernel = FidelityQuantumKernel(feature_map=self.feature_map, enforce_psd=False) qsvr = QSVR(quantum_kernel=qkernel) qsvr.fit(self.sample_train, self.label_train) @@ -61,7 +61,7 @@ def test_qsvr(self): def test_change_kernel(self): """Test QSVR with QuantumKernel later""" - qkernel = FidelityQuantumKernel(feature_map=self.feature_map) + qkernel = FidelityQuantumKernel(feature_map=self.feature_map, enforce_psd=False) qsvr = QSVR() qsvr.quantum_kernel = qkernel