├── .gitignore ├── LICENSE ├── hardware_simulator ├── entry_area_power_profile.py ├── entry_energy_latency_workload.py ├── hardware │ ├── ADC.py │ ├── DAC.py │ ├── SRAM.py │ ├── __init__.py │ ├── photonic_MZI.py │ ├── photonic_core_base.py │ ├── photonic_crossbar.py │ └── photonic_mrr_bank.py ├── params │ ├── device_params │ │ ├── Bs_mrr_bank_4bit.yaml │ │ ├── Bs_mrr_bank_8bit.yaml │ │ ├── Bs_mzi_4bit.yaml │ │ ├── Bs_mzi_8bit.yaml │ │ ├── Dota_B_4bit.yaml │ │ ├── Dota_B_8bit.yaml │ │ ├── Dota_L_4bit.yaml │ │ ├── Dota_L_8bit.yaml │ │ └── default.yaml │ └── models │ │ ├── bert_base.yaml │ │ ├── bert_large.yaml │ │ ├── deit_base.yaml │ │ ├── deit_small.yaml │ │ └── deit_tiny.yaml ├── readme.md ├── scripts │ ├── area_power_all.sh │ ├── energy_latency_all.sh │ ├── energy_latency_onns_deit.sh │ ├── energy_latency_onns_deit_t.sh │ └── energy_latency_single.sh ├── simulator_FFN.py ├── simulator_attn.py └── utils │ ├── __init__.py │ ├── cal_flops_for_transformer.py │ ├── config.py │ ├── general.py │ └── model.py ├── profile ├── README.md ├── benckmark_logs │ ├── bert-b-128_power.csv │ ├── bert-b-384_power.csv │ ├── bert-l-320_power.csv │ ├── deit-b-power.csv │ ├── deit-s_power.csv │ └── deit-t_power.csv ├── bert_infer.py ├── customized_layer.py ├── model.py ├── power_monitor.sh ├── power_results │ ├── bert-l-320.csv │ └── power_usage.csv └── vit_infer.py ├── readme.md └── software_model ├── augment.py ├── cait_models.py ├── datasets.py ├── deit_t_sweep_input_noise_std.csv ├── deit_t_sweep_phase_noise_std.csv ├── deit_t_sweep_wavelength.csv ├── engine.py ├── hubconf.py ├── losses.py ├── main.py ├── models.py ├── models ├── __init__.py └── quant_vit.py ├── models_v2.py ├── ops ├── __init__.py ├── _quant_base.py ├── plot.py ├── quantize.py └── simulator.py ├── process_logs.py ├── readme.md ├── resmlp_models.py ├── samplers.py ├── scripts ├── evaluate_quant_transformer.sh ├── evaluate_quant_transformer_scan_noise.sh ├── process_output_logs.sh └── train_quant_transformer_with_noise.sh └── utils.py /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/.gitignore -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/LICENSE -------------------------------------------------------------------------------- /hardware_simulator/entry_area_power_profile.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/entry_area_power_profile.py -------------------------------------------------------------------------------- /hardware_simulator/entry_energy_latency_workload.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/entry_energy_latency_workload.py -------------------------------------------------------------------------------- /hardware_simulator/hardware/ADC.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/hardware/ADC.py -------------------------------------------------------------------------------- /hardware_simulator/hardware/DAC.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/hardware/DAC.py -------------------------------------------------------------------------------- /hardware_simulator/hardware/SRAM.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/hardware/SRAM.py -------------------------------------------------------------------------------- /hardware_simulator/hardware/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/hardware/__init__.py -------------------------------------------------------------------------------- /hardware_simulator/hardware/photonic_MZI.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/hardware/photonic_MZI.py -------------------------------------------------------------------------------- /hardware_simulator/hardware/photonic_core_base.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/hardware/photonic_core_base.py -------------------------------------------------------------------------------- /hardware_simulator/hardware/photonic_crossbar.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/hardware/photonic_crossbar.py -------------------------------------------------------------------------------- /hardware_simulator/hardware/photonic_mrr_bank.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/hardware/photonic_mrr_bank.py -------------------------------------------------------------------------------- /hardware_simulator/params/device_params/Bs_mrr_bank_4bit.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/device_params/Bs_mrr_bank_4bit.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/device_params/Bs_mrr_bank_8bit.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/device_params/Bs_mrr_bank_8bit.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/device_params/Bs_mzi_4bit.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/device_params/Bs_mzi_4bit.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/device_params/Bs_mzi_8bit.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/device_params/Bs_mzi_8bit.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/device_params/Dota_B_4bit.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/device_params/Dota_B_4bit.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/device_params/Dota_B_8bit.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/device_params/Dota_B_8bit.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/device_params/Dota_L_4bit.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/device_params/Dota_L_4bit.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/device_params/Dota_L_8bit.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/device_params/Dota_L_8bit.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/device_params/default.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/device_params/default.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/models/bert_base.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/models/bert_base.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/models/bert_large.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/models/bert_large.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/models/deit_base.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/models/deit_base.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/models/deit_small.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/models/deit_small.yaml -------------------------------------------------------------------------------- /hardware_simulator/params/models/deit_tiny.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/params/models/deit_tiny.yaml -------------------------------------------------------------------------------- /hardware_simulator/readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/readme.md -------------------------------------------------------------------------------- /hardware_simulator/scripts/area_power_all.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/scripts/area_power_all.sh -------------------------------------------------------------------------------- /hardware_simulator/scripts/energy_latency_all.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/scripts/energy_latency_all.sh -------------------------------------------------------------------------------- /hardware_simulator/scripts/energy_latency_onns_deit.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/scripts/energy_latency_onns_deit.sh -------------------------------------------------------------------------------- /hardware_simulator/scripts/energy_latency_onns_deit_t.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/scripts/energy_latency_onns_deit_t.sh -------------------------------------------------------------------------------- /hardware_simulator/scripts/energy_latency_single.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/scripts/energy_latency_single.sh -------------------------------------------------------------------------------- /hardware_simulator/simulator_FFN.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/simulator_FFN.py -------------------------------------------------------------------------------- /hardware_simulator/simulator_attn.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/simulator_attn.py -------------------------------------------------------------------------------- /hardware_simulator/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/utils/__init__.py -------------------------------------------------------------------------------- /hardware_simulator/utils/cal_flops_for_transformer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/utils/cal_flops_for_transformer.py -------------------------------------------------------------------------------- /hardware_simulator/utils/config.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/utils/config.py -------------------------------------------------------------------------------- /hardware_simulator/utils/general.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/utils/general.py -------------------------------------------------------------------------------- /hardware_simulator/utils/model.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/hardware_simulator/utils/model.py -------------------------------------------------------------------------------- /profile/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/README.md -------------------------------------------------------------------------------- /profile/benckmark_logs/bert-b-128_power.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/benckmark_logs/bert-b-128_power.csv -------------------------------------------------------------------------------- /profile/benckmark_logs/bert-b-384_power.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/benckmark_logs/bert-b-384_power.csv -------------------------------------------------------------------------------- /profile/benckmark_logs/bert-l-320_power.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/benckmark_logs/bert-l-320_power.csv -------------------------------------------------------------------------------- /profile/benckmark_logs/deit-b-power.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/benckmark_logs/deit-b-power.csv -------------------------------------------------------------------------------- /profile/benckmark_logs/deit-s_power.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/benckmark_logs/deit-s_power.csv -------------------------------------------------------------------------------- /profile/benckmark_logs/deit-t_power.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/benckmark_logs/deit-t_power.csv -------------------------------------------------------------------------------- /profile/bert_infer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/bert_infer.py -------------------------------------------------------------------------------- /profile/customized_layer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/customized_layer.py -------------------------------------------------------------------------------- /profile/model.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/model.py -------------------------------------------------------------------------------- /profile/power_monitor.sh: -------------------------------------------------------------------------------- 1 | nvidia-smi dmon -s puc -d 1 -i 0 -------------------------------------------------------------------------------- /profile/power_results/bert-l-320.csv: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /profile/power_results/power_usage.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/power_results/power_usage.csv -------------------------------------------------------------------------------- /profile/vit_infer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/profile/vit_infer.py -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/readme.md -------------------------------------------------------------------------------- /software_model/augment.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/augment.py -------------------------------------------------------------------------------- /software_model/cait_models.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/cait_models.py -------------------------------------------------------------------------------- /software_model/datasets.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/datasets.py -------------------------------------------------------------------------------- /software_model/deit_t_sweep_input_noise_std.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/deit_t_sweep_input_noise_std.csv -------------------------------------------------------------------------------- /software_model/deit_t_sweep_phase_noise_std.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/deit_t_sweep_phase_noise_std.csv -------------------------------------------------------------------------------- /software_model/deit_t_sweep_wavelength.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/deit_t_sweep_wavelength.csv -------------------------------------------------------------------------------- /software_model/engine.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/engine.py -------------------------------------------------------------------------------- /software_model/hubconf.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/hubconf.py -------------------------------------------------------------------------------- /software_model/losses.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/losses.py -------------------------------------------------------------------------------- /software_model/main.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/main.py -------------------------------------------------------------------------------- /software_model/models.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/models.py -------------------------------------------------------------------------------- /software_model/models/__init__.py: -------------------------------------------------------------------------------- 1 | from .quant_vit import * -------------------------------------------------------------------------------- /software_model/models/quant_vit.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/models/quant_vit.py -------------------------------------------------------------------------------- /software_model/models_v2.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/models_v2.py -------------------------------------------------------------------------------- /software_model/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/ops/__init__.py -------------------------------------------------------------------------------- /software_model/ops/_quant_base.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/ops/_quant_base.py -------------------------------------------------------------------------------- /software_model/ops/plot.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/ops/plot.py -------------------------------------------------------------------------------- /software_model/ops/quantize.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/ops/quantize.py -------------------------------------------------------------------------------- /software_model/ops/simulator.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/ops/simulator.py -------------------------------------------------------------------------------- /software_model/process_logs.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/process_logs.py -------------------------------------------------------------------------------- /software_model/readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/readme.md -------------------------------------------------------------------------------- /software_model/resmlp_models.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/resmlp_models.py -------------------------------------------------------------------------------- /software_model/samplers.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/samplers.py -------------------------------------------------------------------------------- /software_model/scripts/evaluate_quant_transformer.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/scripts/evaluate_quant_transformer.sh -------------------------------------------------------------------------------- /software_model/scripts/evaluate_quant_transformer_scan_noise.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/scripts/evaluate_quant_transformer_scan_noise.sh -------------------------------------------------------------------------------- /software_model/scripts/process_output_logs.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/scripts/process_output_logs.sh -------------------------------------------------------------------------------- /software_model/scripts/train_quant_transformer_with_noise.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/scripts/train_quant_transformer_with_noise.sh -------------------------------------------------------------------------------- /software_model/utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuhanqing/Lightening-Transformer/HEAD/software_model/utils.py --------------------------------------------------------------------------------