This repository contains a model of a transformer architecture built using a photonic core based on micro ring resonators. The photonic core enables matrix multiplication where weights are encoded as voltage inputs to micro ring modulators.
micro_ring_resonator.py: Model of a micro ring resonator.photonic_core.py: Implementation of a photonic core for matrix multiplication.photonic_transformer.py: Transformer model using the photonic core.train_transformer.py: Script for training the transformer and finding the weight voltages.calculate_power.py: Script for calculating the power of the entire transformer architecture.plot_results.py: Script to plot the input and output of micro ring modulators.
- Clone the Repository:
git clone https://github.com/yourusername/photonic-transformer.git cd photonic-transformer
pip install torch matplotlib
python train_transformer.py
python calculate_power.py
python plot_results.py