FAQ#

This chapter collects common issues and solutions when using Kaiwu-PyTorch-Plugin.

Installation#

Q: Installation fails with an incompatible Python version error?#

A: Kaiwu-PyTorch-Plugin currently supports Python 3.10 only. Create an environment with conda:

 conda create -n quantum_env python=3.10
 conda activate quantum_env

Q: Cannot import the kaiwu.torch_plugin module?#

A: Please check the following:

  1. Ensure Kaiwu-PyTorch-Plugin is installed: pip install .

  2. Make sure the environment is active: conda activate quantum_env

  3. Verify that Kaiwu SDK is correctly installed

If the issue persists, reinstall:

 pip uninstall kaiwu-torch-plugin
 pip install .

Q: Kaiwu SDK installation fails?#

A: Kaiwu SDK must be installed separately. Please:

  1. Visit the Kaiwu SDK download page <https://platform.qboson.com/sdkDownload>_

  2. Download the package for your OS

  3. Follow the on-page instructions

Model Related#

Q: What is the difference between RBM and BM? Which one should I use?#

A: Key differences are listed below:

Feature

RBM (Restricted Boltzmann Machine)

BM (Fully-connected Boltzmann Machine)

Connectivity

No intra-layer connections

Fully connected

Recommended use-case

Simple scenarios

Generation tasks or when modeling complex dependencies

Q: How do I choose the number of hidden units?#

A: It depends on:

  • Data complexity: more complex data needs more hidden units

  • Compute budget: more units imply higher cost

Q: Training loss does not decrease?#

A: Try the following:

  1. Tune learning rate: try smaller (e.g. 0.001) or larger (e.g. 0.1) values

  2. Increase weight decay: add L2 regularization to reduce over-fitting

  3. Check preprocessing: ensure data are normalized to an appropriate range

  4. Increase epochs: some problems simply need longer training

Sampling Related#

Q: How can I obtain access to real quantum hardware?#

A: Follow these steps:

  1. Register an account on the QBoson platform <https://platform.qboson.com/>_

  2. Contact platform staff

  3. Email: developer@boseq.com

Before real-chip access is granted, use the simulated-annealing optimizer for development and testing.

Q: How should I tune the simulated-annealing sampler?#

A: Parameters of SimulatedAnnealingOptimizer:

  • alpha: annealing coefficient (0.9–0.999); closer to 1 gives slower but better convergence

  • size_limit: number of samples returned per call

 from kaiwu.classical import SimulatedAnnealingOptimizer

 # Fast sampling (lower quality)
 sampler = SimulatedAnnealingOptimizer(alpha=0.9, size_limit=5)

 # High-quality sampling (slower)
 sampler = SimulatedAnnealingOptimizer(alpha=0.995, size_limit=100)

Performance#

Q: How can I speed up training?#

A: Possible accelerations:

  1. Larger batch size: increase batch_size within GPU memory limits

  2. Fewer sampling steps: reduce sampling overhead (e.g. tune alpha of SimulatedAnnealingOptimizer)

Q: Out of GPU memory?#

A: Try the following:

  1. Decrease batch_size

  2. Reduce number of hidden units

  3. Use gradient accumulation

Miscellaneous#

Q: How should I cite this project?#

A: Please use the following BibTeX entry:

 @software{KaiwuPyTorchPlugin,
     title = {Kaiwu-PyTorch-Plugin},
     author = {{QBoson Inc.}},
     year = {2024},
     url = {https://github.com/QBoson/Kaiwu-pytorch-plugin}
 }

Q: Where can I get more help?#

A: You can reach us via:

  1. GitHub Issues: open an issue

  2. Developer community: QBoson Quantum Developer Community

  3. Email: developer@boseq.com