GithubHelp home page GithubHelp logo

naclab / ngc-learn Goto Github PK

View Code? Open in Web Editor NEW
96.0 6.0 17.0 52.23 MB

NGC-Learn: Neurobiological Learning and Biomimetic Systems Simulation in Python

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
brain-inspired-computing free-energy machine-learning neuroscience predictive-coding predictive-processing python spiking-neural-networks learning-algorithms cognitive-science

ngc-learn's Introduction

Python VersionLicenseMaintenanceDocumentation StatusDOI

ngc-learn is a Python library for building, simulating, and analyzing biomimetic systems, neurobiological agents, spiking neuronal networks, predictive coding circuitry, and models that learn via biologically-plausible forms of credit assignment. This simulation toolkit is built on top of JAX and is distributed under the 3-Clause BSD license.

It is currently maintained by the Neural Adaptive Computing (NAC) laboratory.

Documentation

Official documentation, including tutorials, can be found here. The model museum repo, which implements several historical models, can be found here.

The official blog-post related to the source paper behind this software library can be found here.
You can find the related paper right here, which was selected to appear in the Nature Neuromorphic Hardware and Computing Collection in 2023 and was chosen as one of the Editors' Highlights for Applied Physics and Mathematics in 2022.

Installation

Dependencies

ngc-learn requires:

  1. Python (>=3.10)
  2. NumPy (>=1.26.0)
  3. SciPy (>=1.7.0)
  4. ngcsimlib (>=0.2.b1), (visit official page here)
  5. JAX (>= 0.4.18) (to enable GPU use, make sure to install one of the CUDA variants)

ngc-learn 1.1.beta2 and later require Python 3.10 or newer as well as ngcsimlib >=0.3.b1. ngc-learn's plotting capabilities (routines within ngclearn.utils.viz) require Matplotlib (>=3.8.0) and imageio (>=2.31.5) and both plotting and density estimation tools (routines within ngclearn.utils.density) will require Scikit-learn (>=0.24.2). Many of the tutorials will require Matplotlib (>=3.8.0), imageio (>=2.31.5), and Scikit-learn (>=0.24.2).

User Installation

Setup: The easiest way to install ngc-learn is through pip:

$ pip install ngclearn

Note that installing the official pip package without any form of JAX installed on your system will default to downloading the CPU version of ngc-learn; make sure you have installed the Cuda 12 version of Jax/Jaxlib on your system before running the above pip command if you want to use the GPU version.

The documentation includes more detailed installation instructions. Note that this library was developed on Ubuntu 20.04 and tested on Ubuntu(s) 18.04 and 20.04.

If the installation was successful, you should see the following if you test it against your Python interpreter, i.e., run the $ python command and complete the following sequence of steps as depicted in the screenshot below (you should see at the bottom of your output something akin to the right major and minor version of ngc-learn):

Python 3.11.4 (main, MONTH  DAY YEAR, TIME) [GCC XX.X.X] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ngclearn
>>> ngclearn.__version__
'1.1b2'

Note: For access to the previous Tensorflow-2 version of ngc-learn (of which we no longer support), please visit the repo for ngc-learn-legacy.

Attribution:

If you use this code in any form in your project(s), please cite its source paper (as well as ngc-learn's official software citation):

@article{Ororbia2022,
  author={Ororbia, Alexander and Kifer, Daniel},
  title={The neural coding framework for learning generative models},
  journal={Nature Communications},
  year={2022},
  month={Apr},
  day={19},
  volume={13},
  number={1},
  pages={2064},
  issn={2041-1723},
  doi={10.1038/s41467-022-29632-7},
  url={https://doi.org/10.1038/s41467-022-29632-7}
}

Development:

We warmly welcome community contributions to this project. For details on how to make a contribution to ngc-learn, please see our contributing guidelines.

Source Code You can check/pull the latest source code for this library via:

$ git clone https://github.com/NACLab/ngc-learn.git

If you are working on and developing with ngc-learn pulled from the github repo, then run the following command to set up an editable install:

$ python install -e .

Version:
1.1.4-Beta

Author: Alexander G. Ororbia II
Director, Neural Adaptive Computing (NAC) Laboratory
Rochester Institute of Technology, Department of Computer Science

Copyright:

Copyright (C) 2021 The Neural Adaptive Computing Laboratory - All Rights Reserved
You may use, distribute and modify this code under the terms of the BSD 3-clause license.

You should have received a copy of the BSD 3-clause license with this software.
If not, please email us

ngc-learn's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar

ngc-learn's Issues

my success install version

-tensorflow-gpu>=2.0.0
+tensorflow-gpu==2.10.0

use conda python3.8.17

(py38) โžœ ngc-learn git:(main) โœ— python tests/test_identity.py
2023-09-10 19:31:41.965552: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-09-10 19:31:42.151515: E tensorflow/stream_executor/cuda/cuda_blas.cc:2981] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2023-09-10 19:31:42.969072: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory
2023-09-10 19:31:42.969166: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory
2023-09-10 19:31:42.969194: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
2023-09-10 19:31:44.442279: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudnn.so.8'; dlerror: libcudnn.so.8: cannot open shared object file: No such file or directory
2023-09-10 19:31:44.442394: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1934] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2023-09-10 19:31:44.443572: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
#######################################################################

Testing a proxy NGC graph w/ tied weights


Checking ancestral projection graph:
=> Test for: x = 1 = s2.z = s2.phi(z)
PASS!
=> Test for: x = 1 = s1.z = s1.phi(z)
PASS!
=> Test for: x = 1 = s0.z = s0.phi(z)
PASS!
=> Test for: x = x_sample
Expected: [[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]]
Output: [[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]]
PASS!


Checking NGC simulation object:
=> Test for: 0 = e2.z = e2.phi(z)
PASS!
=> Test for: 0 = e1.z = e1.phi(z)
PASS!
=> Test for: 0 = e0.z = e0.phi(z)
PASS!
=> Test for: x = x_hat
Expected: [[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]]
Output: [[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]]
PASS!
=> Test for update calculation: all dx should be = 0
PASS! (for all 3 dx calculations)
#######################################################################
#######################################################################
Testing a proxy NGC graph w/ untied weights


Checking NGC simulation object:
=> Test for: 0 = e2.z = e2.phi(z)
PASS!
=> Test for: 0 = e1.z = e1.phi(z)
PASS!
=> Test for: 0 = e0.z = e0.phi(z)
PASS!
=> Test for: x = x_hat
Expected: [[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]]
Output: [[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]]
PASS!
=> Test for update calculation: all dx should be = 0
PASS! (for all 6 dx calculations)
#######################################################################

LIF Node needs integration into nodes-and-cables system

  • ngc-learn version 0.4.0
  • Python version: 3.7-3.9

Description:
The leaky integrate-and-fire node needs to be integrated into the nodes-and-cables system.

What Was Done:
No errors were thrown -- this feature (currently a prototype offline) just needs to be integrated into the core distribution.

STDP needs integration into the nodes-and-cables system

  • ngc-learn version 0.5.0
  • Python version: 3.7-3.9

Description:
Spike-timing-dependent plasticity (STDP) needs to be integrated into the nodes-and-cables system (as a configurable learning rule).

What Was Done:
No errors were thrown -- this feature (currently an offline prototype under testing) just needs to be integrated into the core distribution.

Integrate latency coding

  • ngc-learn version 1.0.beta0
  • Python version: 3.11

Description:
Lag encoding spike input (en)coding needs integration (into "input_encoders")

What Was Done:
No errors were thrown -- this feature just needs to be integrated into the core distribution.

Integrate Izhikevich spiking cell

  • ngc-learn version 1.0.beta0
  • Python version: 3.11

Description:
Base Izhikevich cell needs to be integrated into ngc-learn components.

What Was Done:
No errors were thrown -- this feature just needs to be integrated into the core distribution.

when RL code will release?

thanks your greate work ,BACKPROP-FREE REINFORCEMENT LEARNING WITH ACTIVE NEURAL GENERATIVE CODING paper say code will release; when will release?

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.