Skip to content

Commit

Permalink
Fix failing tests & GitHub warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bo3z committed Sep 18, 2023
1 parent 5b4488e commit a029d2e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
4 changes: 3 additions & 1 deletion docs/advanced/model_optimization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ Finally, optimizing Vivado DSPs is possible, given a hls4ml config:
# Note the change from ParameterEstimator to VivadoDSPEstimator
optimized_model = optimize_keras_for_hls4ml(
baseline_model, model_attributes, VivadoDSPEstimator, scheduler,
X_train, y_train, X_val, y_val, batch_size, epochs, optimizer, loss_fn, metric, increasing, rtol
X_train, y_train, X_val, y_val, batch_size, epochs,
optimizer, loss_fn, metric, increasing, rtol
)
There are two more Vivado "optimizers" - VivadoFFEstimator, aimed at reducing register utilisation and VivadoMultiObjectiveEstimator, aimed at optimising BRAM and DSP utilisation.
Note, to ensure DSPs are optimized, "unrolled" Dense multiplication must be used before synthesing HLS, by modifying the config:
.. code-block:: Python
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ pytest_randomly.random_seeder =

[options.extras_require]
optimization =
keras-surgeon@https://github.com/fastmachinelearning/keras-surgeon
ortools
packaging
keras-surgeon@git+https://github.com/fastmachinelearning/keras-surgeon.git
ortools==9.4.1874
profiling
profiling =
matplotlib
pandas
Expand Down
21 changes: 21 additions & 0 deletions test/pytest/generate_ci_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,26 @@ def uses_example_model(test_filename):
else:
yml.update(new_yml)

# hls4ml Optimization API
tests = glob.glob('test_optimization/test_*.py')
for test in tests:
name = test.replace('test_optimization/', '').replace('test_', '').replace('.py', '')
new_yml = yaml.safe_load(template.format(name, f'test_optimization/test_{name}.py', int(uses_example_model(test))))
if yml is None:
yml = new_yml
else:
yml.update(new_yml)

tests = glob.glob('test_optimization/test_keras/test_*.py')
for test in tests:
name = test.replace('test_optimization/test_keras/', '').replace('test_', '').replace('.py', '')
new_yml = yaml.safe_load(
template.format(name, f'test_optimization/test_keras/test_{name}.py', int(uses_example_model(test)))
)
if yml is None:
yml = new_yml
else:
yml.update(new_yml)

yamlfile = open('pytests.yml', 'w')
yaml.safe_dump(yml, yamlfile)

0 comments on commit a029d2e

Please sign in to comment.