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: 
Highlighted
Contributor
Contributor
1,427 Views
Registered: ‎03-24-2018

Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

Hi,

I downloaded and extracted the newest models from xilinx into /ml-suite directory.

I got the same issues like below:

Capture271.PNG

And I also tried on other machine ( ubuntu16.4 ) and it got the same issues.

Could you please advise me on this ?

Regards,

Long.

0 Kudos
1 Solution

Accepted Solutions
Contributor
Contributor
1,295 Views
Registered: ‎11-08-2018

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

Hi @duclong,

The issue regarding compilation of tensorflow in jupyter, may got fix in coming updates of ml suite. But you can get quantized output for tensorflow models, using jupyter notebook.

In addition to the tensorflow compilation step, I would like to add  one more parameter to get generated weights for the tensorflow models.

$ cd /ml-suite/xfdnn/tools/compile/bin

$ python xfdnn_compiler_tensorflow.pyc -n ../../../../models/tensorflow/resnet/fp32/resnet50_without_bn_test.pb -s all -m 4 -i 28 -d 0 -g fpga.cmd -w

Accept this as solution for command line compilation of tensorflow models.

Regards,

V Durga Bhavani.

 

0 Kudos
10 Replies
Contributor
Contributor
1,403 Views
Registered: ‎11-08-2018

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

Try the following:

1. create work directory in /ml-suite/xfdnn/tools/compile/bin directory

2. go to /ml-suite/xfdnn/tools/compile/bin directory

3. $ python xfdnn_compiler_tensorflow.pyc -n ../../../../models/tensorflow/resnet/fp32/resnet50_without_bn_test.pb -s all -m 4 -i 28 -d 0 -g work/fpga.cmd

Then you will get output in /ml-suite/xfdnn/tools/compile/bin/work directory as follows:

-> fpga.cmd

-> fpga.cmd.json

0 Kudos
Contributor
Contributor
1,392 Views
Registered: ‎03-24-2018

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

Hi @durga_bhavani,

Thank you for your reply.

But in this case, I'm using jupyter notebook. So your answer cannot fix this issue.

And I also try to run the command line that you provided to me. And get the error like below: ( I'm using the newest version of ML-suite : v1.2 )

Capture.PNG

Regards,

Long.

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

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

Hi @duclong,

Actually, in this /ml-suite/xfdnn/tools/compile/bin directory xfdnn_compiler_tensorflow.py fileis not present, to get the file do the following:

1. install uncompiler for .pyc file using https://github.com/wibiti/uncompyle2

2.  $ cd /ml-suite/xfdnn/tools/compile/bin

3. $ uncompyle xfdnn_compiler_tensorflow.pyc

4. copy the text and save in same folder as xfdnn_compiler_tensorflow.py

Now try performing compiling step

Regards,

Durga.

0 Kudos
Contributor
Contributor
1,371 Views
Registered: ‎03-24-2018

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

Hi @durga_bhavani,

I tried and follow your instruction. And I still got other issue. It seems you already uncompressed other *.pyc file. Not only xfdnn_compiler_tensorflow.pyc

So please advise me on this.

Capture.PNG

Regards,

Long.

0 Kudos
Adventurer
Adventurer
1,366 Views
Registered: ‎03-21-2010

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

Hi, all

  I encountered this problem. Hope Xilinx RD fixed this issue soon.

B/R

0 Kudos
Adventurer
Adventurer
1,360 Views
Registered: ‎03-21-2010

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

I noticed the image_classification_tensorflow.ipynb had been updated 6 hours ago. But the error appeared at the same place:

Seems on everyone encountered this problem.

xsct_error_under_centos7.jpg

0 Kudos
Adventurer
Adventurer
1,340 Views
Registered: ‎03-21-2010

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

hi, 

After update whole ml-suite, the image_classification_tensorflow.ipynb had different error message:

Compiler failed to generate the JSON or data directory: work/bvlc_googlenet_without_lrn_test.pb_data
Failed to complete compilation: exceptions must be old-style classes or derived from BaseException, not NoneType

xsct_error_under_centos7.jpg

xsct_error_under_centos7.jpg

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

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

Hi @duclong,

export XFDNN_ROOT=/ml-suite/xfdnn

install tensor tools:

$ git clone https://github.com/ahwillia/tensortools.git

$ cd tensortools

$ python setup.py install

$ python setup.py test

Now try performing compiling step

Regards,

Durga.

0 Kudos
Contributor
Contributor
1,309 Views
Registered: ‎03-24-2018

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

Hi @durga_bhavani,

Thank you for your instruction. The issue to compile tensor flow network is fixed. But what is about on Jupyter notebook ?

I would like to summary what I did like below for other people who can work via command line.

~$ cd /ml-suite

~$ source ./overlaybins/setup.sh 1525

~$ git clone https://github.com/wibiti/uncompyle2.git

~$ cd uncompyle2

~$ python setup.py install

~$ cd /ml-suite 

~$ git clone https://github.com/ahwillia/tensortools.git
~$  cd tensortools

~$ python setup.py install

~$ python setup.py test

~$ cd /ml-suite/xfdnn/tools/compile/bin

~$  uncompyle2 xfdnn_compiler_tensorflow.pyc > xfdnn_compiler_tensorflow.py

~$  python xfdnn_compiler_tensorflow.pyc -n ../../../../models/tensorflow/resnet/fp32/resnet50_without_bn_test.pb -s all -m 4 -i 28 -d 0 -g ../../../../notebooks/work/fpga.cmd

 

And we will got the output like below:

**************************************************
* XFDNN TENSORFLOW Compilation - Xilinx Inc.
**************************************************
Namespace(anew=None, approximate=False, barrier=False, bridges=False, bytesperpixels=2, concatstrategy=None, conv_1x1_s2=False, cpulayermustgo=False, ddr=0, dedicateddsp=None, dsp=28, finalnode=None, fromtensorflow=True, generatefile='../../../../notebooks/work/fpga.cmd', godreplication=None, lasttensorbyname=None, manasadebugmode=False, manualbatch=False, manualdeconv=False, memory=4.0, networkfile='../../../../models/tensorflow/resnet/fp32/resnet50_without_bn_test.pb', nodynamicscaling=False, noreplication=False, parallelism=False, parallelismstrategy="['bottom', 'tops']", parallelread=None, pipelineconvmaxpool=False, placeholdershape=None, pngfile=None, poolingaround=False, rankdir='BT', schedulefile=None, strategy='all', verbose=False, versionjson=None, weights=False)
Network: ../../../../models/tensorflow/resnet/fp32/resnet50_without_bn_test.pb
GenerateCode: ../../../../notebooks/work/fpga.cmd
Weights: False
PngFile: None
ConcatStrategy: None
Strategy: all
ScheduleFile: None
DDR: 0
DSP: 28
DSP V2
Verbose: False
FromTF: True
Memory: 4.0

**************************************************
* HARDWARE
**************************************************

##########
One Slice, One Vision presents:
DDR NONE
==========
DSP pinky
         self.slice               0
         self.rule                rule2
         self.dsp                 28
         self.bytesperpixels      2
         self.precision           16
         self.column              16
         self.minimum_replication 16
-------
AM for pinky
         self.alignment         28
         self.FREE              {(0, 4194304): MemoryAllocation(start=0, end=4194304, size=4194304, extra=[], strategy=[], layout=-1, timestamp=-1, slice=0, shapes=None, replication=Replication(full_sect_num=0, repl_sect_num=0, repl_unit_num=0, repl_unit_width=0, channels_division=0), written=False)}
         self.size              4194304
         self.timestamp         0
         self.slice             0
         self.bytesperpixels    2
         self.strategies_       ['bysize', 'bottom', 'top', 'tops', 'bottle', 'bottles', 'xXx', 'shuffle', 'flip']
         self.rules              rule2
         self.replications       [48, 32]
         self.channels_per_banks 8
['XNAvgPool', 'id XNOp name kernel_w kernel_h  strides_w strides_h paddings_w paddings_h fcmode inaddr insize_w insize_h inchan outaddr outsize_w outsize_h Bypass_Perf_Opt ']
=['XNGather', 'id XNOp uram_dest ddr_src input_w input_h input_chan a0 b1 c1 start_row end_row ']
=['XNDeconv', 'id XNOp name kernel_w kernel_h strides_w strides_h padding_w padding_h dilation_w dilation_h preshift scale postshift relu bias inaddr insize_w insize_h inchan outaddr outsize_w outsize_h  outchan Bypass_Perf_Opt ']
=['XNMaxPool', 'id XNOp name kernel_w kernel_h  strides_w strides_h paddings_w paddings_h  inaddr insize_w insize_h inchan outaddr outsize_w outsize_h Bypass_Perf_Opt ']
=['XNScatter', 'id XNOp uram_src ddr_dest input_w input_h input_chan a0 b1 c1 start_row end_row ']
=['XNUpload', 'id XNOp inaddr insize inchan']
=['XNEltwise', 'id XNOp name add bn relu inaddrA inaddrB insize_w insize_h inchan outaddr Bypass_Perf_Opt ']
=['XNConv', 'id XNOp name kernel_w kernel_h strides_w strides_h padding_w padding_h dilation_w dilation_h preshift scale postshift relu bias inaddr insize_w insize_h inchan outaddr outsize_w outsize_h  outchan Bypass_Perf_Opt ']
=['XNConvP', 'id XNOp name kernel_w kernel_h strides_w strides_h padding_w padding_h dilation_w dilation_h preshift scale postshift relu bias inaddr insize_w insize_h inchan outaddr outsize_w outsize_h  outchan Bypass_Perf_Opt  pool_kernel_w pool_kernel_h pool_strides_w pool_strides_h pool_paddings_w pool_paddings_h pool_fcmode pool_inaddr pool_insize_w pool_insize_h pool_inchan pool_outaddr pool_outsize_w pool_outsize_h']
##########
.............
63 XNEltwise res5a 1 0 1 0x0 0x118000 7 7 2048 0x0 0
64 XNConv res5b_branch2a/Conv2D 1 1 1 1 0 0 1 1 16 26 2 1 1 0x0 7 7 2048 0xe0000 7 7 512 0
65 XNConv res5b_branch2b/Conv2D 3 3 1 1 1 1 1 1 16 26 2 1 1 0xe0000 7 7 512 0x118000 7 7 512 0
66 XNConv res5b_branch2c/Conv2D 1 1 1 1 0 0 1 1 16 26 2 0 1 0x118000 7 7 512 0x150000 7 7 2048 0
67 XNEltwise res5b 1 0 1 0x0 0x150000 7 7 2048 0x0 0
68 XNConv res5c_branch2a/Conv2D 1 1 1 1 0 0 1 1 16 26 2 1 1 0x0 7 7 2048 0xe0000 7 7 512 0
69 XNConv res5c_branch2b/Conv2D 3 3 1 1 1 1 1 1 16 26 2 1 1 0xe0000 7 7 512 0x118000 7 7 512 0
70 XNConv res5c_branch2c/Conv2D 1 1 1 1 0 0 1 1 16 26 2 0 1 0x118000 7 7 512 0x150000 7 7 2048 0
71 XNEltwise res5c 1 0 1 0x0 0x150000 7 7 2048 0x0 0
72 XNAvgPool pool5 7 7 1 1 0 0 0 0x0 7 7 2048 0xe0000 1 1 0
# ## 74 XNInner fc1000/fc1000/MatMul 16 26 2 0x0 1 1 0x2500 1 1 fc1000/fc1000/MatMul: type=InnerProduct, sizes=None, shapes=None, sched 73 Kernel None Strides None Padding None  NO VALID CODE
SUCCESS
last samurai 1000 MemoryAllocation(start=0, end=4608.0, size=4608.0, extra=[1], strategy=[], layout=0, timestamp=339, slice=0, shapes=SizeType(batches=1, channels=1, height=1, width=1000), replication=Replication(full_sect_num=0, repl_sect_num=0, repl_unit_num=0, repl_unit_width=0, channels_division=0), written=False)
SUCCESS

 

 

Regards,

Long.

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

Re: Cannot compile Tensorflow network on ml-suite v1.2 via jupyter notebook

Jump to solution

Hi @duclong,

The issue regarding compilation of tensorflow in jupyter, may got fix in coming updates of ml suite. But you can get quantized output for tensorflow models, using jupyter notebook.

In addition to the tensorflow compilation step, I would like to add  one more parameter to get generated weights for the tensorflow models.

$ cd /ml-suite/xfdnn/tools/compile/bin

$ python xfdnn_compiler_tensorflow.pyc -n ../../../../models/tensorflow/resnet/fp32/resnet50_without_bn_test.pb -s all -m 4 -i 28 -d 0 -g fpga.cmd -w

Accept this as solution for command line compilation of tensorflow models.

Regards,

V Durga Bhavani.

 

0 Kudos