mit-han-lab / torchquantum

A PyTorch-based framework for Quantum Classical Simulation, Quantum Machine Learning, Quantum Neural Networks, Parameterized Quantum Circuits with support for easy deployments on real quantum computers.
https://torchquantum.org
MIT License
1.24k stars 184 forks source link

Make TQ Compatible with Qiskit ≥1.0.0 #267

Closed king-p3nguin closed 3 weeks ago

king-p3nguin commented 1 month ago

Description

Resolve #262

Notes

(I am contributing to this project as a unitaryHACK participant)

GenericP3rson commented 1 month ago

Hey, if you could take a look at the tests to get them functional, that would be amazing! Don’t worry about getting the lint and pre-commit working (they generally won’t pass), just get the Python package tests functional (which should essentially be the same thing from running pytest)

Right now, it looks like there’s a small syntax error:

AttributeError: 'Qubit' object has no attribute 'index'. Did you mean: '_index'?

You may also need to change the extra dependencies in the workflow here. (We may actually be able to delete that line.)

king-p3nguin commented 1 month ago

Thanks for being patient. I ran the tests and examples locally and they should be working now. It seems like sometimes the test using random numbers fails, so I increased the threshold of assertion.

GenericP3rson commented 1 month ago

Awesome, the PR functionally looks great! I’ll do a more thorough review later today then we can merge. Thanks so much!

GenericP3rson commented 1 month ago

I’ll get to this ASAP, sorry about the delay! In the meantime though, could you comment on the issue so I can more easily assign you it? That is necessary for making sure you get the bounty at the end of Unitary Hack!

king-p3nguin commented 1 month ago

Hi @GenericP3rson, it seems like there are still some places I have to change to merge the dev branch. Would you like to review the code first, or should I resolve the remaining compatibility issues first?

GenericP3rson commented 1 month ago

Don't worry about it for now, I'm going to cherrypick the code that is failing out (since it's mostly density matrix code that isn't ready for the dev branch yet) and merge into the updated branch.

GenericP3rson commented 1 month ago

Looks like I messed something up while rebasing — I’ll fix that up!