How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("fill-mask", model="hamingsi/SpikingLM")
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForMaskedLM

tokenizer = AutoTokenizer.from_pretrained("hamingsi/SpikingLM")
model = AutoModelForMaskedLM.from_pretrained("hamingsi/SpikingLM", device_map="auto")
Quick Links

SpikingLM

SpikingLM is a BERT-base style masked-language model with spiking attention blocks.

This checkpoint uses:

  • temporal Spiking BERT with T=4
  • learnable Q/K/V scaling parameters initialized from 7
  • LIF nodes for projection, Q, K, V, attention output, and MLP blocks
  • FP16OptimizedExp2Softmax through self.learnmax(attention_scores) for attention normalization

Files

config.json
model.safetensors
tokenizer.json
tokenizer_config.json
special_tokens_map.json
vocab.txt
spiking_bert/modeling_spiking_bert.py
scripts/finetune_glue.py
requirements.txt

Usage

from safetensors.torch import load_file
from transformers import AutoConfig, AutoTokenizer
from spiking_bert import BertForMaskedLM

repo_or_path = "YOUR_USERNAME/SpikingLM"

config = AutoConfig.from_pretrained(repo_or_path)
config.T = 4
config._attn_implementation = "eager"

tokenizer = AutoTokenizer.from_pretrained(repo_or_path)
model = BertForMaskedLM(config)

state = load_file("model.safetensors")
model.load_state_dict(state)

If you clone the repository locally, replace repo_or_path with the local clone path and load model.safetensors from that directory.

Results

Masked-language-model evaluation stored with the checkpoint:

{"perplexity": 57.81198691730261}

Notes

Large binary weights are stored as model.safetensors. The model code requires torch, transformers, safetensors, and spikingjelly.

Downloads last month
75
Safetensors
Model size
0.1B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support