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:
Ensure Kaiwu-PyTorch-Plugin is installed:
pip install .Make sure the environment is active:
conda activate quantum_envVerify 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:
Visit the
Kaiwu SDK download page <https://platform.qboson.com/sdkDownload>_Download the package for your OS
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:
Tune learning rate: try smaller (e.g. 0.001) or larger (e.g. 0.1) values
Increase weight decay: add L2 regularization to reduce over-fitting
Check preprocessing: ensure data are normalized to an appropriate range
Increase epochs: some problems simply need longer training
Sampling Related#
Q: How can I obtain access to real quantum hardware?#
A: Follow these steps:
Register an account on the
QBoson platform <https://platform.qboson.com/>_Contact platform staff
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 convergencesize_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:
Larger batch size: increase
batch_sizewithin GPU memory limitsFewer sampling steps: reduce sampling overhead (e.g. tune
alphaofSimulatedAnnealingOptimizer)
Q: Out of GPU memory?#
A: Try the following:
Decrease
batch_sizeReduce number of hidden units
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:
GitHub Issues: open an issue
Developer community: QBoson Quantum Developer Community
Email: developer@boseq.com