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.3k stars 197 forks source link

running the example #251

Closed badreddinemerabet closed 6 months ago

badreddinemerabet commented 6 months ago

ModuleNotFoundError Traceback (most recent call last) in <cell line: 2>() 1 import torchquantum as tq ----> 2 import torchquantum.functional as tqf 3 4 qdev = tq.QuantumDevice(n_wires=2, bsz=5, device="cpu", record_op=True) # use device='cuda' for GPU 5

ModuleNotFoundError: No module named 'torchquantum.functional'

I have the error also, and I didn't manage to solve it

Also I tried the colab notebook u post

GenericP3rson commented 6 months ago

Hi! Thanks for the opening the issue. There was an API change recently, and I’ll deep dive what’s exactly is going on here by Saturday. In the meantime, if you’re looking for hello-world examples, we run several examples through for our tests, so anything in this list should be functional: https://github.com/mit-han-lab/torchquantum/blob/b7f8c36db0fed0f5336ec15e615825780487249a/.github/workflows/functional_tests.yaml#L43C7-L69C51

I personally think mnist is a pretty good place to start. Let me know if you have any questions and will get this done shortly!

badreddinemerabet commented 6 months ago

i want to use the QNN for my own data for image classification. so I tried first to run the Hello World program just to check if my environment is ok

GenericP3rson commented 6 months ago

I see. With a fresh install, I cannot replicate the issue, interestingly. How did you install torchquantum?

badreddinemerabet commented 6 months ago

i fix it, thank you very much

GenericP3rson commented 6 months ago

Awesome, could you post the solution? It might help others running into the same issue!

badreddinemerabet commented 6 months ago

I created a new environment and downgraded all the packages to approximately the 2023 release.