Skip to content

Latest commit

ย 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ O-CIMKit: The Ultimate Organic Computing-In-Memory Kit

ๆœ‰ๆœบๅญ˜็ฎ—ไธ€ไฝ“ๆžถๆž„ไธŽ็ฅž็ปๅฝขๆ€่ฎก็ฎ—ๅŸบๅบง

Version Python License Build Coverage Type Hints

Select Language: English | ไธญๆ–‡

๐Ÿ‡ฌ๐Ÿ‡ง English Version (Click to Expand)

A unified, modular, and hardware-aware simulation framework and neuromorphic computing evaluation platform for Organic Optoelectronic and Memristive Devices.

It decouples experimental device measurements (from raw Excel/TXT files) from machine learning models. Using this platform, you can easily ingest raw device measurements and immediately test them across 19 diverse SOTA neuromorphic applications.

๐Ÿ“‚ Project Structure

CIM_application_project/
โ”œโ”€โ”€ core/                         # 1. Core Physics & Simulation Kernel
โ”‚   โ”œโ”€โ”€ __init__.py               # Package public API exposure
โ”‚   โ”œโ”€โ”€ physics.py                # Device white noise, Poisson shot noise, LTP/LTD gradient modification
โ”‚   โ”œโ”€โ”€ quantization.py           # Learned Step Size Quantization (LSQ) & Straight-Through Estimator (STE)
โ”‚   โ”œโ”€โ”€ layers.py                 # OrganicSynapseConv, QATMLPLayer, PhysicalReservoir
โ”‚   โ””โ”€โ”€ autotune.py               # AutoTuner (using Optuna or grid search fallback for optimization)
โ”‚
โ”œโ”€โ”€ profiles/                     # 2. Device Profile Manager
โ”‚   โ”œโ”€โ”€ __init__.py               # Package public API exposure
โ”‚   โ”œโ”€โ”€ device_profile.py         # Unified DeviceProfile data class
โ”‚   โ”œโ”€โ”€ parser.py                 # Reads raw Excel (.xlsx) / TXT and fits models
โ”‚   โ”œโ”€โ”€ fitter.py                 # Fits LTP/LTD polynomials & volatile relaxation constants
โ”‚   โ””โ”€โ”€ repository/               # Generated JSON configurations (e.g. OECT_Vision.json)
โ”‚
โ”œโ”€โ”€ data/                         # 3. Data Storage Pointer
โ”‚   โ”œโ”€โ”€ devices/                  # Store raw experimental files (e.g. conductance.txt)
โ”‚   โ””โ”€โ”€ datasets/                 # Datasets (MNIST, MIT-BIH, Sleep-EDF, CIFAR-10, etc.)
โ”‚
โ”œโ”€โ”€ tests/                        # 4. Unit Test Suite (Subclasses of unittest.TestCase)
โ”‚   โ”œโ”€โ”€ test_quantization.py      # Tests LSQ/MinMax quantization and STE gradient flow
โ”‚   โ”œโ”€โ”€ test_layers.py            # Tests volatile DynamicOrganicSynapse & non-volatile SelfHealingCrossbar
โ”‚   โ”œโ”€โ”€ test_compiler.py          # Tests compiler logic and model synthesis
โ”‚   โ””โ”€โ”€ test_autotune.py          # Tests Bayesian reservoir hyperparameter autotuning
โ”‚
โ”œโ”€โ”€ scripts/                      # 5. One-Shot Demonstration & Plotting Utilities
โ”‚   โ”œโ”€โ”€ verify_codesign_selfhealing.py # Verifies co-design training and self-healing under 10-year drift
โ”‚   โ”œโ”€โ”€ evaluate_reliability.py        # Runs 10-year reliability aging analysis on Yale faces
โ”‚   โ”œโ”€โ”€ plot_benchmark.py              # Plots bar chart comparing device metrics against platform SOTA
โ”‚   โ”œโ”€โ”€ autotune_demo.py               # Demonstration of Optuna reservoir hyperparameter tuning
โ”‚   โ””โ”€โ”€ generate_mock_device_data.py   # Generates mock memristor/OECT measurements
โ”‚
โ”œโ”€โ”€ pyproject.toml                # 6. Pip packaging and installation configuration
โ”œโ”€โ”€ LICENSE                       # 7. MIT License file for open-source compliance
โ”œโ”€โ”€ CONTRIBUTING.md               # 8. Guide for contributing to the repository
โ”œโ”€โ”€ run_tests.py                  # 9. Main unit test discovery and runner execution script
โ”œโ”€โ”€ main.py                       # 10. Root-level unified CLI entry point
โ”‚
โ””โ”€โ”€ applications/                 # 11. Neural Network & Reservoir Applications
    โ”œโ”€โ”€ [ecg_cardio](applications/ecg_cardio) -> MIT-BIH classification (QAT MLP) | 97.91% ยฑ 0.45%
    โ”œโ”€โ”€ [fatigue_eeg](applications/fatigue_eeg) -> Sleep-EDF stage detection (Multi-Scale RC + QAT MLP) | 71.95% ยฑ 2.70%
    โ”œโ”€โ”€ [bearing_fault](applications/bearing_fault) -> CWRU fault detection (QAT MLP) | 99.80% ยฑ 0.25%
    โ”œโ”€โ”€ [chaotic_lorenz](applications/chaotic_lorenz) -> Lorenz attractor forecasting (Volatile RC) | NRMSE 0.0214%
    โ”œโ”€โ”€ [digit_rec](applications/digit_rec) -> Sequential MNIST digits recognition (Volatile RC) | 95.00%
    โ”œโ”€โ”€ [speech_emotion](applications/speech_emotion) -> RAVDESS speech emotion classification (QAT MLP) | 83.77% ยฑ 4.01%
    โ”œโ”€โ”€ [embodied_ai](applications/embodied_ai) -> Tactile multimodality materials classification (RC) | ~99.00%
    โ”œโ”€โ”€ [edge_llm](applications/edge_llm) -> Edge-LLM Sentinel anomaly interceptor (RF) | ~94% Intercept
    โ”œโ”€โ”€ [physical_attention](applications/physical_attention) -> Physical KV-Cache attention mechanism (Synergy) | ~95.00%
    โ”œโ”€โ”€ [fingerprint_rec](applications/fingerprint_rec) -> Fingerprint recognition (NIST + ResNet-18) | 92.19%
    โ”œโ”€โ”€ [cifar10_vision](applications/cifar10_vision) -> Bionic vision (CIFAR-10 + ResNet-18) | 90.15%
    โ”œโ”€โ”€ [face_rec](applications/face_rec) -> Yale Faces recognition (ResNet-18 + QAT Head) | 96.67%
    โ”œโ”€โ”€ [optoelectronic_vision](applications/optoelectronic_vision) -> Bionic Sensor-CIM integrated vision (OECT + ResNet-18) | 91.86%
    โ”œโ”€โ”€ [neuromorphic_stdp](applications/neuromorphic_stdp) -> Unsupervised SNN with STDP learning rule (SNN) | 22.78%
    โ”œโ”€โ”€ [neuromorphic_pid](applications/neuromorphic_pid) -> Adaptive PID controller under memristor noise | 55.80%
    โ”œโ”€โ”€ [tactile_eskin](applications/tactile_eskin) -> E-skin multi-class tactile sensor classification (CNN) | 100.00%
    โ”œโ”€โ”€ [neuromorphic_grasp](applications/neuromorphic_grasp) -> Robotic hand slippage reduction control | 98.24%
    โ”œโ”€โ”€ [seizure_detection](applications/seizure_detection) -> Seizure detection from multichannel EEG | 100.00%
    โ”œโ”€โ”€ [generative_aigc](applications/generative_aigc) -> ConvVAE Digit Image Generation & Reconstruction | MSE: 4.85e-3
    โ””โ”€โ”€ [biohybrid_spiking](applications/biohybrid_spiking) -> Spiking coordination in biohybrid networks | 100.00%

๐Ÿ“ฆ Installation

To use this platform as an open-source library, clone this repository and run editable pip install in your environment:

git clone https://github.com/Leslie360/CIM_application_project.git
cd CIM_application_project
pip install -e .

After installation, run the automated data preparation script to download standard vision datasets (MNIST, CIFAR-10) and generate lightweight mock data for proprietary medical/physical sensor datasets:

o-cimkit prepare-data

๐Ÿš€ Quick Start (CLI Entry Point)

You can run any of the 20+ applications directly via the global CLI or main.py:

# Run sMNIST digit recognition
o-cimkit run digit_rec

# Run Edge-LLM Sentinel anomaly detection
o-cimkit run edge_llm

# Run CIFAR-10 vision model for 10 epochs
o-cimkit run cifar10_vision --epochs 10

# Run generative VAE application
o-cimkit run generative_aigc --epochs 25

# Run Nano-GPT Large Language Model on Organic Memory
o-cimkit run cim_nano_gpt

# Run System-Level Architectural Profiler (DAC/ISCA/NeuroSim Metrics)
o-cimkit profile --app cim_nano_gpt

# Run top-journal comparative benchmark and publish reports
o-cimkit benchmark --apps cifar10_vision,generative_aigc --epochs 10

To run bionic co-design compilation and self-healing validation on a device profile:

o-cimkit codesign --device FingerMemristor

To generate a premium, high-resolution physical diagnostics datasheet and curves for a device:

o-cimkit diagnose --device FingerMemristor

๐Ÿ”ง How to Ingest a New Device Dataset

When you get new raw experimental measurements (Excel or TXT file of current/conductance values):

  1. Save the file inside data/devices/ (e.g., my_device.xlsx).
  2. Run the parser:
    # For nonvolatile memristors (e.g., 64 discrete states):
    python profiles/parser.py --file data/devices/my_device.xlsx --name MyMemristor --type nonvolatile --states 64
    
    # For volatile short-term decay measurements:
    python profiles/parser.py --file data/devices/my_device.xlsx --name MyOECT --type volatile
  3. A JSON configuration containing all computed parameters will be saved to profiles/repository/MyMemristor.json, which can be immediately used by all applications.

๐Ÿ“ˆ Boosting Performance (AutoTuner)

We provide an AutoTuner module (core/autotune.py) that utilizes Optuna (or a grid search fallback) to tune reservoir hyperparameters (spectral radius, input scaling, leaking rate) to automatically boost accuracy for your specific device characteristics:

from core.autotune import AutoTuner

# Define your evaluation function returning accuracy
def evaluate_fn(spectral_radius, input_scale, leaking_rate, ridge_alpha):
    # Setup your reservoir and evaluate
    return accuracy

# Tune for 30 trials
tuner = AutoTuner(target_accuracy_fn=evaluate_fn, n_trials=30)
best_params, best_accuracy = tuner.tune()

๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡็‰ˆ (็‚นๅ‡ปๅฑ•ๅผ€)

้’ˆๅฏนๆœ‰ๆœบๅ…‰็”ตๅ’Œๅฟ†้˜ปๅ™จไปถ็š„้ซ˜็กฌไปถๆ„Ÿ็Ÿฅๅบฆใ€ๆจกๅ—ๅŒ–ๅญ˜็ฎ—ไธ€ไฝ“ไปฟ็œŸไธŽ็ฅž็ปๅฝขๆ€่ฎก็ฎ—่ฏ„ไผฐๅนณๅฐใ€‚

่ฏฅๅนณๅฐๆˆๅŠŸๅฐ†ๅบ•ๅฑ‚็š„็‰ฉ็†ๅ™จไปถๅฎž้ชŒๆ•ฐๆฎๆต‹้‡๏ผˆๆ”ฏๆŒ raw Excel/TXT ๆŽฅๅ…ฅ๏ผ‰ไธŽไธŠๅฑ‚ๆœบๅ™จๅญฆไน ๆจกๅž‹่งฃ่€ฆใ€‚ไฝ ๅฏไปฅ้€š่ฟ‡็ฎ€ๅ•็š„็‰ฉ็†้…็ฝฎๆ–‡ไปถ็›ดๆŽฅๅฏนๆŽฅ 19 ็งไธๅŒๅ‰ๆฒฟ่ฎก็ฎ—้ข†ๅŸŸ็š„็ฅž็ป็ฝ‘็ปœไธŽๅ‚จๅค‡ๆฑ ็ฎ—ๆณ•ใ€‚

๐Ÿ“ฆ ๅฎ‰่ฃ…ๆ–นๅผ

ๆ”ฏๆŒไธ€้”ฎไฝœไธบ Python ๅบ“่ฟ›่กŒๅฎ‰่ฃ…ๅ’Œๅผ€ๅ‘๏ผš

git clone https://github.com/Leslie360/CIM_application_project.git
cd CIM_application_project
pip install -e .

ๅฎ‰่ฃ…ๅฎŒๆˆๅŽ๏ผŒ่ฏท่ฟ่กŒ่‡ชๅŠจๅŒ–ๆ•ฐๆฎๅ‡†ๅค‡่„šๆœฌใ€‚่ฏฅ่„šๆœฌไผš่‡ชๅŠจไธ‹่ฝฝๆ ‡ๅ‡†่ง†่ง‰ๆ•ฐๆฎ้›†๏ผˆๅฆ‚ MNIST, CIFAR-10๏ผ‰๏ผŒๅนถไธบ้‚ฃไบ›ๅฐ้—ญ็š„ๅŒป็–—/็‰ฉ็†ไธ“ๆœ‰ๆ•ฐๆฎ้›†๏ผˆๅฆ‚ๅฟƒ็”ตๅ›พใ€่„‘็”ตๅ›พ๏ผ‰็”Ÿๆˆ่ฝป้‡็บง็š„ Mock ๆต‹่ฏ„ๆ•ฐๆฎ๏ผŒ็กฎไฟ้กน็›ฎ่ƒฝๅคŸๅผ€็ฎฑๅณ็”จ๏ผš

o-cimkit prepare-data

๐Ÿš€ ๅ…จๅฑ€ CLI ๅ‘ฝไปค่กŒๅฟซ้€Ÿ่ฟ่กŒ

ๅฎ‰่ฃ…ๅฎŒๆฏ•ๅŽ๏ผŒไฝ ๅฏไปฅ้€š่ฟ‡ๅ…จๅฑ€ๅ‘ฝไปค o-cimkit ๆž้€Ÿ่ฟ่กŒไปปไฝ•ๆจกๅ—๏ผš

# ่ฟ่กŒ sMNIST ๆ‰‹ๅ†™ๆ•ฐๅญ—่ฏ†ๅˆซ
o-cimkit run digit_rec

# ่ฟ่กŒๅคงๆจกๅž‹่พน็ผ˜ๅ‰ๅ“จๅผ‚ๅธธๆ‹ฆๆˆช
o-cimkit run edge_llm

# ๆŒ‡ๅฎš่ฎญ็ปƒ่ฝฎๆ•ฐ่ฟ่กŒ CIFAR-10 ไปฟ็”Ÿ่ง†่ง‰็ณป็ปŸ
o-cimkit run cifar10_vision --epochs 10

# ่ฟ่กŒๅ˜ๅˆ†่‡ช็ผ–็ ๅ™จ AIGC ๅ›พๅƒ็”Ÿๆˆๅบ”็”จ
o-cimkit run generative_aigc --epochs 25

# ่ฟ่กŒๆœ€ๅ‰ๆฒฟ็š„ Nano-GPT ็”Ÿๆˆๅผๅคงๆจกๅž‹ (LLM on CIM)
o-cimkit run cim_nano_gpt

# ไธ€้”ฎ่ฟ่กŒ้กถๅˆŠๆ ‡ๅ‡†็กฌไปถๆ„Ÿ็Ÿฅๅฏนๆฏ”่ท‘ๅˆ†ๅนถ่พ“ๅ‡บๆŠฅๅ‘Š
o-cimkit benchmark --apps cifar10_vision,generative_aigc --epochs 10

่ฟ่กŒ็กฌไปถๆ„Ÿ็ŸฅๅๅŒ่ฎพ่ฎก็ผ–่ฏ‘ไธŽๅœจ็บฟ่‡ชๆ„ˆๆ ก้ชŒ๏ผˆ่ฝฏ็กฌๅๅŒไผ˜ๅŒ–๏ผ‰๏ผš

o-cimkit codesign --device FingerMemristor

ไธ€้”ฎ็ป˜ๅˆถ็‰ฉ็†็‰นๆ€ง่ฏŠๆ–ญๆ›ฒ็บฟๅนถ็”Ÿๆˆๆ•ฐๆฎๆ‰‹ๅ†ŒๆŠฅๅ‘Š๏ผš

o-cimkit diagnose --device FingerMemristor

๐Ÿ“ˆ ่‡ชๅŠจ่ถ…ๅ‚่ฐƒไผ˜ๆๅ‡ๆ€ง่ƒฝ

ๆˆ‘ไปฌๆไพ›ไบ†่‡ชๅŠจๅŒ–่ฐƒไผ˜ๆจกๅ— AutoTuner๏ผˆๅŸบไบŽ Optuna ๅฎž็Žฐ๏ผŒๆ— ็Žฏๅขƒๆ—ถ่‡ชๅŠจ้€€ๅ›ž่‡ณ้ซ˜ๆ•ˆ็ฝ‘ๆ ผๆœ็ดข๏ผ‰ใ€‚ๅฎƒ่ƒฝ้’ˆๅฏนๆ–ฐๅ™จไปถ็š„็‰ฉ็†็‰นๆ€ง๏ผˆๆ—ถ้—ดๅธธๆ•ฐใ€้ž็บฟๆ€งๅบฆ๏ผ‰๏ผŒ่‡ชๅŠจๆœ็ดขๆœ€ไฝณ็š„ๅ‚จๅฑ‚่ฐฑๅŠๅพ„ใ€่พ“ๅ…ฅ็ผฉๆ”พใ€ๆณ„ๆผ็އไปฅๅŠ่ฏปๅ‡บๅฑ‚ๆญฃๅˆ™ๅŒ–็ณปๆ•ฐ๏ผŒไฝฟๆ–ฐๅ™จไปถ็š„ไธ€้”ฎ่ฏ†ๅˆซ็ฒพๅบฆๆœ€ๅคงๅŒ–ใ€‚

About

A unified, hardware-aware simulation framework and self-healing neuromorphic computing platform for organic computing-in-memory (CIM) devices

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages