Posts

Showing posts from December, 2021

Time to retire my Rapsberry Pi Tensorflow Docker project?

I need your advice! Six years ago I did some experiments using TensorFlow on the Raspberry Pi.   It takes hours to compile TensorFlow on the Pi, and when I started the Pi platform wasn't officially supported. Sam Abrahams found his way thorough the rather scary compilation process, and I used his wheel to build a Docker image for the Pi that contained TensorFlow and Jupyter. That made it easy for users to experiment by installing Docker and then running the image. I was a bit anxious, as that was my first docker project, but it proved very popular. Things have change a lot since then. For a while, the TensorFlow team offered official support for the Raspberry Pi, though that has now stopped. You can still download a wheel but it's very out-of-date. I recently discovered Leigh Johnson's post on how to install full TensorFlow on the Pi. It's slightly out-of-date but the instructions on how to compile it yourself probably still work. Most Pi-based AI projects now use Tens

Timings and Code for Spiking Neural Networks with JAX

Image
 I've been encouraged to flesh out my earlier posts about JAX to support  27DaysOfJAX . I've written simulations of a Leaky Integrate and Fire Neuron in *Plowman's* (pure) Python, Python + numpy, and Python + JAX. Here's a plot of a 2000-step simulation for a single neuron: Plot for a single neuron The speedups using Python, Jax and the JAX jit compiler are dramatic. Pure Python can simulate a single step for a single neuron in roughly 0.25 µs. so 1,000,000 neurons would take about 0.25 seconds. numpy can simulate a single step for 1,000,000 neurons in 13.7 ms . Python, JAX + JAX's jit compilation can simulate a single step for 1,000,000 neurons in 75 µs . Here's the core code for each version. # Pure Python def step(v, tr, injected_current): spiking = False if tr > 0: next_v = reset_voltage tr = tr - 1 elif v > threshold: next_v = reset_voltage tr = int(refactory_period / dt) spiking = True else