Paper available here: Text Classification in Memristor-based Spiking Neural Networks
This is a Pytorch-based sentiment analysis task in the IMDB movie reviews dataset using an SNN with a statistic memristor model here.
This work takes two approaches to obtaining a trained memristor-based SNN: 1) converting a trained ANN to the memristor-based SNN, or 2) training the memristor-based SNN directly.
Here is the project hierarchy:
rram_array.py
includes the virtual memristor array with the memristor model.inputs.py
downloads the dataset and word embedding matrix (here we use GloVe), and transforms them to the forms that can be used in this work.anntosnn.py
implements the conversion from a train-ANN to a memristor-based SNN (approach 1).snntraining.py
implements the direct training of a memristor-based SNN (approach 2).train.py
trains the network by choosing one of the approaches mentioned above.Before running, please make sure you have installed numpy
, torch
, torchdata
, torchtext
and argparse
.
Run python train.py
in the command prompt if you want to convert an ANN to a memristor-based SNN.
Run python train.py --directConversion=False --thres=56.75
if you want to train a memristor-based SNN.
Rum python trian.py --xbar=False
to disable virtual memristor arrays.
Please refer to train.py
file to see the details regarding other parameters.
@article{10.1088/2634-4386/acb2f0,
author={Huang, Jinqi and Serb, Alexantrou and Stathopoulos, Spyros and Prodromakis, Themis},
title={Text classification in memristor-based spiking neural networks},
journal={Neuromorphic Computing and Engineering },
url={http://iopscience.iop.org/article/10.1088/2634-4386/acb2f0},
year={2023}
}
I referred to these Github projects when I made this work: