• Stars
    star
    1,223
  • Rank 38,351 (Top 0.8 %)
  • Language
    C++
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Machine learning on FPGAs using HLS

hls4ml

DOI License Documentation Status PyPI version Downloads conda-forge

A package for machine learning inference in FPGAs. We create firmware implementations of machine learning algorithms using high level synthesis language (HLS). We translate traditional open-source machine learning package models into HLS that can be configured for your use-case!

If you have any questions, comments, or ideas regarding hls4ml or just want to show us how you use hls4ml, don't hesitate to reach us through the discussions tab.

Documentation & Tutorial

For more information visit the webpage: https://fastmachinelearning.org/hls4ml/

Detailed tutorials on how to use hls4ml's various functionalities can be found here.

Installation

pip install hls4ml

To install the extra dependencies for profiling:

pip install hls4ml[profiling]

Getting Started

Creating an HLS project

import hls4ml

# Fetch a keras model from our example repository
# This will download our example model to your working directory and return an example configuration file
config = hls4ml.utils.fetch_example_model('KERAS_3layer.json')

# You can print the configuration to see some default parameters
print(config)

# Convert it to a hls project
hls_model = hls4ml.converters.keras_to_hls(config)

# Print full list of example models if you want to explore more
hls4ml.utils.fetch_example_list()

Building a project with Xilinx Vivado HLS (after downloading and installing from here)

Note: Vitis HLS is not yet supported. Vivado HLS versions between 2018.2 and 2020.1 are recommended.

# Use Vivado HLS to synthesize the model
# This might take several minutes
hls_model.build()

# Print out the report if you want
hls4ml.report.read_vivado_report('my-hls-test')

Citation

If you use this software in a publication, please cite the software

@software{fastml_hls4ml,
  author       = {{FastML Team}},
  title        = {fastmachinelearning/hls4ml},
  year         = 2023,
  publisher    = {Zenodo},
  version      = {v0.7.1},
  doi          = {10.5281/zenodo.1201549},
  url          = {https://github.com/fastmachinelearning/hls4ml}
}

and first publication:

@article{Duarte:2018ite,
    author = "Duarte, Javier and others",
    title = "{Fast inference of deep neural networks in FPGAs for particle physics}",
    eprint = "1804.06913",
    archivePrefix = "arXiv",
    primaryClass = "physics.ins-det",
    reportNumber = "FERMILAB-PUB-18-089-E",
    doi = "10.1088/1748-0221/13/07/P07027",
    journal = "JINST",
    volume = "13",
    number = "07",
    pages = "P07027",
    year = "2018"
}

Additionally, if you use specific features developed in later papers, please cite those as well. For example, CNNs:

@article{Aarrestad:2021zos,
    author = "Aarrestad, Thea and others",
    title = "{Fast convolutional neural networks on FPGAs with hls4ml}",
    eprint = "2101.05108",
    archivePrefix = "arXiv",
    primaryClass = "cs.LG",
    reportNumber = "FERMILAB-PUB-21-130-SCD",
    doi = "10.1088/2632-2153/ac0ea1",
    journal = "Mach. Learn. Sci. Tech.",
    volume = "2",
    number = "4",
    pages = "045015",
    year = "2021"
}
@article{Ghielmetti:2022ndm,
    author = "Ghielmetti, Nicol\`{o} and others",
    title = "{Real-time semantic segmentation on FPGAs for autonomous vehicles with hls4ml}",
    eprint = "2205.07690",
    archivePrefix = "arXiv",
    primaryClass = "cs.CV",
    reportNumber = "FERMILAB-PUB-22-435-PPD",
    doi = "10.1088/2632-2153/ac9cb5",
    journal ="Mach. Learn. Sci. Tech.",
    year = "2022"
}

binary/ternary networks:

@article{Loncar:2020hqp,
    author = "Ngadiuba, Jennifer and others",
    title = "{Compressing deep neural networks on FPGAs to binary and ternary precision with HLS4ML}",
    eprint = "2003.06308",
    archivePrefix = "arXiv",
    primaryClass = "cs.LG",
    reportNumber = "FERMILAB-PUB-20-167-PPD-SCD",
    doi = "10.1088/2632-2153/aba042",
    journal = "Mach. Learn. Sci. Tech.",
    volume = "2",
    pages = "015001",
    year = "2021"
}

More Repositories

1

hls4ml-tutorial

Tutorial notebooks for hls4ml
Jupyter Notebook
286
star
2

qonnx

QONNX: Arbitrary-Precision Quantized Neural Networks in ONNX
Python
121
star
3

example-models

Python
16
star
4

models

Models and examples built with hls4ml
C++
12
star
5

qonnx_model_zoo

Model zoo for the Quantized ONNX (QONNX) model format
9
star
6

keras-training

jet classification and regression training in keras
Python
9
star
7

hls4ml-live-demo

Live demo of hls4ml on embedded platforms such as the Pynq-Z2
VHDL
8
star
8

SonicCMS

Services for Optimized Network Inference on Coprocessors (for CMS)
C++
8
star
9

pytorch-training

jet classification and regression training in pytorch
Python
6
star
10

AFM-training

Training models for Atomic Force Microscopy
Jupyter Notebook
6
star
11

fastml-science

Implementations of the fastml-science bechmark models, including a standard Keras (float) and QKeras (quantized) implementations.
Python
5
star
12

FaaST

C++
5
star
13

ml4quantum-release

Repository for the paper "Neural network accelerator for quantum control" https://arxiv.org/abs/2208.02645
Ada
4
star
14

sonic-workflows

Python
3
star
15

fastmachinelearning.github.io

HTML
3
star
16

bnn_pynq

Python
3
star
17

l1-jet-id

Code for Level-1 jet tagging
C++
3
star
18

gw-iaas

Deep learning inference-as-a-service tools and pipelines for gravitational wave physics
Python
2
star
19

hawq-jet-tagging

Jupyter Notebook
2
star
20

hls4ml-catapult-framework

A framework for developing the hls4ml Catapult backend. The C++ part of the backend is included as well
C
2
star
21

hls4ml-frame-grabbers

Jupyter Notebook
2
star
22

analysis-tools

Jupyter Notebook
1
star
23

tmva-training

For TMVA BDTs, mostly physicists
C
1
star