Skip to content

Commit 3f1afba

Browse files
authored
Merge pull request #63 from eltonjohnfanboy/fix-issue31
Fix issue #31
2 parents 952d5f4 + 2f6336c commit 3f1afba

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

dataset/dataset_qiskit_test_human_eval.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,10 +833,10 @@
833833
},
834834
{
835835
"task_id": "qiskitHumanEval/104",
836-
"prompt": "from qiskit_ibm_runtime.fake_provider import FakeOsaka, FakeSherbrooke, FakeBrisbane\nfrom qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\nfrom qiskit.circuit.library import QFT\ndef backend_with_lowest_complexity():\n \"\"\" Transpile the 4-qubit QFT circuit using preset passmanager with optimization level 3 and seed transpiler = 1234 in FakeOsaka, FakeSherbrooke and FakeBrisbane. Compute the cost of the instructions by penalizing the two qubit gate with a cost of 5, rz gates with a cost 1 and other gates with a cost 2 and return the value of the highest cost among these backends.\n \"\"\"",
837-
"canonical_solution": "\n qc = QFT(4)\n backends = [FakeOsaka(), FakeSherbrooke(), FakeBrisbane()]\n complexity_dict = {}\n for backend in backends:\n pm = generate_preset_pass_manager(\n optimization_level=3, seed_transpiler=1234, backend=backend\n )\n data = pm.run(qc).data\n complexity = 0\n for instruc in data:\n if instruc.operation.num_qubits == 2:\n complexity += 5\n elif instruc.operation.name == \"rz\":\n complexity += 1\n else:\n complexity += 2\n complexity_dict[backend.name] = complexity\n return complexity_dict[max(complexity_dict, key=complexity_dict.get)]\n",
838-
"test": "def check(candidate):\n complexity_can = candidate()\n complexity_exp = 194\n assert complexity_can == complexity_exp\n",
839-
"entry_point": "backend_with_lowest_complexity",
836+
"prompt": "from qiskit_ibm_runtime.fake_provider import FakeOsaka, FakeSherbrooke, FakeBrisbane\nfrom qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\nfrom qiskit.synthesis.qft import synth_qft_full\ndef backend_with_highest_complexity():\n \"\"\" Transpile the 4-qubit QFT circuit using preset passmanager with optimization level 3 and seed transpiler = 1234 in FakeOsaka, FakeSherbrooke and FakeBrisbane. Compute the cost of the instructions by penalizing the two qubit gate with a cost of 5, rz gates with a cost 1 and other gates with a cost 2 and return the value of the highest cost among these backends.\n \"\"\"",
837+
"canonical_solution": "\n qc = synth_qft_full(4)\n backends = [FakeOsaka(), FakeSherbrooke(), FakeBrisbane()]\n complexity_dict = {}\n for backend in backends:\n pm = generate_preset_pass_manager(\n optimization_level=3, seed_transpiler=1234, backend=backend\n )\n data = pm.run(qc).data\n complexity = 0\n for instruc in data:\n if instruc.operation.num_qubits == 2:\n complexity += 5\n elif instruc.operation.name == \"rz\":\n complexity += 1\n else:\n complexity += 2\n complexity_dict[backend.name] = complexity\n return complexity_dict[max(complexity_dict, key=complexity_dict.get)]\n",
838+
"test": "def check(candidate):\n complexity_can = candidate()\n complexity_exp = 197\n assert complexity_can == complexity_exp\n",
839+
"entry_point": "backend_with_highest_complexity",
840840
"difficulty_scale": "intermediate"
841841
},
842842
{

dataset/dataset_qiskit_test_human_eval_hard.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,11 +833,11 @@
833833
},
834834
{
835835
"task_id": "qiskitHumanEval/104",
836-
"prompt": "Transpile the 4-qubit QFT circuit using preset passmanager with optimization level 3 and seed transpiler = 1234 in FakeOsaka, FakeSherbrooke and FakeBrisbane. Compute the cost of the instructions by penalizing the two qubit gate with a cost of 5, rz gates with a cost 1 and other gates with a cost 2 and return the value of the highest cost among these backends.\nYou must implement this using a function named `backend_with_lowest_complexity` with no arguments.",
837-
"canonical_solution": "from qiskit_ibm_runtime.fake_provider import FakeOsaka, FakeSherbrooke, FakeBrisbane\nfrom qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\nfrom qiskit.circuit.library import QFT\n\ndef backend_with_lowest_complexity():\n qc = QFT(4)\n backends = [FakeOsaka(), FakeSherbrooke(), FakeBrisbane()]\n complexity_dict = {}\n for backend in backends:\n pm = generate_preset_pass_manager(\n optimization_level=3, seed_transpiler=1234, backend=backend\n )\n data = pm.run(qc).data\n complexity = 0\n for instruc in data:\n if instruc.operation.num_qubits == 2:\n complexity += 5\n elif instruc.operation.name == \"rz\":\n complexity += 1\n else:\n complexity += 2\n complexity_dict[backend.name] = complexity\n return complexity_dict[max(complexity_dict, key=complexity_dict.get)]\n",
838-
"entry_point": "backend_with_lowest_complexity",
836+
"prompt": "Transpile the 4-qubit QFT circuit using preset passmanager with optimization level 3 and seed transpiler = 1234 in FakeOsaka, FakeSherbrooke and FakeBrisbane. Compute the cost of the instructions by penalizing the two qubit gate with a cost of 5, rz gates with a cost 1 and other gates with a cost 2 and return the value of the highest cost among these backends.\nYou must implement this using a function named `backend_with_highest_complexity` with no arguments.",
837+
"canonical_solution": "from qiskit_ibm_runtime.fake_provider import FakeOsaka, FakeSherbrooke, FakeBrisbane\nfrom qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\nfrom qiskit.synthesis.qft import synth_qft_full\n\ndef backend_with_highest_complexity():\n qc = synth_qft_full(4)\n backends = [FakeOsaka(), FakeSherbrooke(), FakeBrisbane()]\n complexity_dict = {}\n for backend in backends:\n pm = generate_preset_pass_manager(\n optimization_level=3, seed_transpiler=1234, backend=backend\n )\n data = pm.run(qc).data\n complexity = 0\n for instruc in data:\n if instruc.operation.num_qubits == 2:\n complexity += 5\n elif instruc.operation.name == \"rz\":\n complexity += 1\n else:\n complexity += 2\n complexity_dict[backend.name] = complexity\n return complexity_dict[max(complexity_dict, key=complexity_dict.get)]\n",
838+
"entry_point": "backend_with_highest_complexity",
839839
"difficulty_scale": "intermediate",
840-
"test": "from qiskit_ibm_runtime.fake_provider import FakeOsaka, FakeSherbrooke, FakeBrisbane\nfrom qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\nfrom qiskit.circuit.library import QFT\ndef check(candidate):\n complexity_can = candidate()\n complexity_exp = 194\n assert complexity_can == complexity_exp\n\ncheck(backend_with_lowest_complexity)"
840+
"test": "from qiskit_ibm_runtime.fake_provider import FakeOsaka, FakeSherbrooke, FakeBrisbane\nfrom qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\nfrom qiskit.synthesis.qft import synth_qft_full\ndef check(candidate):\n complexity_can = candidate()\n complexity_exp = 197\n assert complexity_can == complexity_exp\n\ncheck(backend_with_highest_complexity)"
841841
},
842842
{
843843
"task_id": "qiskitHumanEval/105",

0 commit comments

Comments
 (0)