csbc-pytorch / README.md
JamesK2W's picture
Upload README.md with huggingface_hub
9d546b7 verified
|
Raw
History Blame Contribute Delete
1.96 kB
---
license: mit
tags:
- counter-strike
- behavioural-cloning
- imitation-learning
- pytorch
- onnx
library_name: pytorch
---
# CSBC β€” PyTorch port of the Counter-Strike Behavioural Cloning model
A faithful PyTorch/ONNX conversion of Tim Pearce's
[Counter-Strike Behavioural Cloning](https://github.com/TeaPearce/Counter-Strike_Behavioural_Cloning)
model (`ak47_sub_55k_drop_d4_dmexpert_28`, stateful variant), produced for the
[Kairos](https://github.com/) GUI-agent project.
The original model is Keras / TensorFlow 2.3 (CUDA 10.1, won't use a 40-series
GPU). This port runs on any modern CUDA via PyTorch: EfficientNet-B0 trunk
(ONNX β†’ onnx2torch) + a hand-written stateful ConvLSTM head. Verified numerically
equal to Keras (zero-state max diff ~5e-7, 3-frame stateful sequence ~2e-6),
~3 ms/forward on a 4090.
## Files
| file | what |
|---|---|
| `csbc_backbone.onnx` | feedforward EfficientNet-B0 trunk (loaded via onnx2torch) |
| `csbc_head_weights.npz` | ConvLSTM2D(256) + 5 dense-head weights (applied in torch) |
| `csbc_ref.npz` | Keras reference outputs on fixed inputs (for the torch self-test) |
## Usage (Kairos)
```bash
python examples/csbc_agent/scripts/download_torch_weights.py --repo-id JamesK2W/csbc-pytorch
python examples/csbc_agent/run.py --backend torch --model-dir examples/csbc_agent/models
```
## I/O contract
- **Input:** one RGB frame β†’ BGR β†’ `cv2.resize` to 280Γ—150 β†’ float32 (no `/255`;
EfficientNet rescales internally). Tensor shape `(1, 150, 280, 3)`.
- **Output:** 52-vector β€” `[0:11]` keys (w a s d space ctrl shift 1 2 3 r),
`[11:13]` mouse L/R, `[13:36]` mouse-x argmax (23 buckets), `[36:51]` mouse-y
argmax (15 buckets), `[51]` value (ignored).
- **Stateful:** the ConvLSTM state persists across frames; call `reset_state()`
per episode and feed one frame at a time.
## License & provenance
Weights derive from the upstream CSBC release (MIT). Academic / offline use only.