Views
No views yet
1import torch
2from timm import create_model
3
4# Load model
5model = create_model('shvit_s3', num_classes=9, pretrained=False)
6
7# Load checkpoint
8checkpoint = torch.hub.load_state_dict_from_url(
9 'hf://YOUR_USERNAME/shvit_s3-medmnist/checkpoint_99.pth'
10)
11model.load_state_dict(checkpoint['model'])
12model.eval()
13
14# Use for inference
15# (your image preprocessing code here)1from huggingface_hub import hf_hub_download
2import torch
3
4# Download checkpoint
5checkpoint_path = hf_hub_download(
6 repo_id="YOUR_USERNAME/shvit_s3-medmnist",
7 filename="checkpoint_99.pth"
8)
9
10# Load model (requires timm and the SHViT model definition)
11checkpoint = torch.load(checkpoint_path)
12# ... load into your model1@inproceedings{yun2024shvit,
2 author={Yun, Seokju and Ro, Youngmin},
3 title={SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design},
4 booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
5 pages={5756--5767},
6 year={2024}
7}1@misc{shvit_s3_medmnist,
2 author = {Your Name},
3 title = {shvit_s3 Fine-tuned on PathMNIST (MedMNIST)},
4 year = {2024},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/YOUR_USERNAME/shvit_s3-medmnist}},
7}