QTensorAI
A hybrid quantum-classical neural network simulation platform. Quantum simulation uses QTensor, a state-of-the-art tensor network-based simulator that usually has linear complexity in the number of qubits for shallow circuits, instead of exponential complexity. This opens up the possibility to simulate large hybrid models with many qubits. The hybrid model is a PyTorch model, batch-parallelized, GPU compatible and fully differentiable.
Install / Use
/learn @sss441803/QTensorAIREADME
QTensorAI
A hybrid quantum-classical neural network simulation platform. Quantum simulation uses QTensor, a state-of-the-art tensor network-based simulator that usually has linear complexity in the number of qubits for shallow circuits, instead of exponential complexity. This opens up the possibility to simulate large hybrid models with many qubits. The hybrid model is a PyTorch model, batch-parallelized, GPU compatible and fully differentiable.
We demonstrate examples of how to use our code in \examples. A Jupyter notebook Example.ipynb shows the CPU usage. The script cuda.py shows the GPU usage. The script cuda_graph.py shows how to most efficiently use the GPU resource by tracing the graph, achieving a 35% speed up. When reading these files in the example folder, the comments are cut down to those that are relevant to your usage of our library without extraneous details.
This librar is based on QTensor at https://github.com/danlkv/QTensor.git, which is built on qtree at https://github.com/Huawei-HiQ/qtree.git. However, these libraries have heavy dependencies, and we restructured the code base and removed unnecessary components to create a minimal implementation that is functional.
Installation
Creat your pytorch environment with conda first:
conda create --name qtensor_ai pytorch cudatoolkit=11.3 -c pytorch
If you wish to run qtensor_ai on cpu only, then you do not have to include cudatoolkit in the installation command. Make sure you choose CUDA version 11 and above if you wish to use CUDAGraph acceleration. Otherwise, CUDA 10 is tested to work as well. Clone the repository QTensorAI:
git clone https://github.com/sss441803/QTensorAI.git
Install the qtensor_ai library:
cd QTensorAI
python setup.py install
Then, install the Tamaki optimizer. This is optional but recommended. If you do not install it, you will need to remove it's import from the script. More details for installation can be found at https://github.com/danlkv/QTensor.git.
> cd qtensor_ai/qtensor/qtree/thirdparty/tamaki_treewidth
> make heuristic
javac tw/heuristic/*.java
If javac is not already available, install openjdk with conda:
conda install -c anaconda openjdk
Finally, add the directory QTensorAI/qtensor_ai/qtensor/qtree/thirdparty/tamaki_treewidth to $PATH.
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
