File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -57,4 +57,4 @@ examples/int8/qat/qat
57
57
examples /int8 /training /vgg16 /data /*
58
58
examples /int8 /datasets /data /*
59
59
env /** /*
60
- bazel-Torch-TensorRT-Preview
60
+ model_snapshot.txt
Original file line number Diff line number Diff line change 4
4
import torchvision .models as models
5
5
import timm
6
6
from transformers import BertModel , BertTokenizer , BertConfig
7
+ import os
8
+ import sys
7
9
8
10
torch .hub ._validate_not_a_forked_repo = lambda a , b , c : True
9
11
12
+ torch_version = torch .__version__
13
+ snapshot_file = 'model_snapshot.txt'
14
+ skip_download = False
15
+
16
+ # If model repository already setup
17
+ if os .path .exists (snapshot_file ):
18
+ with open (snapshot_file , 'r' ) as f :
19
+ model_version = f .read ()
20
+ if model_version == torch_version :
21
+ skip_download = True
22
+
23
+ # In case of existing model repository, skip the download
24
+ if skip_download :
25
+ print ('Skipping re-download of model repository' )
26
+ sys .exit ()
27
+ else :
28
+ with open (snapshot_file , 'w' ) as f :
29
+ f .write (torch_version )
30
+
10
31
models = {
11
32
"alexnet" : {
12
33
"model" : models .alexnet (pretrained = True ),
You can’t perform that action at this time.
0 commit comments