1import torch
2import timm
3
4# Load the model directly from the Hub
5model = timm.create_model(
6 'hf-hub:parlange/swin-gravit-c3',
7 pretrained=True
8)
9model.eval()
10
11# Example inference
12dummy_input = torch.randn(1, 3, 224, 224)
13with torch.no_grad():
14 output = model(dummy_input)
15 predictions = torch.softmax(output, dim=1)
16print(f"Lens probability: {predictions[0][1]:.4f}")
Performance across all test datasets (a through l) in the Common Test Sample (More et al. 2024):
Average performance across 12 test datasets from the Common Test Sample (More et al. 2024):
1@misc{parlange2025gravit,
2 title={GraViT: Transfer Learning with Vision Transformers and MLP-Mixer for Strong Gravitational Lens Discovery},
3 author={René Parlange and Juan C. Cuevas-Tello and Octavio Valenzuela and Omar de J. Cabrera-Rosas and Tomás Verdugo and Anupreeta More and Anton T. Jaelani},
4 year={2025},
5 eprint={2509.00226},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2509.00226},
9}
For questions about this model, please contact the author through:
https://github.com/parlange/