Skip to content
Proyek

es-ude/elastic-ai.creator

Lihat di GitHub

Tentang

Design, train and generate neural networks optimized specifically for FPGAs

Sistem dan infrastruktur

Cara angka ini diukur

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
+1
dalam 15 hari
+1
dalam 1 bulan
+2

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

elasticAI.creator

Design, train and compile neural networks optimized specifically for FPGAs. Obtaining a final model is typically a three stage process.

  • Design and train it using the quantized layers of the elasticai.creator.nn package.
  • Translate the model to a hardware description in VHDL or Verilog.
  • Synthesize the result with a third party tool, e.g. AMD/Xilinx Vivado (TM).

The layers support fixed-point and integer-only quantization. An overview of supported layers for each number format is available here

The project is part of the elasticAI ecosystem developed by the Intelligent Embedded Systems Lab of the University of Duisburg-Essen. For more details checkout the slides at Research Gate.

Table of contents

Install

elasticAI.creator requires Python 3.12 or newer. You can install it as a dependency using pip:

python3 -m pip install "elasticai.creator"

On PyPi the latest tagged version is published.

Currently, we do not automatically pack and push the code to PyPi. If you want to make sure to use the latest version from the main branch, you can install the ElasticAI.creator as a dependency via git:

python3 -m pip install git+https://github.com/es-ude/elastic-ai.creator.git@main

Using Sequential

elasticai.creator.nn.Sequential works like torch.nn.Sequential, but it can also create a hardware design of the whole network. The following example trains a small fixed-point network and translates it to VHDL.

from pathlib import Path

import torch

from elasticai.creator.nn import Sequential
from elasticai.creator.nn.fixed_point import Linear, ReLU

total_bits = 8
frac_bits = 4

# 1. Build the Sequential
model = Sequential(
    Linear(in_features=2, out_features=8, total_bits=total_bits, frac_bits=frac_bits),
    ReLU(total_bits=total_bits),
    Linear(in_features=8, out_features=1, total_bits=total_bits, frac_bits=frac_bits),
)

# 2. Train and validate
...

# 3. Create the design and write the VHDL files.
design = model.create_design("my_network")
design.save_to(Path("build"), take_vhdl=True)

The layer overview lists all layers and describes how Sequential creates a design. Please check the known limitations before you use the generated hardware.

More examples and documentation

Development

The project uses uv, and devenv.nix defines the tasks of the project. Without devenv you can run the most important ones directly:

uv sync --all-packages
uv run pytest -m "not (simulation or slow or hardware or ghdl)"   # fast tests
uv run pytest -m "(simulation or slow or ghdl) and not hardware"  # slow tests
uv run ruff check
uv run mypy -p elasticai.creator
uv run ty check --config-file ty_config_for_ci.toml

The simulation tests need GHDL for VHDL and Icarus Verilog for Verilog. See CONTRIBUTING.md for how to contribute.

Jelajahi proyek terkait

Memuat…