Download src/model.py from Decoder24/Cataract-ViT: direct link, hf CLI and curl.
- Browser
- Download file 583 Bytes
-
https://huggingface.co/Decoder24/Cataract-ViT/resolve/main/src/model.py
- Command line
-
hf download hf://Decoder24/Cataract-ViT/src/model.py
-
curl -L -o model.py https://huggingface.co/Decoder24/Cataract-ViT/resolve/main/src/model.py
583 Bytes
| # src/model.py | |
| import timm | |
| import torch.nn as nn | |
| def create_model(num_classes, image_size=224): | |
| """ | |
| Membuat model Swin Transformer dengan ukuran input yang bisa disesuaikan. | |
| """ | |
| model = timm.create_model( | |
| 'swin_tiny_patch4_window7_224.ms_in22k', | |
| pretrained=True, | |
| num_classes=num_classes, | |
| drop_rate=0.4, | |
| img_size=image_size # Tambahkan parameter ini untuk menyesuaikan ukuran input | |
| ) | |
| print(f"Model Swin Transformer berhasil dibuat untuk input {image_size}x{image_size}.") | |
| return model |