Code Monkey home page Code Monkey logo

deep-pensieve's Introduction

Deep PeNSieve

Documentation
Documentation
DOI

Deep PeNSieve is a framework to entirely performing both training and inference of DNNs employing the Posit Number System.

Deep PeNSieve img

Supported on

  • 64 bit machines
  • Only tested on Linux

Installation

Locally (via pip)

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.

Via Docker

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

Usage

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

Source files

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 in TensorFlow 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 at TensorFlow folder.

Contributing

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.

Authors and credits

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.

License

Apache License 2.0

Acknowledgements

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.

deep-pensieve's People

Contributors

raulmurillo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

deep-pensieve's Issues

modifications of Tensorflow

Have you modified Tensorflow library to use numpy-posit instead of numpy ,Or can specify the modifications done to Tensorflow to support posit.
training using posit 16 can be done using code in Tensorflow directory , what is the need of doing it using softposit?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.