VGON Environment Setup
VGON scripts here require Python version 3.11 and above.
This guide provides instructions for setting up the VGON (Variational Generative Optimization Network) environment using either uv or pip.
Prerequisites
- Python 3.11 or higher
- Git
Method 1: Using uv (Recommended)
uv is a fast Python package manager and project manager, whose installation is simple as guide
Setup with uv
-
Clone the repository to local disk.
git clone https://github.com/zhangjianjianzz/VGON.git && cd VGON
-
Create virtual environment if it wasn't contained
uv venv .venv
The python virtual environment will be located at
.venvfold under root path in default. Linux/macOS users could activate it in shell by typingsource .venv/bin/activate
-
Install dependecies in
.venvfor VGON scriptsuv sync --extra full
plotandnotebookgroups are optional for VGON itself. -
Running experiments with uv
# Run specific experiments uv run python BP/HXXZ/vgon_xxz.py uv run python Gap/Mix.py uv run python Degeneracy/H232/H232.py # Or activate environment first source .venv/bin/activate python BP/HXXZ/plot.py
Method 2: Using pip
Setup with pip
# Clone the repository
git clone <your-repo-url>
cd VGON
# Create virtual environment
python -m venv venv
# Activate virtual environment
source venv/bin/activate # On Linux/macOS
# or
venv\Scripts\activate # On Windows
# Upgrade pip
pip install --upgrade pip
# Install PyTorch (CPU version)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# For GPU support (CUDA 12.1), use instead:
# pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
# Install the package with dependencies
pip install -e .
# Install optional dependencies
pip install -e ".[plot]" # For plotting
pip install -e ".[dev]" # For development
pip install -e ".[gpu]" # For GPU acceleration
pip install -e ".[all]" # Install everything
# Manual installation of ptitprince (if needed)
pip install git+https://github.com/pog87/PtitPrince.git
Verify Installation
Test your installation by running a simple example:
import torch
import pennylane as qml
import numpy as np
# Test basic functionality
print(f"PyTorch version: {torch.__version__}")
print(f"PennyLane version: {qml.__version__}")
print(f"CUDA available: {torch.cuda.is_available()}")
# Test quantum device
dev = qml.device("default.qubit", wires=2)
print("✓ PennyLane quantum device created successfully")
Project Structure
VGON/
├── BP/ # Barren Plateau experiments
│ ├── HXXZ/ # Heisenberg XXZ model
│ └── Z1Z2/ # Z1Z2 model
├── Degeneracy/ # Degeneracy detection experiments
│ ├── H232/ # H232 Hamiltonian
│ └── MG/ # Graph states
├── Gap/ # Nonlocality gap experiments
└── results/ # Experimental results
Running Experiments
Barren Plateau Experiments
# HXXZ model
python BP/HXXZ/vgon_xxz.py # Run VGON training
python BP/HXXZ/vqe_xxz.py # Run VQE baseline
python BP/HXXZ/plot.py # Generate plots
# Z1Z2 model
python BP/Z1Z2/vgon_z1z2.py
python BP/Z1Z2/vqe_z1z2.py
python BP/Z1Z2/plot.py
Degeneracy Detection
# H232 Hamiltonian
python Degeneracy/H232/H232.py
python Degeneracy/H232/plot.py
# Graph states
python Degeneracy/MG/MG.py
python Degeneracy/MG/plot.py
Nonlocality Gap
python Gap/Mix.py # Train gap model
matlab -batch "run('Gap/plotGap.m')" # Generate MATLAB plots
Troubleshooting
Common Issues
- CUDA not found: If you have a GPU but CUDA is not detected, reinstall PyTorch with CUDA support
- PennyLane device errors: Ensure you have the correct PennyLane plugins installed
- Memory issues: Reduce batch sizes in the configuration files
- Import errors: Make sure all dependencies are installed correctly
GPU Setup
For GPU acceleration:
Development Setup
For contributors:
Support
- Paper: Commun Phys 8, 334 (2025)
- Issues: Create an issue on the GitHub repository
- Documentation: See individual module docstrings and comments
Development Containers
DevContainers' configuration in vscode/GitHub Codespace.
Metadata
Release files for vgon 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vgon-0.0.6.tar.gz | 13.3 kB | With provenance | Details for vgon-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vgon-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for vgon-0.0.6-py3-none-any.whl |
Total release size: 20.9 kB
Release files / vgon-0.0.6.tar.gz
| Download URL | vgon-0.0.6.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f75559fd2f7dc48899dfadf0ba4436a29adbf0ad174711eea777fb67f04bf73
|
|
BLAKE2b-256 checksum How to use checksums |
f01fd2b3f688921162d405e9d670086d555214f0dbdca3b99fef93745c5f358b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 13, 2026.
Transparency logRelease files / vgon-0.0.6-py3-none-any.whl
| Download URL | vgon-0.0.6-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d57804ae178a5954836ccfde633617449de6e6144ef0f19083c824fa41a26a6
|
|
BLAKE2b-256 checksum How to use checksums |
fac6ec4abfe18bce56d19d3fafbad28681f4165ce1a50df3d25457ceff53c63f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 13, 2026.
Transparency logSecurity for vgon 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for vgon-0.0.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.