Prune, Quantize, Deploy Workshop
Visit workshop.femto.ai
EDGE AI Taipei 2025

Prune, Quantize, Deploy Workshop
Visit workshop.femto.ai
EDGE AI Taipei 2025
2
cd femtoAI_taipei_workshopconda create -n femtocrux_env python=3.10
conda activate femtocrux_envpip install femtocruxpython download_compiler.pybash setup.shdocker load -i /Volumes/FEMTO_USB/femtocrux_2.5.1.tardocker imagespip install femtocrux, the code will automatically use the local image instead of trying to fetch it remotely.femtoAI_taipei_workshop.zip file to your computer and unzipPrune, Quantize, Deploy Workshop
Visit workshop.femto.ai
EDGE AI Taipei 2025
3


1. Train From Scratch
Change directory into src cd src Start training run python3 train.py \ globals.device=cpu \ globals.batch_size=128 \ globals.exp_tag=bce-max-fp \ globals.epochs=2 \ globals.prune_model=false \ globals.quant_model=false If you use a Mac with metal support, you can set global.device=mps You may need to set PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0 if MPS runs out of memory export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
2. Pruning Train Run
python3 train.py \ globals.device=cpu \ globals.batch_size=128 \ globals.exp_tag=bce-max-fp-prune \ globals.epochs=2 \ model_load.checkpoint_path=./assets/bce-max-fp/checkpoints/model_final.pt \ model_load.model_type=fp \ globals.prune_model=true \ prune_cfg.prune_init=0.0 \ prune_cfg.prune_target=0.8 If you use a Mac with metal support, you can set global.device=mps
3. Post Training Quantization
python3 train.py \ globals.device=cpu \ globals.batch_size=128 \ globals.exp_tag=bce-max-prune-quantize \ model_load.checkpoint_path=./assets/bce-max-fp-prune/checkpoints/model_final.pt \ model_load.model_type=fp \ globals.prune_model=true \ prune_cfg.prune_init=0.8 \ prune_cfg.prune_target=0.8 \ globals.epochs=0 \ globals.quant_model=true If you use a Mac with metal support, you can set global.device=mps
4. Quantization Aware Training Run (QAT)
python3 train.py \ globals.device=cpu \ globals.batch_size=128 \ globals.exp_tag=bce-max-prune-QAT \ model_load.checkpoint_path=./assets/bce-max-prune-quantize/checkpoints/model_final.pt \ model_load.model_type=quant \ globals.prune_model=true prune_cfg.prune_init=0.8 \ prune_cfg.prune_target=0.8 \ globals.epochs=1 \ globals.quant_model=true This step is not compatible with globals.device=mps
brew install libusb hidapi
export DYLD_LIBARY_PATH=/opt/homebrew/libpip install "numpy<2.0"Prune, Quantize, Deploy Workshop
Visit workshop.femto.ai
EDGE AI Taipei 2025
4
/src/assets/speech_command_firmware.hexFile > Open HEX File, and select the .hex file located in step 1aPROGRAM FIRMWARE button located between the Audio In and Audio Out jacksOperation > Program, then Operation > Reboot/src/assets/bce-max-prune-QAT/model_datas/e2e_example/io_records/apb_records0PROG_A, 0PROG_D, 0PROG_P) onto the root directory of the SD cardPrune, Quantize, Deploy Workshop
Visit workshop.femto.ai
EDGE AI Taipei 2025
5
Prune, Quantize, Deploy Workshop
Visit workshop.femto.ai
EDGE AI Taipei 2025
6