Samuel Stevens commited on
Commit
8fa75cc
1 Parent(s): d1c1a86

add openai templates

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. templates.py +83 -0
app.py CHANGED
@@ -4,7 +4,7 @@ import torch.nn.functional as F
4
  from torchvision import transforms
5
 
6
  from open_clip import create_model, get_tokenizer
7
- from open_clip.training.imagenet_zeroshot_data import openai_imagenet_template
8
 
9
  model_str = "ViT-B-16"
10
  pretrained = "/fs/ess/PAS2136/foundation_model/model/10m/2023_09_22-21_14_04-model_ViT-B-16-lr_0.0001-b_4096-j_8-p_amp/checkpoints/epoch_99.pt"
 
4
  from torchvision import transforms
5
 
6
  from open_clip import create_model, get_tokenizer
7
+ from templates import openai_imagenet_template
8
 
9
  model_str = "ViT-B-16"
10
  pretrained = "/fs/ess/PAS2136/foundation_model/model/10m/2023_09_22-21_14_04-model_ViT-B-16-lr_0.0001-b_4096-j_8-p_amp/checkpoints/epoch_99.pt"
templates.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ openai_imagenet_template = [
2
+ lambda c: f'a bad photo of a {c}.',
3
+ lambda c: f'a photo of many {c}.',
4
+ lambda c: f'a sculpture of a {c}.',
5
+ lambda c: f'a photo of the hard to see {c}.',
6
+ lambda c: f'a low resolution photo of the {c}.',
7
+ lambda c: f'a rendering of a {c}.',
8
+ lambda c: f'graffiti of a {c}.',
9
+ lambda c: f'a bad photo of the {c}.',
10
+ lambda c: f'a cropped photo of the {c}.',
11
+ lambda c: f'a tattoo of a {c}.',
12
+ lambda c: f'the embroidered {c}.',
13
+ lambda c: f'a photo of a hard to see {c}.',
14
+ lambda c: f'a bright photo of a {c}.',
15
+ lambda c: f'a photo of a clean {c}.',
16
+ lambda c: f'a photo of a dirty {c}.',
17
+ lambda c: f'a dark photo of the {c}.',
18
+ lambda c: f'a drawing of a {c}.',
19
+ lambda c: f'a photo of my {c}.',
20
+ lambda c: f'the plastic {c}.',
21
+ lambda c: f'a photo of the cool {c}.',
22
+ lambda c: f'a close-up photo of a {c}.',
23
+ lambda c: f'a black and white photo of the {c}.',
24
+ lambda c: f'a painting of the {c}.',
25
+ lambda c: f'a painting of a {c}.',
26
+ lambda c: f'a pixelated photo of the {c}.',
27
+ lambda c: f'a sculpture of the {c}.',
28
+ lambda c: f'a bright photo of the {c}.',
29
+ lambda c: f'a cropped photo of a {c}.',
30
+ lambda c: f'a plastic {c}.',
31
+ lambda c: f'a photo of the dirty {c}.',
32
+ lambda c: f'a jpeg corrupted photo of a {c}.',
33
+ lambda c: f'a blurry photo of the {c}.',
34
+ lambda c: f'a photo of the {c}.',
35
+ lambda c: f'a good photo of the {c}.',
36
+ lambda c: f'a rendering of the {c}.',
37
+ lambda c: f'a {c} in a video game.',
38
+ lambda c: f'a photo of one {c}.',
39
+ lambda c: f'a doodle of a {c}.',
40
+ lambda c: f'a close-up photo of the {c}.',
41
+ lambda c: f'a photo of a {c}.',
42
+ lambda c: f'the origami {c}.',
43
+ lambda c: f'the {c} in a video game.',
44
+ lambda c: f'a sketch of a {c}.',
45
+ lambda c: f'a doodle of the {c}.',
46
+ lambda c: f'a origami {c}.',
47
+ lambda c: f'a low resolution photo of a {c}.',
48
+ lambda c: f'the toy {c}.',
49
+ lambda c: f'a rendition of the {c}.',
50
+ lambda c: f'a photo of the clean {c}.',
51
+ lambda c: f'a photo of a large {c}.',
52
+ lambda c: f'a rendition of a {c}.',
53
+ lambda c: f'a photo of a nice {c}.',
54
+ lambda c: f'a photo of a weird {c}.',
55
+ lambda c: f'a blurry photo of a {c}.',
56
+ lambda c: f'a cartoon {c}.',
57
+ lambda c: f'art of a {c}.',
58
+ lambda c: f'a sketch of the {c}.',
59
+ lambda c: f'a embroidered {c}.',
60
+ lambda c: f'a pixelated photo of a {c}.',
61
+ lambda c: f'itap of the {c}.',
62
+ lambda c: f'a jpeg corrupted photo of the {c}.',
63
+ lambda c: f'a good photo of a {c}.',
64
+ lambda c: f'a plushie {c}.',
65
+ lambda c: f'a photo of the nice {c}.',
66
+ lambda c: f'a photo of the small {c}.',
67
+ lambda c: f'a photo of the weird {c}.',
68
+ lambda c: f'the cartoon {c}.',
69
+ lambda c: f'art of the {c}.',
70
+ lambda c: f'a drawing of the {c}.',
71
+ lambda c: f'a photo of the large {c}.',
72
+ lambda c: f'a black and white photo of a {c}.',
73
+ lambda c: f'the plushie {c}.',
74
+ lambda c: f'a dark photo of a {c}.',
75
+ lambda c: f'itap of a {c}.',
76
+ lambda c: f'graffiti of the {c}.',
77
+ lambda c: f'a toy {c}.',
78
+ lambda c: f'itap of my {c}.',
79
+ lambda c: f'a photo of a cool {c}.',
80
+ lambda c: f'a photo of a small {c}.',
81
+ lambda c: f'a tattoo of the {c}.',
82
+ ]
83
+