UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor ap-nsg
Visitor
2,249 Views
Registered: ‎08-07-2018

Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Hello,

I recently launched the AWS Xilinx ML Suite (f1.2xlarge) and tried the entire cycle as described in your webminar demo with bvlc_googlenet using the tensorflow framework. I succeeded with the loading of the tensorflow docker container as well as the compiler stage but I couldn't find the tools/script for the tensorflow quantize. (for example your webminar demo includes the file classify_pb.py)

Nevertheless, I couldn't find detailed documentation for a quantize stage of a tensforflow graph. It is very much different from other frameworks.

Am I missing something? 

Thanks!

0 Kudos
14 Replies
Xilinx Employee
Xilinx Employee
2,201 Views
Registered: ‎06-07-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Visitor ap-nsg
Visitor
2,191 Views
Registered: ‎08-07-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Hi,

Thanks for the quick response, however I tried the quantize.pyc with your googlenet tensorflow .pb model (bvlc_googlenet_without_lrn_test.pb) and and its asks for a caffe module:

 

Traceback (most recent call last):
File "./xfdnn/tools/quantize/quantize.py", line 43, in <module>
File "./xfdnn/tools/quantize/quantize_caffe.py", line 29, in <module>
ImportError: No module named caffe

 

I am trying to test the entire cycle from compile through quantize to deployment with goooglenetv1 but the quantize phase doesn't work and the documentation is not clear, it is geared toward caffe.

Can you give the short script for running the quantize within your tensorflow docker container and googlenetv1.

I have tried all kind of options with quantize.pyc as well as quantize_tf.pyc and it doesn't seams to work!

Thanks  

0 Kudos
Xilinx Employee
Xilinx Employee
2,176 Views
Registered: ‎06-07-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Hi ap-nsg,

My fault. Please use quantize_tf.pyc on https://github.com/Xilinx/ml-suite/tree/master/xfdnn/tools/quantize.

"_tf" stands for Tensorflow.

All available docs is here https://github.com/Xilinx/ml-suite/tree/master/docs

0 Kudos
Visitor ap-nsg
Visitor
2,162 Views
Registered: ‎08-07-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Hi jishuaiz,

Thanks again for your quick response. However, it looks like that something is missing for the tensorflow quantize stage.

Again, I am following the instruction on the Quantization tutorial using your GooglenetV1 example but with tensorflow:

1. I am connecting to F1

2. navigating to the tensorflow docker

3. starting the docker successfuly

4. exporting the root in the enviorment

5. navigating to the quantize directory

6. running the quantize_tf.pyc with a "bvlc_googlenet.pb" model (be aware its a .pb file) and all type of arguments.

the python code does nothing. I have tried different arguments ...

BTW, as said in the original message, The compile part of the example with tensorflow was successful. However the quantize! .

Can somebody test your quantize example with GooglenetV1 and post the few line script and instructions.

Again, I am trying to test the xfdnn through all stages up to deployment with tensorflow and googlenetv1 example.

Thanks

 

 

0 Kudos
Xilinx Employee
Xilinx Employee
2,120 Views
Registered: ‎06-07-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Hi ap-nsg

Thanks. I will contact the developer and back to you later.

0 Kudos
1,883 Views
Registered: ‎09-25-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Any updates on this issue? quantize_tf.pyc does nothing when I run it on local linux machine.

 

Thanks

0 Kudos
Contributor
Contributor
1,652 Views
Registered: ‎11-08-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

quantize_tf.pyc does nothing when I run it with command as follows

python quantize_tf.py --model_file ../../../models/tensorflow/resnet/fp32/resnet50_without_bn_test.pb --quantize_config quantize.json --cal_dir calibration_directory/ --cal_size 1 --bitwidths 8,8,8

0 Kudos
Xilinx Employee
Xilinx Employee
1,599 Views
Registered: ‎06-07-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Hi Weizhong, Durga,

There is update for tensorflow flow. Please follow this linker , https://github.com/Xilinx/ml-suite/blob/v1.2/notebooks/image_classification_tensorflow.ipynb . 

Visitor eensafi
Visitor
938 Views
Registered: ‎04-10-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

I am using the latest ML Suite v1.3 from GitHub.  Like the original post, it is still unclear whether we should be running quantize.pyc or quantize_tf.pyc.  Each fails in a different way:

1. quantize.pyc - Some parameter is "None" but I cannot figure out what to specify on the command-line to make it happy.  I have tried the following with --calibration_directory and many other command-line options, and the error is always the same:

python /opt/xilinx/ml-suite/xfdnn/tools/quantize/quantize.pyc --deploy_model model_tf.pb --output_json output.json

Traceback (most recent call last):
File "./xfdnn/tools/quantize/quantize.py", line 219, in <module>
File "/home/eensafi/.conda/envs/ml-suite/lib/python2.7/genericpath.py", line 37, in isfile
st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found

2. quantize_tf.pyc - Does not work due to a package import error, even in the simplest case:

python /opt/xilinx/ml-suite/xfdnn/tools/quantize/quantize_tf.pyc --help

Traceback (most recent call last):
File "./xfdnn/tools/quantize/quantize_tf.py", line 22, in <module>
ValueError: Attempted relative import in non-package

 

0 Kudos
Contributor
Contributor
926 Views
Registered: ‎11-08-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

I am using the latest ML Suite v1.3 from GitHub.

I have a problem with qunatize_tf.pyc, not able to run on command line, where as able to run in notebook.

 

regards,

V Durga.

0 Kudos
Visitor eensafi
Visitor
915 Views
Registered: ‎04-10-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Durga: I am assuming that in a notebook, you are calling the Python API, which is different from trying to run quantize_tf.pyc at the command-line as a __main__  script.

There is also quantize_caffe.pyc, which does nothing if executed on its own, but it does not suffer from the same package import error as quantize_tf.pyc.  This led me to believe that the correct top-level driver is quantize.pyc, which will then invoke the "tf" or "caffe" version depending on the input file types.  Is this a correct assessment?  If so, we go back to the first error related to a parameter being "None" and not knowing how to fix it.

0 Kudos
Visitor mahinlman
Visitor
686 Views
Registered: ‎07-16-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Hello,

Updated the quantization script for Tensorflow - ml-suite_Tensorflow_Quantization

Follow this doc for using quantize.pyc 

If you facing any issues/errors, then please let me know.

Thanks,

Mahi

0 Kudos
Visitor eensafi
Visitor
683 Views
Registered: ‎04-10-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Thank you for your reply.  I finally got the quantizer to run using the Python API, not the standalone script, but it does not produce correct results.  Apparently, the ML Suite TensorFlow quantizer is broken.  Does the updated script address the quantization bugs or just the execution issues?

0 Kudos
Visitor mahinlman
Visitor
670 Views
Registered: ‎07-16-2018

Re: Tensorflow quantize - missing scripts/tools/documentation AWS Xilinx ML Suite (f1.2xlarge)

Actually, quantize.pyc in ml-suite only has caffe related initialization scripts.
Now I have updated quantize.pyc with Tensorflow quantize script. with that I'm able to get quantization results.
Today only, I have pull request to ml-suite.


0 Kudos