Skip to content

Commit 331465f

Browse files
[pre-commit.ci] auto fixes from pre-commit hooks
1 parent a3ab35f commit 331465f

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

docker/vitis_cfg.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,3 @@ CreateFileAssociation=1
3030

3131
# Choose whether disk usage will be optimized (reduced) after installation
3232
EnableDiskUsageOptimization=1
33-

part5_bdt.ipynb

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"\n",
4141
"# enable more output from conifer\n",
4242
"import logging\n",
43+
"\n",
4344
"logging.basicConfig(stream=sys.stdout, level=logging.WARNING)\n",
4445
"logger = logging.getLogger('conifer')\n",
4546
"logger.setLevel('DEBUG')\n",
@@ -112,8 +113,7 @@
112113
"metadata": {},
113114
"outputs": [],
114115
"source": [
115-
"clf = xgb.XGBClassifier(n_estimators=25, max_depth=5, learning_rate=1.0,\n",
116-
" random_state=seed).fit(X_train_val, y_train_val)"
116+
"clf = xgb.XGBClassifier(n_estimators=25, max_depth=5, learning_rate=1.0, random_state=seed).fit(X_train_val, y_train_val)"
117117
]
118118
},
119119
{
@@ -150,7 +150,10 @@
150150
"# add a legend\n",
151151
"from matplotlib.lines import Line2D\n",
152152
"\n",
153-
"lines = [Line2D([0], [0], ls='--'), Line2D([0], [0], ls='-'),]\n",
153+
"lines = [\n",
154+
" Line2D([0], [0], ls='--'),\n",
155+
" Line2D([0], [0], ls='-'),\n",
156+
"]\n",
154157
"from matplotlib.legend import Legend\n",
155158
"\n",
156159
"leg = Legend(ax, lines, labels=['part1 Keras', 'xgboost'], loc='lower right', frameon=False)\n",
@@ -222,7 +225,7 @@
222225
"# print the help to see the API on the conifer_model\n",
223226
"help(conifer_model)\n",
224227
"# write the project (writing HLS project to disk)\n",
225-
"conifer_model.write() \n",
228+
"conifer_model.write()\n",
226229
"# save the conifer model - we can load this again later\n",
227230
"clf.save_model('model_5/xgboost_model.json')"
228231
]
@@ -301,7 +304,7 @@
301304
"metadata": {},
302305
"outputs": [],
303306
"source": [
304-
"y_hls_proba = softmax(y_hls) # compute class probabilities from the raw predictions\n",
307+
"y_hls_proba = softmax(y_hls) # compute class probabilities from the raw predictions\n",
305308
"\n",
306309
"print(f'Accuracy baseline: {accuracy_score(np.argmax(y_test_one_hot, axis=1), np.argmax(y_ref, axis=1)):.5f}')\n",
307310
"print(f'Accuracy xgboost: {accuracy_score(np.argmax(y_test_one_hot, axis=1), np.argmax(y_xgb, axis=1)):.5f}')\n",
@@ -318,7 +321,11 @@
318321
"# add a legend\n",
319322
"from matplotlib.lines import Line2D\n",
320323
"\n",
321-
"lines = [Line2D([0], [0], ls='--'), Line2D([0], [0], ls=':'), Line2D([0], [0], ls='-'),]\n",
324+
"lines = [\n",
325+
" Line2D([0], [0], ls='--'),\n",
326+
" Line2D([0], [0], ls=':'),\n",
327+
" Line2D([0], [0], ls='-'),\n",
328+
"]\n",
322329
"from matplotlib.legend import Legend\n",
323330
"\n",
324331
"leg = Legend(ax, lines, labels=['part1 Keras', 'xgboost', 'conifer'], loc='lower right', frameon=False)\n",
@@ -390,11 +397,12 @@
390397
"outputs": [],
391398
"source": [
392399
"pynq_model_cfg = conifer.backends.xilinxhls.auto_config()\n",
393-
"pynq_model_cfg['OutputDir'] = 'model_5_pynq' # choose a new project directory\n",
400+
"pynq_model_cfg['OutputDir'] = 'model_5_pynq' # choose a new project directory\n",
394401
"pynq_model_cfg['ProjectName'] = 'conifer_jettag'\n",
395-
"pynq_model_cfg['AcceleratorConfig'] = {'Board' : 'pynq-z2', # choose a pynq-z2 board\n",
396-
" 'InterfaceType' : 'float' # floating point for the data I/O (this is default)\n",
397-
" }\n",
402+
"pynq_model_cfg['AcceleratorConfig'] = {\n",
403+
" 'Board': 'pynq-z2', # choose a pynq-z2 board\n",
404+
" 'InterfaceType': 'float', # floating point for the data I/O (this is default)\n",
405+
"}\n",
398406
"\n",
399407
"# print the config\n",
400408
"print('Modified Configuration\\n' + '-' * 50)\n",

part6_cnns.ipynb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,11 +1546,15 @@
15461546
"import plotting\n",
15471547
"\n",
15481548
"# First, the baseline model\n",
1549-
"hls_config = hls4ml.utils.config_from_keras_model(model, granularity='name', backend='Vitis', default_precision='ap_fixed<16,6>' )\n",
1549+
"hls_config = hls4ml.utils.config_from_keras_model(\n",
1550+
" model, granularity='name', backend='Vitis', default_precision='ap_fixed<16,6>'\n",
1551+
")\n",
15501552
"\n",
15511553
"plotting.print_dict(hls_config)\n",
15521554
"\n",
1553-
"hls_model = hls4ml.converters.keras_to_hls(model, hls_config=hls_config, output_dir='pruned_cnn', backend='Vitis', part='xcu250-figd2104-2L-e', io_type='io_stream')\n",
1555+
"hls_model = hls4ml.converters.keras_to_hls(\n",
1556+
" model, hls_config=hls_config, output_dir='pruned_cnn', backend='Vitis', part='xcu250-figd2104-2L-e', io_type='io_stream'\n",
1557+
")\n",
15541558
"hls_model.compile()"
15551559
]
15561560
},

0 commit comments

Comments
 (0)