PixAI Tagger v1.0 (ONNX, FP16 weights)
An ONNX conversion of pixai-labs/pixai-tagger-v1.0 (Apache-2.0) for ONNX Runtime / OpenVINO inference without trust_remote_code.
Files
model.onnx: inputpixel_values(float32, 1×3×1008×1008), outputprobs(float32, 1×30877, sigmoid applied). Weights are stored in FP16; inputs and outputs stay float32.config.json: copied unchanged from the original repository. Usetagsandtags_splitto map output indices to tag names and categories.
Changes from the original
- RoPE is rewritten from complex arithmetic to equivalent real cos/sin arithmetic so it can be exported (max probability difference 8e-7).
- Attention over long sequences (the 5,184-token global attention blocks) is computed in query chunks of 648 to avoid materializing the full 16×5184² attention matrix. Results are unchanged; peak memory drops substantially.
- The sigmoid is included in the graph.
- Exported with
torch.onnx.export(dynamo=True)at opset 18, then converted to FP16 weights.
On 10 sample images, max absolute difference vs. the original PyTorch FP32 model is 0.002 (0.001 on character tags), and the set of tags above the recommended thresholds is identical.
Preprocessing
Same as the original RescalePadProcessor: convert to RGB (composite transparency on white), scale to fit 1008×1008 keeping the aspect ratio, pad with black (centered), and normalize with mean 0.5 / std 0.5.
Recommended thresholds from the original model card: general 0.17, character 0.27, style 0.15, copyright 0.24, meta 0.17, rating 0.41.