MiniLM command classifier, int8 ONNX
Browse filesFiles changed (4)
- README.mdAdded+78
- classes.jsonAdded+1
- command_classifier_int8.onnxAdded+3
- tokenizer.jsonAdded
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778---license: apache-2.0language:- enbase_model: sentence-transformers/all-MiniLM-L6-v2library_name: onnxruntimepipeline_tag: text-classificationtags:- elite-dangerous- intent-classification- voice-commands- onnx---
# EDCeleste command classifier
Tells which ship action of [EDCeleste](https://github.com/IqSantiagow/EDCeleste) a pilot asked for in a spokenmessage, or that the message is not a ship action (a question, small talk, a refusal), so it goes to the LLM.
- **Base:** `sentence-transformers/all-MiniLM-L6-v2` (22.7M parameters, Apache 2.0), fine-tuned with a linear head over 42 classes: the 41 `EdAction` values of EDCeleste and `none`.- **File:** `command_classifier_int8.onnx`, 23 MB, dynamic int8 quantization. About 27 MB of RAM growth and 0.9 ms per message on one CPU thread (onnxruntime 1.31). No GPU.- **Input:** the text Whisper wrote, up to 32 tokens. **Output:** 42 logits, the order of the names is in `classes.json`.
## How the app uses it
```pythonimport jsonimport numpy as npimport onnxruntimefrom tokenizers import Tokenizer
tokenizer = Tokenizer.from_file("tokenizer.json")tokenizer.enable_truncation(32)classes = json.load(open("classes.json"))session = onnxruntime.InferenceSession("command_classifier_int8.onnx")
encoded = tokenizer.encode("lower the landing gear")logits = session.run(None, { "input_ids": np.array([encoded.ids], dtype=np.int64), "attention_mask": np.array([encoded.attention_mask], dtype=np.int64),})[0][0]probabilities = np.exp(logits - logits.max()); probabilities /= probabilities.sum()```
The app takes the best class among the actions that have a key in the pilot's keybindings, plus `none`.When its probability is below 0.5 the answer is `none`.
## Scores
Measured with threshold 0.5 and the app's rule (only actions with a key compete), against thedecision model it replaces (`IqSantiagow/edceleste-decider-0.8b`, v5):
| set | this model | decider-0.8b v5 ||---|---|---|| real speech, session 2: commands executed (of 59) | 52 | 58 || real speech, session 2: wrong key | 1 | 0 || real speech, session 2: key pressed on 73 non-commands | 0 | 2 || synthetic test: commands executed (of 570)* | 539 | 530 |
\* The synthetic set is flattered: its phrasings were known when the extra training phrases were written.Only the real-speech row is a clean number, and 59 commands is a small sample (one command is 1.7 points).Five of the seven misses are Whisper tiny.en mishearings of Elite words ("tough launcher" for chaff launcher).
## Limits
- **Closed set.** The 41 actions are classes. An action added to EDCeleste later is unknown to this model: it is never offered, so its commands go to the LLM until the model is trained again (about 25 s on a GPU).- English only. Trained on one pilot's speech plus generated phrasings.- It decides only the command. Whether Celeste should speak for a game event is a different question.
## Training
Data: the synthetic commands and the recordings of[`IqSantiagow/edceleste-decisions`](https://huggingface.co/datasets/IqSantiagow/edceleste-decisions) (private)plus about 2900 extra phrases and "not a command" lines written by hand and checked by the decider v5.10 epochs, learning rate 1e-4, label smoothing 0.05, mean pooling, on a GPU.1["CycleFireGroupNext", "CycleFireGroupPrevious", "CycleNextSubsystem", "CycleNextTarget", "CyclePreviousSubsystem", "CyclePreviousTarget", "DeployHardpointToggle", "DeployHeatSink", "EjectAllCargo", "ExplorationFSSEnter", "FireChaffLauncher", "FocusCommsPanel", "FocusLeftPanel", "FocusRadarPanel", "FocusRightPanel", "GalaxyMapOpen", "HyperSuperCombination", "Hyperspace", "IncreaseEnginesPower", "IncreaseSystemsPower", "IncreaseWeaponsPower", "LandingGearToggle", "NightVisionToggle", "QuickCommsPanel", "RadarDecreaseRange", "RadarIncreaseRange", "ResetPowerDistribution", "SelectHighestThreat", "SelectTarget", "SetSpeed100", "SetSpeed50", "SetSpeed75", "SetSpeedZero", "ShipSpotLightToggle", "Supercruise", "SystemMapOpen", "ToggleCargoScoop", "ToggleFlightAssist", "UIFocus", "UseBoostJuice", "UseShieldCell", "none"]123version https://git-lfs.github.com/spec/v1oid sha256:e3df43b9a8be03f4196214fbc43c4a817c7d5bc177c34cbb1c469525dea4f822size 22797632README.mdAdded+78
classes.jsonAdded+1
command_classifier_int8.onnxAdded+3
tokenizer.jsonAdded