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.32k stars 200 forks source link

enhance the documentations and tests #135

Closed Hanrui-Wang closed 1 year ago

Hanrui-Wang commented 1 year ago

To make torchquantum more accessible and easy to use for our users, we need your help on improving the torchquantum documentations and tests. The follow things could be done:

Please don't hesitate to ask and discuss questions here!

josephtedds commented 1 year ago

Think I might look at converting a few of those examples into notebooks. Are there any in particular that you'd be keen to get running?

Hanrui-Wang commented 1 year ago

Hi josephtedds,

Thanks a lot for your interest in this topic! You may start with the mnist example https://github.com/mit-han-lab/torchquantum/blob/main/examples/simple_mnist/mnist_example.py

MihirsinhChauhan commented 1 year ago

hey @Hanrui-Wang I'm interested. can you assign me this and tell me about start point

josephtedds commented 1 year ago

Found something when working through the MNIST example - the Qiskit part, specifically, runs into quite a large error.

From what I can deduce, it's a multiprocessing error as I can run the functions from the problem line by themselves. It's just the use of the map function that does it.

results = p.map(run_job_worker, feed_dicts)

in https://github.com/mit-han-lab/torchquantum/blob/main/torchquantum/plugins/qiskit_processor.py

Do you want me to raise this as a separate issue?

Full Trace is:


  File "c:\Users\josep\Documents\GitHub\torchquantum\examples\simple_mnist\mnist_example.py", line 257, in <module>
    main()
  File "c:\Users\josep\Documents\GitHub\torchquantum\examples\simple_mnist\mnist_example.py", line 231, in main
    valid_test(dataflow, "test", model, device, qiskit=True)
  File "c:\Users\josep\Documents\GitHub\torchquantum\examples\simple_mnist\mnist_example.py", line 134, in valid_test
    outputs = model(inputs, use_qiskit=qiskit)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "c:\Users\josep\Documents\GitHub\torchquantum\examples\simple_mnist\mnist_example.py", line 95, in forward
    x0 = self.qiskit_processor.process_ready_circs(qdev, assembled_circs).to(  # type: ignore
  File "C:\Users\josep\Documents\GitHub\torchquantum\torchquantum\plugins\qiskit_processor.py", line 722, in process_ready_circs
    counts = self.process_ready_circs_get_counts(circs_all, parallel=parallel)
  File "C:\Users\josep\Documents\GitHub\torchquantum\torchquantum\plugins\qiskit_processor.py", line 697, in process_ready_circs_get_counts
    results = p.map(run_job_worker, feed_dicts)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\multiprocess\pool.py", line 367, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\multiprocess\pool.py", line 774, in get
    raise self._value
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\multiprocess\pool.py", line 540, in _handle_tasks
    put(task)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\multiprocess\connection.py", line 214, in send
    self._send_bytes(_ForkingPickler.dumps(obj))
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\multiprocess\reduction.py", line 54, in dumps
    cls(buf, protocol, *args, **kwds).dump(obj)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 394, in dump
    StockPickler.dump(self, obj)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 487, in dump
    self.save(obj)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save
    StockPickler.save(self, obj, save_persistent_id)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save
    f(self, obj)  # Call unbound method with explicit self
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 902, in save_tuple
    save(element)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save
    StockPickler.save(self, obj, save_persistent_id)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save
    f(self, obj)  # Call unbound method with explicit self
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 887, in save_tuple
    save(element)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save
    StockPickler.save(self, obj, save_persistent_id)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save
    f(self, obj)  # Call unbound method with explicit self
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 887, in save_tuple
    save(element)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save
    StockPickler.save(self, obj, save_persistent_id)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save
    f(self, obj)  # Call unbound method with explicit self
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 887, in save_tuple
    save(element)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save
    StockPickler.save(self, obj, save_persistent_id)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save
    f(self, obj)  # Call unbound method with explicit self
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 932, in save_list
    self._batch_appends(obj)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 956, in _batch_appends
    save(x)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save
    StockPickler.save(self, obj, save_persistent_id)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save
    f(self, obj)  # Call unbound method with explicit self
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 1186, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 972, in save_dict
    self._batch_setitems(obj.items())
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 998, in _batch_setitems
    save(v)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save
    StockPickler.save(self, obj, save_persistent_id)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 603, in save
    self.save_reduce(obj=obj, *rv)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 717, in save_reduce
    save(state)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save
    StockPickler.save(self, obj, save_persistent_id)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save
    f(self, obj)  # Call unbound method with explicit self
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 1186, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 972, in save_dict
    self._batch_setitems(obj.items())
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 998, in _batch_setitems
    save(v)
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save
    StockPickler.save(self, obj, save_persistent_id)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 603, in save
    self.save_reduce(obj=obj, *rv)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 687, in save_reduce
  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save
    StockPickler.save(self, obj, save_persistent_id)
  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 578, in save
    rv = reduce(self.proto)
TypeError: cannot pickle '_abc._abc_data' object```
Hanrui-Wang commented 1 year ago

Found something when working through the MNIST example - the Qiskit part, specifically, runs into quite a large error.

From what I can deduce, it's a multiprocessing error as I can run the functions from the problem line by themselves. It's just the use of the map function that does it.


results = p.map(run_job_worker, feed_dicts)

in https://github.com/mit-han-lab/torchquantum/blob/main/torchquantum/plugins/qiskit_processor.py

Do you want me to raise this as a separate issue?

Full Trace is:



  File "c:\Users\josep\Documents\GitHub\torchquantum\examples\simple_mnist\mnist_example.py", line 257, in <module>

    main()

  File "c:\Users\josep\Documents\GitHub\torchquantum\examples\simple_mnist\mnist_example.py", line 231, in main

    valid_test(dataflow, "test", model, device, qiskit=True)

  File "c:\Users\josep\Documents\GitHub\torchquantum\examples\simple_mnist\mnist_example.py", line 134, in valid_test

    outputs = model(inputs, use_qiskit=qiskit)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl

    return forward_call(*args, **kwargs)

  File "c:\Users\josep\Documents\GitHub\torchquantum\examples\simple_mnist\mnist_example.py", line 95, in forward

    x0 = self.qiskit_processor.process_ready_circs(qdev, assembled_circs).to(  # type: ignore

  File "C:\Users\josep\Documents\GitHub\torchquantum\torchquantum\plugins\qiskit_processor.py", line 722, in process_ready_circs

    counts = self.process_ready_circs_get_counts(circs_all, parallel=parallel)

  File "C:\Users\josep\Documents\GitHub\torchquantum\torchquantum\plugins\qiskit_processor.py", line 697, in process_ready_circs_get_counts

    results = p.map(run_job_worker, feed_dicts)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\multiprocess\pool.py", line 367, in map

    return self._map_async(func, iterable, mapstar, chunksize).get()

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\multiprocess\pool.py", line 774, in get

    raise self._value

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\multiprocess\pool.py", line 540, in _handle_tasks

    put(task)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\multiprocess\connection.py", line 214, in send

    self._send_bytes(_ForkingPickler.dumps(obj))

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\multiprocess\reduction.py", line 54, in dumps

    cls(buf, protocol, *args, **kwds).dump(obj)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 394, in dump

    StockPickler.dump(self, obj)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 487, in dump

    self.save(obj)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save

    StockPickler.save(self, obj, save_persistent_id)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save

    f(self, obj)  # Call unbound method with explicit self

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 902, in save_tuple

    save(element)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save

    StockPickler.save(self, obj, save_persistent_id)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save

    f(self, obj)  # Call unbound method with explicit self

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 887, in save_tuple

    save(element)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save

    StockPickler.save(self, obj, save_persistent_id)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save

    f(self, obj)  # Call unbound method with explicit self

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 887, in save_tuple

    save(element)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save

    StockPickler.save(self, obj, save_persistent_id)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save

    f(self, obj)  # Call unbound method with explicit self

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 887, in save_tuple

    save(element)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save

    StockPickler.save(self, obj, save_persistent_id)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save

    f(self, obj)  # Call unbound method with explicit self

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 932, in save_list

    self._batch_appends(obj)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 956, in _batch_appends

    save(x)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save

    StockPickler.save(self, obj, save_persistent_id)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save

    f(self, obj)  # Call unbound method with explicit self

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 1186, in save_module_dict

    StockPickler.save_dict(pickler, obj)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 972, in save_dict

    self._batch_setitems(obj.items())

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 998, in _batch_setitems

    save(v)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save

    StockPickler.save(self, obj, save_persistent_id)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 603, in save

    self.save_reduce(obj=obj, *rv)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 717, in save_reduce

    save(state)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save

    StockPickler.save(self, obj, save_persistent_id)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 560, in save

    f(self, obj)  # Call unbound method with explicit self

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 1186, in save_module_dict

    StockPickler.save_dict(pickler, obj)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 972, in save_dict

    self._batch_setitems(obj.items())

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 998, in _batch_setitems

    save(v)

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save

    StockPickler.save(self, obj, save_persistent_id)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 603, in save

    self.save_reduce(obj=obj, *rv)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 687, in save_reduce

  File "C:\Users\josep\Documents\GitHub\torchquantum\.venv\lib\site-packages\dill\_dill.py", line 388, in save

    StockPickler.save(self, obj, save_persistent_id)

  File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\pickle.py", line 578, in save

    rv = reduce(self.proto)

TypeError: cannot pickle '_abc._abc_data' object```

I'm going to have a look at this, in the meanwhile could you try submitting job without multiprocessing?

denvitko commented 1 year ago

@Hanrui-Wang I have added docstrings to two files so far, could you please provide some feedback?

MihirsinhChauhan commented 1 year ago

I get this issue while making ipynote book for mnsit_example

don't able to resolve it. @Hanrui-Wang any suggestion upon how I move forward ` --------------------------------------------------------------------------- SystemExit Traceback (most recent call last) in <cell line: 1>() 1 if name == "main": ----> 2 main()

3 frames /usr/lib/python3.10/argparse.py in exit(self, status, message) 2591 if message: 2592 self._print_message(message, _sys.stderr) -> 2593 _sys.exit(status) 2594 2595 def error(self, message):

SystemExit: 2 `

Hanrui-Wang commented 1 year ago

@Hanrui-Wang I have added docstrings to two files so far, could you please provide some feedback?

Hi denvitko,

I have checked the docstrings, those are really good!

Hanrui-Wang commented 1 year ago

I get this issue while making ipynote book for mnsit_example

don't able to resolve it. @Hanrui-Wang any suggestion upon how I move forward ` --------------------------------------------------------------------------- SystemExit Traceback (most recent call last) in <cell line: 1>() 1 if name == "main": ----> 2 main()

3 frames /usr/lib/python3.10/argparse.py in exit(self, status, message) 2591 if message: 2592 self._print_message(message, _sys.stderr) -> 2593 _sys.exit(status) 2594 2595 def error(self, message):

SystemExit: 2 `

Hi MihirsinhChauhan,

Could you provide more information about which file you are running and the full error message?

hifi-hyp commented 1 year ago

When I run the colab notebook for quanvolution neural network trained on MNIST, this error arises.

Traceback (most recent call last):
  File "mnist_qcn_example.py", line 154, in <module>
    train(dataflow, model, device, optimizer)
  File "mnist_qcn_example.py", line 116, in train
    outputs = model(inputs)
  File "/home/yh351/miniconda3/envs/torch1/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "mnist_qcn_example.py", line 61, in forward
    x = self.qf(x, use_qiskit)
  File "/home/yh351/miniconda3/envs/torch1/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "mnist_qcn_example.py", line 42, in forward
    self.encoder(self.q_device, data)
  File "/home/yh351/miniconda3/envs/torch1/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/yh351/torchquantum/torchquantum/graph.py", line 25, in forward_register_graph
    res = f(*args, **kwargs)
  File "/home/yh351/torchquantum/torchquantum/encoding.py", line 66, in forward
    func_name_dict[info["func"]](
  File "/home/yh351/torchquantum/torchquantum/functional.py", line 1846, in ry
    gate_wrapper(
  File "/home/yh351/torchquantum/torchquantum/functional.py", line 326, in gate_wrapper
    q_device.states = apply_unitary_bmm(state, matrix, wires)
  File "/home/yh351/torchquantum/torchquantum/functional.py", line 202, in apply_unitary_bmm
    new_state = mat.bmm(permuted)
RuntimeError: Expected size for first two dimensions of batch2 tensor to be: [10, 2] but got: [1, 2].

It seems it is because the batch size of the quantum device is not set.

Hanrui-Wang commented 1 year ago

When I run the colab notebook for quanvolution neural network trained on MNIST, this error arises.

Traceback (most recent call last):
  File "mnist_qcn_example.py", line 154, in <module>
    train(dataflow, model, device, optimizer)
  File "mnist_qcn_example.py", line 116, in train
    outputs = model(inputs)
  File "/home/yh351/miniconda3/envs/torch1/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "mnist_qcn_example.py", line 61, in forward
    x = self.qf(x, use_qiskit)
  File "/home/yh351/miniconda3/envs/torch1/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "mnist_qcn_example.py", line 42, in forward
    self.encoder(self.q_device, data)
  File "/home/yh351/miniconda3/envs/torch1/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/yh351/torchquantum/torchquantum/graph.py", line 25, in forward_register_graph
    res = f(*args, **kwargs)
  File "/home/yh351/torchquantum/torchquantum/encoding.py", line 66, in forward
    func_name_dict[info["func"]](
  File "/home/yh351/torchquantum/torchquantum/functional.py", line 1846, in ry
    gate_wrapper(
  File "/home/yh351/torchquantum/torchquantum/functional.py", line 326, in gate_wrapper
    q_device.states = apply_unitary_bmm(state, matrix, wires)
  File "/home/yh351/torchquantum/torchquantum/functional.py", line 202, in apply_unitary_bmm
    new_state = mat.bmm(permuted)
RuntimeError: Expected size for first two dimensions of batch2 tensor to be: [10, 2] but got: [1, 2].

It seems it is because the batch size of the quantum device is not set.

Hi hifi-hyp,

Yes, please set the batch size of quantum device either using: qdev = tq.QuantumDevice(n_wires=4, bsz=10) or qdev.reset_states(bsz=10)

Hanrui-Wang commented 1 year ago

Hi Unitary hackers,

For this issue, right now we have two contributors with valid pull request: @MihirsinhChauhan on #141 and @denvitko on #143. Both are valid. I will work on merging them to the unitary_hack branch.

If other hackers are still working on this issue please make sure to submit a pull request before the deadline June 13 AOE. Thank you!

nathanshammah commented 1 year ago

Congrats @denvitko and @MihirsinhChauhan!

denvitko commented 1 year ago

Hi Unitary hackers,

For this issue, right now we have two contributors with valid pull request: @MihirsinhChauhan on #141 and @denvitko on #143. Both are valid. I will work on merging them to the unitary_hack branch.

If other hackers are still working on this issue please make sure to submit a pull request before the deadline June 13 AOE. Thank you!

Thank you @Hanrui-Wang! I didn't notice that you have already merged the pull request (because I created it as a draft 😀) and I have added some more documentation comments today. I will open another pull request soon then.

MihirsinhChauhan commented 1 year ago

I get this issue while making ipynote book for mnsit_example don't able to resolve it. @Hanrui-Wang any suggestion upon how I move forward --------------------------------------------------------------------------- SystemExit Traceback (most recent call last) in <cell line: 1>() 1 if **name** == "**main**": ----> 2 main() 3 frames [/usr/lib/python3.10/argparse.py](https://localhost:8080/#) in exit(self, status, message) 2591 if message: 2592 self._print_message(message, _sys.stderr) -> 2593 _sys.exit(status) 2594 2595 def error(self, message): SystemExit: 2

Hi MihirsinhChauhan,

Could you provide more information about which file you are running and the full error message?

I have runned this eample examples/simple_mnist/mnist_example.py. full traceback is

SystemExit Traceback (most recent call last) in <cell line: 1>() 1 if name == "main": ----> 2 main()

3 frames in main() 12 ) 13 ---> 14 args = parser.parse_args() 15 16 if args.pdb:

/usr/lib/python3.10/argparse.py in parseargs(self, args, namespace) 1846 if argv: 1847 msg = ('unrecognized arguments: %s') -> 1848 self.error(msg % ' '.join(argv)) 1849 return args 1850

/usr/lib/python3.10/argparse.py in error(self, message) 2604 self.print_usage(sys.stderr) 2605 args = {'prog': self.prog, 'message': message} -> 2606 self.exit(2, ('%(prog)s: error: %(message)s\n') % args)

/usr/lib/python3.10/argparse.py in exit(self, status, message) 2591 if message: 2592 self._print_message(message, _sys.stderr) -> 2593 _sys.exit(status) 2594 2595 def error(self, message):

SystemExit: 2

Hanrui-Wang commented 1 year ago

Congrats @josephtedds @denvitko and @MihirsinhChauhan for merging the pull requests! Since the UnitaryHack comes to the end, I will close this issue. For the problems encountered by @josephtedds , I will solve that in the new issue #158 ; for that of @MihirsinhChauhan , will solver that in new issue #157 . We will very appreciate if you can continue to contribute to new functionalities to torchquantum. Thank you all for the contributions!

josephtedds commented 1 year ago

For Unitary Hack accounting, I've unassigned myself - but not to say that I'm not working on / thinking about the tutorial