shravvvv commited on
Commit
ede33f1
·
1 Parent(s): 307c67b

Updated code to use safetensors

Browse files
Files changed (2) hide show
  1. config.json +2 -1
  2. test_model_loading.py +7 -2
config.json CHANGED
@@ -12,5 +12,6 @@
12
  "patch_size": [
13
  4,
14
  4
15
- ]
 
16
  }
 
12
  "patch_size": [
13
  4,
14
  4
15
+ ],
16
+ "use_safetensors": true
17
  }
test_model_loading.py CHANGED
@@ -1,6 +1,11 @@
1
  from transformers import AutoModelForImageClassification, AutoImageProcessor
 
2
 
3
- model = AutoModelForImageClassification.from_pretrained("shravvvv/SAG-ViT", trust_remote_code=True)
4
- processor = AutoImageProcessor.from_pretrained("shravvvv/SAG-ViT", trust_remote_code=True)
 
 
 
 
5
 
6
  print(model)
 
1
  from transformers import AutoModelForImageClassification, AutoImageProcessor
2
+ from safetensors import safe_open
3
 
4
+ model = AutoModelForImageClassification.from_pretrained(
5
+ "shravvvv/SAG-ViT",
6
+ use_safetensors=True, # Enable safetensors
7
+ trust_remote_code=True
8
+ )
9
+ processor = AutoImageProcessor.from_pretrained("shravvvv/SAG-ViT", use_safetensors=True, trust_remote_code=True)
10
 
11
  print(model)