Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QC-AAN #8

Merged
merged 7 commits into from
Feb 26, 2021
Merged

QC-AAN #8

merged 7 commits into from
Feb 26, 2021

Conversation

TDHTTTT
Copy link
Contributor

@TDHTTTT TDHTTTT commented Feb 26, 2021

Now the CaloGAN is able to sample from the QCBM.
Assumption:

  • the weight for QCBM doesn't change for 1 epoch of the GAN training
  • we can sample from a QCBM with the same weight multiple times efficiently

Next need to train QCBM from the discriminator.

@TDHTTTT TDHTTTT requested a review from jcwang111 February 26, 2021 00:42
@TDHTTTT
Copy link
Contributor Author

TDHTTTT commented Feb 26, 2021

To quickly run the script with minimal epochs/samples:

python3 train.py --nb-epochs 2 --latent-size 8 --nb-samples 1000 --qcbm-nb-shots 100 --nb-qubits 8 ./particles.yaml

Copy link
Contributor Author

@TDHTTTT TDHTTTT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please let me know if it makes sense

# generate a new batch of noise
noise = np.random.normal(0, 1, (batch_size, latent_size))
# sample from QCBM
if nb_qubits > 0:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mainly this part
where it samples from QCBM

@TDHTTTT
Copy link
Contributor Author

TDHTTTT commented Feb 26, 2021

Also, it addresses the first half of #6

@@ -512,3 +531,8 @@ def _load_data(particle, datafile):

discriminator.save_weights('./weights/{0}{1:03d}.hdf5'.format(parse_args.d_pfx, epoch),
overwrite=True)

dis_weights_f = h5py.File('./weights/{0}{1:03d}.hdf5'.format(parse_args.d_pfx, epoch), 'r')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I basically read the weight from that layer and passed it to QCBM

@@ -295,7 +297,9 @@ def _load_data(particle, datafile):
mbd_energy
])

fake = Dense(1, activation='sigmoid', name='fakereal_output')(p)
qcbm_w = Dense(2**nb_qubits, activation='linear', name='qcbm')(p)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added another layer to align our QCBM dimenstion

@TDHTTTT TDHTTTT merged commit ff7fe73 into main Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant