Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: CI
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: python -m unittest discover tests
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM python:3.9-slim
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
Comment on lines +3 to +4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current order of COPY and RUN commands is inefficient for Docker layer caching. Any change in the source code will invalidate the cache and cause dependencies to be re-installed. Also, COPY . . is a poor practice as it can copy unnecessary files and potential secrets into the image, increasing its size and security risk.

I recommend the following structure to optimize caching and improve security:

# Copy only the requirements file first
COPY requirements.txt .

# Install dependencies
RUN pip install -r requirements.txt

# Then copy the application code
COPY src ./src
COPY config ./config

You should also consider adding a .dockerignore file to explicitly exclude files not needed in the image.

CMD ["python", "src/main.py"]
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
python -m unittest discover tests
5 changes: 5 additions & 0 deletions config/default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Default hyperparameters for Aether-SPARC v3
seed: 42
model:
type: "mamba"
d_model: 256
2 changes: 2 additions & 0 deletions config/experiment_01.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Experiment 1: High temporal sparsity speech
dataset: "speech"
2 changes: 2 additions & 0 deletions config/loihi2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Intel Loihi 2 hardware specifications
energy_per_synaptic_op: 10e-12
Empty file added data/processed/.gitkeep
Empty file.
Empty file added data/raw/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions docs/api_reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# API Reference
Comprehensive API documentation.
2 changes: 2 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Architecture Overview
Details on the Selective State Space Model.
2 changes: 2 additions & 0 deletions docs/hardware_mapping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Hardware Mapping
Details on projection onto Intel Loihi 2.
1 change: 1 addition & 0 deletions notebooks/01_exploratory_data_analysis.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"cells":[],"metadata":{},"nbformat":4,"nbformat_minor":5}
1 change: 1 addition & 0 deletions notebooks/02_model_evaluation.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"cells":[],"metadata":{},"nbformat":4,"nbformat_minor":5}
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "aether-sparc"
version = "3.0.0"
description = "Asynchronous Event-Triggered Signal Processor"
Empty file added results/figures/.gitkeep
Empty file.
Empty file added results/logs/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions scripts/deploy_loihi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash -e
# Deployment script for Intel Loihi 2
echo "Deploying to Loihi 2..."
3 changes: 3 additions & 0 deletions scripts/evaluate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash -e
# Evaluation script
python src/evaluate.py --config config/default.yaml
3 changes: 3 additions & 0 deletions scripts/train.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash -e
# Training script for Aether-SPARC
python src/main.py --config config/default.yaml
1 change: 1 addition & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Source package for Aether-SPARC v3."""
1 change: 1 addition & 0 deletions src/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Core functionalities for event-triggered signal processing."""
4 changes: 4 additions & 0 deletions src/core/event_trigger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Adaptive Level-Crossing Sampling (ALCS) algorithms."""

def alcs_trigger(signal: list[float], threshold: float) -> list[float]:
return [s for s in signal if abs(s) > threshold]
4 changes: 4 additions & 0 deletions src/core/interpolation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Zero-Order Hold and Linear Interpolation modules."""

def zero_order_hold(events):
pass
4 changes: 4 additions & 0 deletions src/core/predictive_coding.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Predictive coding mechanisms for neuromorphic state update transitions."""

def predict(model: "torch.nn.Module", state: "torch.Tensor") -> "torch.Tensor":
return model.forward(state)
1 change: 1 addition & 0 deletions src/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Data loading and preprocessing."""
4 changes: 4 additions & 0 deletions src/data/loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Dataloaders for high temporal sparsity signals."""

class DataLoader:
pass
4 changes: 4 additions & 0 deletions src/data/transforms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Signal transformations."""

def apply_transform(signal: "np.ndarray") -> "np.ndarray":
return signal
7 changes: 7 additions & 0 deletions src/evaluate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Evaluation script."""

def evaluate():
print("Evaluating...")

if __name__ == "__main__":
evaluate()
7 changes: 7 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Main entry point for Aether-SPARC v3."""

def main():
print("Starting Aether-SPARC...")

if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions src/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Neuromorphic State Space Models."""
5 changes: 5 additions & 0 deletions src/models/loihi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Intel Loihi 2 silicon specification mappings."""

class Loihi2Mapper:
def __init__(self, mac_energy: float):
self.mac_energy = mac_energy
5 changes: 5 additions & 0 deletions src/models/mamba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Selective State Space Model - Mamba architecture tailored for event-driven processing."""

class Mamba:
def __init__(self):
pass
5 changes: 5 additions & 0 deletions src/models/s4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Structured State Space sequence model (S4) implementation."""

class S4:
def __init__(self):
pass
1 change: 1 addition & 0 deletions src/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Utility functions for data and metrics."""
3 changes: 3 additions & 0 deletions src/utils/logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Experiment logging utilities."""

import logging
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file only imports the logging module. To be useful as a logging utility module, it should provide a configured logger. Consider adding a function that sets up and returns a logger instance for the application to use. This centralizes logging configuration.

For example:

import logging
import sys

def get_logger(name: str) -> logging.Logger:
    logger = logging.getLogger(name)
    logger.setLevel(logging.INFO)
    handler = logging.StreamHandler(sys.stdout)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    handler.setFormatter(formatter)
    logger.addHandler(handler)
    return logger

4 changes: 4 additions & 0 deletions src/utils/metrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Energy and Compute Accounting metrics."""

def compute_macs(events: list) -> int:
return len(events)
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Unit and integration tests."""
8 changes: 8 additions & 0 deletions tests/test_mamba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Tests for Mamba selective state space model."""
import unittest
from src.models.mamba import Mamba

class TestMamba(unittest.TestCase):
def test_init(self):
m = Mamba()
self.assertIsNotNone(m)
7 changes: 7 additions & 0 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Tests for MAC accounting."""
import unittest
from src.utils.metrics import compute_macs

class TestMetrics(unittest.TestCase):
def test_macs(self):
self.assertEqual(compute_macs([1, 2]), 2)
8 changes: 8 additions & 0 deletions tests/test_s4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Tests for S4 model."""
import unittest
from src.models.s4 import S4

class TestS4(unittest.TestCase):
def test_init(self):
s = S4()
self.assertIsNotNone(s)
7 changes: 7 additions & 0 deletions tests/test_trigger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Tests for ALCS event trigger."""
import unittest
from src.core.event_trigger import alcs_trigger

class TestTrigger(unittest.TestCase):
def test_alcs(self):
self.assertEqual(alcs_trigger([1, 2, 3], 1.5), [2, 3])
Loading