Documentation |
---|
Deep PeNSieve is a framework to entirely performing both training and inference of DNNs employing the Posit Number System.
- 64 bit machines
- Only tested on Linux
Deep PeNSieve relies on other two libraires: TensorFlow and SoftPosit. TensorFlow framework needs to be modified to support posit data type via software emulation.
At least TensorFlow must be installed to run Deep PeNSieve. If need to use fused operations, install SoftPosit too. You can install them, for example, using pip
. The following sequence of commands should install the required libraries:
pip install requests numpy==1.15.2 softposit
pip install numpy-posit
pip install https://s3-ap-southeast-1.amazonaws.com/posit-speedgo/tensorflow_posit-1.11.0.0.0.1.dev1-cp36-cp36m-linux_x86_64.whl
The order of the commands is important.
Other optional but helpful package is scikit-learn
, which is used in the example scripts.
Note: To avoid incompatibility issues, make sure no other version of NumPy or TensorFlow are installed. I suggest creating a virtual environment.
Note: This code was tested on an Ubuntu 18.04 system.
You can simply build a Docker container and run Deep PeNSieve from there:
git clone https://github.com/RaulMurillo/deep-pensieve.git
cd deep-pensieve
docker build -t deep_pns -f Dockerfile .
docker run -it deep_pns
Try your first Deep PeNSieve program
python
import numpy as np
import tensorflow as tf
np.posit32(np.pi)
# 3.141593
a = tf.constant(0.3, dtype=tf.posit8)
b = tf.constant(0.7, dtype=tf.posit8)
with tf.Session() as sess:
print(f'Using Posit8, {a.eval()} + {b.eval()} = {tf.add(a,b).eval()}')
# Using Posit8, 0.296875 + 0.703125 = 1.0
The actual source files of the project are stored inside the src
folder. it contains three folders:
TensorFlow
. Contains scripts for generating and training CNN models.SoftPosit
. Contains scripts for generating same models as inTensorFlow
folder, and perform low-precision inference with 8-bit posits using quire and fused operations.TF_Lite
. Contains scripts for creating TensorFlow Lite models from trained models on single-precision floating-point atTensorFlow
folder.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Deep PeNSieve is managed by Raul Murillo (contact: [email protected]).
The software uses NumPy, and relies heavily on TensorFlow and SoftPosit.
Deep PeNSieve is the result of our paper. If you find this code useful in your research, please consider citing:
Raul Murillo, Alberto A. Del Barrio, and Guillermo Botella. "Deep PeNSieve: A deep learning framework based on the posit number system." Digital Signal Processing 102 (2020): 102762, doi: 10.1016/j.dsp.2020.102762.
@article{murillo2020deep,
title={Deep PeNSieve: A deep learning framework based on the posit number system},
author={Murillo, Raul and Del Barrio, Alberto A and Botella, Guillermo},
journal={Digital Signal Processing},
volume={102},
pages={102762},
year={2020},
issn={1051-2004},
doi={https://doi.org/10.1016/j.dsp.2020.102762},
url={https://www.sciencedirect.com/science/article/pii/S105120042030107X},
publisher={Elsevier}
}
This code was tested on an Ubuntu 18.04 system.
This work has been supported by the Community of Madrid under grant S2018/TCS-4423, the EU (FEDER) and the Spanish MINECO under grant RTI2018-093684-B-I00 and by Banco Santander under grant PR26/16-20B-1.