Benchmarking a BERT model running in a Chrome extension using Transformers.js. It's part of my thesis work on CookieAudit.
- Uses Transformers.js for in-browser inference
- Tests a BERT model for text classification
- Processes 1187 sentences from real cookie notices
- Includes a warm-up phase for more accurate timing
- Runs in a Chrome extension background script
- Initializes the
PurposePipelineSingleton
- Loads sentences from
notice_sentences.txt
- Warms up the model (30 iterations)
- Times the classification of each sentence
- Calculates and logs the average execution time
- Clone the repo
- Run
npm install
- Build with
wxt build -b chrome --mv3
- Load as an unpacked extension in Chrome
- Click "Start Benchmark 1" in the extension popup
- 209ms average execution time per sentence