roylvzn commited on
Commit
5916238
·
verified ·
1 Parent(s): c1a3aa4

update README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -29
README.md CHANGED
@@ -22,32 +22,3 @@ model-index:
22
 
23
  Trained on CIFAR-10 (10 classes). Weights saved as a plain PyTorch `state_dict` (`pytorch_model.bin`).
24
  Architecture is defined in `vit_model.py` (uses `timm`).
25
-
26
- ## Usage
27
-
28
- ```python
29
- import torch, json
30
- from huggingface_hub import hf_hub_download
31
- import importlib.util
32
-
33
- repo_id = "roylvzn/vit-cifar10"
34
-
35
- # fetch files
36
- weights_path = hf_hub_download(repo_id, "pytorch_model.bin")
37
- model_py = hf_hub_download(repo_id, "vit_model.py")
38
- classes_path = hf_hub_download(repo_id, "classes.json")
39
-
40
- # import vit_model.py dynamically
41
- spec = importlib.util.spec_from_file_location("vit_model", model_py)
42
- vm = importlib.util.module_from_spec(spec); spec.loader.exec_module(vm)
43
-
44
- # build model and load weights
45
- model = vm.ViTModel(num_classes=10, pretrained=False)
46
- state = torch.load(weights_path, map_location="cpu")
47
- model.load_state_dict(state)
48
- model.eval()
49
-
50
- with open(classes_path) as f:
51
- classes = json.load(f)
52
-
53
- # inference expects 224x224 ImageNet-normalized tensors
 
22
 
23
  Trained on CIFAR-10 (10 classes). Weights saved as a plain PyTorch `state_dict` (`pytorch_model.bin`).
24
  Architecture is defined in `vit_model.py` (uses `timm`).