Views
No views yet
CaiT model from the timm library, intended for binary image classification..bin) and SafeTensors (.safetensors) formats.cait_s24_224timm| Hyperparameter | Value |
|---|---|
| Optimizer | AdamW |
| Learning Rate Schedule | 1e-4 with CosineLRScheduler |
| Batch Size | 128 |
| Total Epochs | 20 |
| Early Stopping Patience | 7 on validation loss |
| Loss Function | CrossEntropyLoss w/ Label Smoothing (0.1) |
timmtimm.create_model. The config.json in this repo provides all necessary metadata.1import torch
2import timm
3
4# Ensure you have timm and huggingface_hub installed:
5# pip install timm "huggingface_hub>=0.23.0"
6
7# Load the model directly from the Hub
8# The `pretrained=True` flag will download the weights and config automatically.
9model = timm.create_model(
10 'hf-hub:parlange/cait-autoscan',
11 pretrained=True
12)
13model.eval()
14
15# The model's default_cfg will now be populated with mean/std and input size
16print(model.default_cfg)
17
18# Example inference with a dummy input
19dummy_input = torch.randn(1, 3, model.default_cfg['input_size'][-2], model.default_cfg['input_size'][-1])
20with torch.no_grad():
21 output = model(dummy_input)
22
23print(f"Output shape: {output.shape}") # Should be torch.Size([1, 2])
24print(f"Predictions: {torch.softmax(output, dim=1)}").pth checkpoint file used for this model is also available in this repository.