From e2b30976cdaccf9d2b9820fefa22ced03c82711f Mon Sep 17 00:00:00 2001 From: Tanner Robison Date: Mon, 6 Jul 2026 10:35:32 -0700 Subject: readout layer trained verified with time-series forecasting task and plotted --- neurobench_testing/examples/gsc/benchmark_snn.py | 53 ------------------------ 1 file changed, 53 deletions(-) delete mode 100644 neurobench_testing/examples/gsc/benchmark_snn.py (limited to 'neurobench_testing/examples/gsc/benchmark_snn.py') diff --git a/neurobench_testing/examples/gsc/benchmark_snn.py b/neurobench_testing/examples/gsc/benchmark_snn.py deleted file mode 100644 index 48bea78..0000000 --- a/neurobench_testing/examples/gsc/benchmark_snn.py +++ /dev/null @@ -1,53 +0,0 @@ -import os -import torch - -from torch.utils.data import DataLoader - -from neurobench.datasets import SpeechCommands -from neurobench.processors.preprocessors import S2SPreProcessor -from neurobench.processors.postprocessors import ChooseMaxCount - -from neurobench.models import SNNTorchModel -from neurobench.benchmarks import Benchmark - -from neurobench.metrics.workload import ( - ActivationSparsity, - SynapticOperations, - ClassificationAccuracy -) -from neurobench.metrics.static import ( - Footprint, - ConnectionSparsity, -) - -from SNN import net - -device = torch.device("cuda" if torch.cuda.is_available() else "cpu") - -file_path = os.path.dirname(os.path.abspath(__file__)) -model_path = os.path.join(file_path, "model_data/s2s_gsc_snntorch") -data_dir = os.path.join(file_path, "../../data/speech_commands") # data in repo root dir - -test_set = SpeechCommands(path=data_dir, subset="testing") - -test_set_loader = DataLoader(test_set, batch_size=500, shuffle=True) - -net.load_state_dict(torch.load(model_path, map_location=torch.device('cpu'))) - -## Define model ## -model = SNNTorchModel(net) - -preprocessors = [S2SPreProcessor(device=device)] -postprocessors = [ChooseMaxCount()] - -static_metrics = [Footprint, ConnectionSparsity] -workload_metrics = [ClassificationAccuracy, ActivationSparsity, SynapticOperations] - -benchmark = Benchmark(model, test_set_loader, preprocessors, postprocessors, [static_metrics, workload_metrics]) -results = benchmark.run(device=device) -print(results) - -# Results: -# {'Footprint': 583900, 'ConnectionSparsity': 0.0, -# 'ClassificationAccuracy': 0.85633802969095, 'ActivationSparsity': 0.9668664144456199, -# 'SynapticOperations': {'Effective_MACs': 0.0, 'Effective_ACs': 3289834.3206724217, 'Dense': 29030400.0}} \ No newline at end of file -- cgit v1.2.3