XanaduAI / quantum-neural-networks

This repository contains the source code used to produce the results presented in the paper "Continuous-variable quantum neural networks". Due to subsequent interface upgrades, these scripts will work only with Strawberry Fields version <= 0.10.0.
https://arxiv.org/abs/1806.06871
Apache License 2.0
297 stars 86 forks source link

Error running the fraud_detection.py file #5

Closed sidsidsidsid closed 4 years ago

sidsidsidsid commented 4 years ago

There is a similar codebase located in the below GIT link. People are leaving issues and someone mentioned the code was "leverage/stolen." Is this repo the correct location to ask questions and/or issues for the codebase? Should people move/copy their issues to this location? Any clarification would be appreciated? Thanks.

**similar codebase location: https://github.com/llSourcell/The-Neural-Qubit/issues

josh146 commented 4 years ago

Hi @sidsidsidsid, this is the correct place to ask questions regarding the quantum neural network fraud detection code. The code in this repository is used to generate the results shown in our paper "Continuous-variable quantum neural networks".

sidsidsidsid commented 4 years ago

Ok thanks.

I'm getting an error when running the fraud_detection.py file

**Env****:

  1. Colab
  2. !pip install strawberryfields==0.10.0 tensorflow==1.6.0

**** ERROR***** Traceback (most recent call last): File "fraud_detection.py", line 194, in prog = sf.Program(mode_number) AttributeError: module 'strawberryfields' has no attribute 'Program'

co9olguy commented 4 years ago

Hi @sidsidsidsid, you'll have to update to the latest version of Strawberry Fields (0.11). The current state of this repo has recently been updated to be compatible with that version (unfortunately, not backwards-compatible)

co9olguy commented 4 years ago

Note that you'll have to make sure your environment is also compatible with tensorflow 1.3

sidsidsidsid commented 4 years ago

The settings changes worked. thanks.

Another issue. Colab times-out before the training is completed. Sometimes it goes beyond 13 hours. So I reduce the below "reps", tb_reps", and savr_reps" variables.

Has anybody ever attempted to run the code on Colab? Is there something I'm doing wrong?

*ENV:*** Colab !pip install strawberryfields==0.11.0 tensorflow==1.3.0 set to GPU

*VARIABLE CHANGED*** reps = 1000 ##############################30000 tb_reps = 10 ######################################100 savr_reps = 100 ##################################1000

****ERROR*** 2019-10-03 17:34:35.174945: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2019-10-03 17:34:35.175022: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2019-10-03 17:34:35.175051: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2019-10-03 17:34:35.175068: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2019-10-03 17:34:35.175078: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.

co9olguy commented 4 years ago

@trbromley any advice here?

trbromley commented 4 years ago

Hey @sidsidsidsid, it definitely takes a bit of compute power for training - to put into context we trained for a few hours running on 20 cores + 2 GPUs.

You'll probably want at least 10,000+ for the reps value to get a decent quality of training. The best way to see how training is progressing is to view on TensorBoard.

The tb_reps and savr_reps are how often the code outputs to TensorBoard and how often it saves the model. Making these values too small will slow things down because more time will be spent outputting rather than in training.

We've never run the script on Colab, so you'd have to get into contact with them for support. One question, the errors you give - are you sure that they are not just warnings and that the code is still running?

co9olguy commented 4 years ago

@trbromley those errors are common from that version of TensorFlow. No cause for concern that the model is not training

sudoankit commented 4 years ago

@sidsidsidsid Those are just warnings as explained in this comment at the official tensorflow repo.