For basic concepts to understand the tool, please visit the Concepts chapter.
Here we give line-by-line instructions on how to build a first project and explain the various steps to producing an HLS4ML IP.
Running the tool
These instructions are for simply running the tool out-of-the-box and getting a feel for the workflow.
1) To clone our latest version from github and install it from the main directory:
git clone https://github.com/hls-fpga-machine-learning/hls4ml.git cd hls4ml/ pip install .
NOTE FOR THIS STEP:
- If you don't have privileges to install in the configured environment, you can also pass
pipcommand as well. You can also add
--upgradeto update all packages to the newest available version.
- To enable develop mode:
pip install -e .
- In the future, we plan to support
hls4mlas a package on PyPI. After that you can simply install the software with:
pip install hls4ml
- We are also planning on supporting
2) Translate your model using configuration files (
The model files, along with other configuration parameters, are defined in the
Further information about
.yml files can be found in Configuration Section.
We provide some examples of configuration files in
In order to create an example HLS project:
- Go to
example-models/from the main directory:
- And use this command to translate a Keras model:
hls4ml convert -c keras-config.yml
This will create a new HLS project directory with an implementation of a model from the
To build the HLS project, do:
hls4ml build -p my-hls-test -a
This will create a Vivado HLS project with your model implmentation!
NOTE: For the last step, you can alternatively do the following to build the HLS project:
cd my-hls-test vivado_hls -f build_prj.tcl
vivado_hls can be controlled with:
vivado_hls -f build_prj.tcl "csim=1 synth=1 cosim=1 export=1"
Setting the additional parameters to
0 disables that step, but disabling
synth also disables
3) Further help:
For further information about how to use
If you need help for a particular
hls4ml command -hwill show help for the requested
pip uninstall hls4ml
Examples of model files and weights can be found in example_models directory.
Training codes and examples of resources needed to train the models can be found here.
Other examples of various HLS projects with examples of different machine learning algorithm implementations is in the directory example-prjs.