es-ude/elastic-ai.creator
소개
Design, train and generate neural networks optimized specifically for FPGAs
시스템 및 인프라측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +1
- in 1 month
- +2
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalelasticAI.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.nnpackage. - 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
- MNIST example
- Plugin system and available plugins
- Layers in Verilog: interfaces, signals and waveforms of the sequential layers (Linear, Conv1d, Softmax) and the combinational ones (activation functions, pooling)
- Intermediate representation, torch2ir, ir2vhdl
- HDL generator
- Testing
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.
관련 프로젝트 살펴보기
불러오는 중…