Views
No views yet
Note: All models requiretrust_remote_code=Truebecause they use custom model classes.
1from transformers import AutoModel, AutoConfig
2import torch
3import torch.nn.functional as F
4
5model_id = "ashiq24/softeq-vit-base-patch16-224-voc-seg-c720-s0.90"
6
7config = AutoConfig.from_pretrained(model_id, trust_remote_code=True)
8model = AutoModel.from_pretrained(model_id, trust_remote_code=True)
9model.eval()
10
11# Input size must match model training resolution (e.g., 224×224)
12pixel_values = torch.randn(1, 3, 224, 224)
13
14with torch.no_grad():
15 outputs = model(pixel_values=pixel_values)
16
17# outputs.logits shape: (1, num_labels, H, W) — already upsampled to input resolution
18seg_map = outputs.logits.argmax(dim=1) # (1, H, W) predicted label per pixelSoftEqConfig class stores all architectural parameters. Key fields:| Parameter | Type | Description |
|---|---|---|
n_rotations | int | Size of the discrete rotation group (e.g., 4 for C4, 720 for near-continuous) |
soft_thresholding | float | Softness of the patch-embedding filter in [0, 1]; 0 = strict equivariance, 1 = no filter |
soft_thresholding_pos | float | Softness of the positional-embedding filter in [0, 1] |
group_type | str | Symmetry group: "rotation" or "roto_reflection" |
hard_mask | bool | Use a hard (step-function) mask instead of exponential damping |
model_arch | str | Architecture variant (see table above) |
pretrained_model | str | HuggingFace identifier of the base backbone |
num_labels | int | Number of output classes |
1@article{rahman2026tunable,
2 title={Tunable Soft Equivariance with Guarantees},
3 author={Rahman, Md Ashiqur and Hao, Lim Jun and Jiang, Jeremiah and Lim, Teck-Yian and Yeh, Raymond A},
4 journal={arXiv preprint arXiv:2603.26657},
5 year={2026}
6}