Brian2Lava #124
Replies: 5 comments 13 replies
-
Hey @andrewlehr - this sounds super exciting, and I'd be keen to contribute in some way. I'm not sure whether you had the chance of attending my short talk at the Lava Developer Forum - I think that setting up a model currently in Lava seems a little complex; Brian2's API seems a lot easier to use. We'd (with @Somayeh-h) love to deploy our models on Loihi though, so a conversion tool would be amazing. Would be great if you could share some more of your thoughts. Best, Tobi |
Beta Was this translation helpful? Give feedback.
-
Hey @Tobias-Fischer, awesome to hear that you are keen to contribute! I saw your talk and think it would be great to have your ideas flow into this project. Do you have concrete ideas about how you want to contribute and/or what features you would like to see? If not yet, no worries! Of course also feel free to email me: andrew.lehr[at]phys.uni-goettingen.de. Briefly, we want to connect Brian2 with Lava so that models defined in Brian2 can be easily deployed on CPU/GPU-based neuromorphic emulators (e.g. for Loihi1, Loihi2) and on neuromorphic hardware (e.g. Loihi1, Loihi2). This will entail developing an API that can make Lava processes and process models out of Brian2 models. We hope this will enable efficient prototyping by allowing flexible model definition and parameter search and then direct deployment to the chip once the appropriate model architecture is found. Beyond this, it would likely be useful to have a new front-end that has the best aspects of existing frameworks (Brian2 being just one of these) tailored to neuromorphic development. This will require ODE parsing, numerical integration methods, smart connectivity definition and representation, built on top of the Lava architecture. Perhaps it is too early to know exactly what this will look like, but it would be great to start collecting what it should and shouldn't do. Probably there will be a number of different front ends tailored to different applications (e.g. lava-dnf, lava-dl, ...) and this will be just one way of doing it. Best, |
Beta Was this translation helpful? Give feedback.
-
Would be great to see a mock code example that shows the usage from model definition to execution and perhaps post processing. The code does not have to be functional yet but just illustrate the "look and feel" from the highest level. People can then comment on the UI and give feedback. |
Beta Was this translation helpful? Give feedback.
-
I quickly want to share a mockup with the community of how we currently imagine the principles of the Brian2Lava package. If you have any further ideas, questions, remarks, etc. just leave a comment :) 1. Defining a networkFirst we define a network in Brian as usual with two additional lines. First, we need to import the from brian2 import *
import brian2lava
set_device('lava', use='Loihi2', debug=True)
# ...
eqs = '''
dv/dt = (ge+gi-(v-El))/taum : volt (unless refractory)
dge/dt = -ge/taue : volt
dgi/dt = -gi/taui : volt
'''
P = NeuronGroup(4000, eqs, threshold='v>Vt', reset='v = Vr',
refractory=5*ms, method='exact')
# ...
Ce = Synapses(P, P, on_pre='ge += we')
Ci = Synapses(P, P, on_pre='gi += wi')
Ce.connect('i<3200', p=0.02)
Ci.connect('i>=3200', p=0.02)
s_mon = SpikeMonitor(P)
run(1 * second) 2. Numerical formulation of the ODEThe ODE, defining a neuron model, can be chosen arbitrarily. Here a simple example (note: different from above). # Differential equation
eqs = '''
dv/dt = (v0-v)/tau : volt (unless refractory)
v0 : volt
''' Brian has aldready the capability to solve this equation and gives us a numerical solution, called abstract code. # Abstract code (exponential euler)
not_refractory = 1*((t - lastspike) > 0.005000)
_BA_v = -v0
_v = -_BA_v + (_BA_v + v)*exp(-dt*not_refractory/tau)
v = _v This code forms the basis to create a process and process model in Lava. 3. Process and process modelIn pricinple we would like to use the template engine Jinja to dynamically generate processes (hardware independent) and process models (different for every hardware). A highly simplified example could look like this: # Process model template using Jinja
{% for line in code_lines %}
{{line}}
{% endfor %}
_return_values, = _cond.nonzero() In this example some code lines (coming from Brian) are filled into a process and process model to define the neuron model in Lava. # Rendered process model
v = _array_neurongroup_v
_cond = v > 10 * mV
_return_values, = _cond.nonzero() |
Beta Was this translation helpful? Give feedback.
-
Brian2 model with conductance-based synapses on Loihi2 backend using brian2lava packageHi all, I would like to know if the hardware backend for Loihi2 is now included in the brian2lava package. I am currently working on running a conductance-based LIF neuron model on Loihi2, but now I only have the Brian2 model. It seems that I could use the brian2lava package to run the Brian2 model on the Loihi2 backend. Is that correct? |
Beta Was this translation helpful? Give feedback.
-
We want to interface Brian2 with Lava to facilitate deployment of brain-inspired algorithms on Lava-supported neuromorphic hardware and emulator backends.
The differential equation based model definition in Brian2 makes model exploration and prototyping very convenient. Neuron models and synapses can be flexibly defined, connectivity structures and plasticity rules equally so.
Given the direction of Loihi2 for general neuron models and three factor plasticity rules, enabling ODE based model design would be a great feature.
Beyond the interface, we want to contribute to the Lava framework to allow users and developers to program in Brian2 or Lava and deploy their models on either neuromorphic hardware or CPUs/GPUs. We have model conversion and network design tools in mind to facilitate this process.
Interested in collaborating, contributing, or have general ideas and desired features/capabilities? Let us know!
UPDATE:
See the Brian2Lava website [1] and Gitlab repository [2] for more information.
[1] https://brian2lava.gitlab.io/
[2] https://gitlab.com/brian2lava/brian2lava
Beta Was this translation helpful? Give feedback.
All reactions