nreimers commited on
Commit
afe976e
1 Parent(s): 3fa6f52

Replace clip model with transformers version

Browse files
0_CLIPModel/bpe_simple_vocab_16e6.txt.gz DELETED
Binary file (1.33 MB)
0_CLIPModel/config.json CHANGED
@@ -1,4 +1,152 @@
1
  {
2
- "model_name": "CLIPModel.pt",
3
- "tokenizer_name": "bpe_simple_vocab_16e6.txt.gz"
4
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  {
2
+ "_name_or_path": "openai/clip-vit-base-patch32",
3
+ "architectures": [
4
+ "CLIPModel"
5
+ ],
6
+ "initializer_factor": 1.0,
7
+ "model_type": "clip",
8
+ "projection_dim": 512,
9
+ "text_config": {
10
+ "_name_or_path": "",
11
+ "add_cross_attention": false,
12
+ "architectures": null,
13
+ "attention_dropout": 0.0,
14
+ "bad_words_ids": null,
15
+ "bos_token_id": 0,
16
+ "chunk_size_feed_forward": 0,
17
+ "decoder_start_token_id": null,
18
+ "diversity_penalty": 0.0,
19
+ "do_sample": false,
20
+ "dropout": 0.0,
21
+ "early_stopping": false,
22
+ "encoder_no_repeat_ngram_size": 0,
23
+ "eos_token_id": 2,
24
+ "finetuning_task": null,
25
+ "forced_bos_token_id": null,
26
+ "forced_eos_token_id": null,
27
+ "gradient_checkpointing": false,
28
+ "hidden_act": "quick_gelu",
29
+ "hidden_size": 512,
30
+ "id2label": {
31
+ "0": "LABEL_0",
32
+ "1": "LABEL_1"
33
+ },
34
+ "initializer_factor": 1.0,
35
+ "initializer_range": 0.02,
36
+ "intermediate_size": 2048,
37
+ "is_decoder": false,
38
+ "is_encoder_decoder": false,
39
+ "label2id": {
40
+ "LABEL_0": 0,
41
+ "LABEL_1": 1
42
+ },
43
+ "layer_norm_eps": 1e-05,
44
+ "length_penalty": 1.0,
45
+ "max_length": 20,
46
+ "max_position_embeddings": 77,
47
+ "min_length": 0,
48
+ "model_type": "clip_text_model",
49
+ "no_repeat_ngram_size": 0,
50
+ "num_attention_heads": 8,
51
+ "num_beam_groups": 1,
52
+ "num_beams": 1,
53
+ "num_hidden_layers": 12,
54
+ "num_return_sequences": 1,
55
+ "output_attentions": false,
56
+ "output_hidden_states": false,
57
+ "output_scores": false,
58
+ "pad_token_id": 1,
59
+ "prefix": null,
60
+ "problem_type": null,
61
+ "pruned_heads": {},
62
+ "remove_invalid_values": false,
63
+ "repetition_penalty": 1.0,
64
+ "return_dict": true,
65
+ "return_dict_in_generate": false,
66
+ "sep_token_id": null,
67
+ "task_specific_params": null,
68
+ "temperature": 1.0,
69
+ "tie_encoder_decoder": false,
70
+ "tie_word_embeddings": true,
71
+ "tokenizer_class": null,
72
+ "top_k": 50,
73
+ "top_p": 1.0,
74
+ "torchscript": false,
75
+ "transformers_version": "4.6.0",
76
+ "use_bfloat16": false,
77
+ "vocab_size": 49408
78
+ },
79
+ "text_config_dict": null,
80
+ "transformers_version": null,
81
+ "vision_config": {
82
+ "_name_or_path": "",
83
+ "add_cross_attention": false,
84
+ "architectures": null,
85
+ "attention_dropout": 0.0,
86
+ "bad_words_ids": null,
87
+ "bos_token_id": null,
88
+ "chunk_size_feed_forward": 0,
89
+ "decoder_start_token_id": null,
90
+ "diversity_penalty": 0.0,
91
+ "do_sample": false,
92
+ "dropout": 0.0,
93
+ "early_stopping": false,
94
+ "encoder_no_repeat_ngram_size": 0,
95
+ "eos_token_id": null,
96
+ "finetuning_task": null,
97
+ "forced_bos_token_id": null,
98
+ "forced_eos_token_id": null,
99
+ "gradient_checkpointing": false,
100
+ "hidden_act": "quick_gelu",
101
+ "hidden_size": 768,
102
+ "id2label": {
103
+ "0": "LABEL_0",
104
+ "1": "LABEL_1"
105
+ },
106
+ "image_size": 224,
107
+ "initializer_factor": 1.0,
108
+ "initializer_range": 0.02,
109
+ "intermediate_size": 3072,
110
+ "is_decoder": false,
111
+ "is_encoder_decoder": false,
112
+ "label2id": {
113
+ "LABEL_0": 0,
114
+ "LABEL_1": 1
115
+ },
116
+ "layer_norm_eps": 1e-05,
117
+ "length_penalty": 1.0,
118
+ "max_length": 20,
119
+ "min_length": 0,
120
+ "model_type": "clip_vision_model",
121
+ "no_repeat_ngram_size": 0,
122
+ "num_attention_heads": 12,
123
+ "num_beam_groups": 1,
124
+ "num_beams": 1,
125
+ "num_hidden_layers": 12,
126
+ "num_return_sequences": 1,
127
+ "output_attentions": false,
128
+ "output_hidden_states": false,
129
+ "output_scores": false,
130
+ "pad_token_id": null,
131
+ "patch_size": 32,
132
+ "prefix": null,
133
+ "problem_type": null,
134
+ "pruned_heads": {},
135
+ "remove_invalid_values": false,
136
+ "repetition_penalty": 1.0,
137
+ "return_dict": true,
138
+ "return_dict_in_generate": false,
139
+ "sep_token_id": null,
140
+ "task_specific_params": null,
141
+ "temperature": 1.0,
142
+ "tie_encoder_decoder": false,
143
+ "tie_word_embeddings": true,
144
+ "tokenizer_class": null,
145
+ "top_k": 50,
146
+ "top_p": 1.0,
147
+ "torchscript": false,
148
+ "transformers_version": "4.6.0",
149
+ "use_bfloat16": false
150
+ },
151
+ "vision_config_dict": null
152
+ }
0_CLIPModel/merges.txt ADDED
The diff for this file is too large to render. See raw diff
0_CLIPModel/preprocessor_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": 224,
3
+ "do_center_crop": true,
4
+ "do_normalize": true,
5
+ "do_resize": true,
6
+ "feature_extractor_type": "CLIPFeatureExtractor",
7
+ "image_mean": [
8
+ 0.48145466,
9
+ 0.4578275,
10
+ 0.40821073
11
+ ],
12
+ "image_std": [
13
+ 0.26862954,
14
+ 0.26130258,
15
+ 0.27577711
16
+ ],
17
+ "resample": 3,
18
+ "size": 224
19
+ }
0_CLIPModel/{CLIPModel.pt → pytorch_model.bin} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:16afc66c29d22afa707a6118519bcb2d9fa56f07f4bb9cde21d87c9e5cf0283b
3
- size 605217061
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a62934cf6216e42859223aed2df08b4f1bd0042cb31be80d2db5cd54f71c0d16
3
+ size 605266175
0_CLIPModel/special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
1
+ {"bos_token": {"content": "<|startoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "pad_token": "<|endoftext|>"}
0_CLIPModel/tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
1
+ {"errors": "replace", "unk_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "bos_token": {"content": "<|startoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "eos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "pad_token": "<|endoftext|>", "add_prefix_space": false, "do_lower_case": true, "name_or_path": "openai/clip-vit-base-patch32", "model_max_length": 77, "special_tokens_map_file": "/home/ukp-reimers/.cache/huggingface/transformers/18a566598f286c9139f88160c99f84eec492a26bd22738fa9cb44d5b7e0a5c76.cce1206abbad28826f000510f22f354e53e66a97f7c23745a7dfe27609cc07f5", "tokenizer_file": "/home/ukp-reimers/.cache/huggingface/transformers/7811def0c53be25ba790cb67ac785669b508a8d1cf8c912b8ac046c5f08aee68.c51a626c1dc62de865745e4ab7125f190823b458ac5ee9ce21b1d006512b3a53"}
0_CLIPModel/vocab.json ADDED
The diff for this file is too large to render. See raw diff
README.md CHANGED
@@ -1,18 +1,16 @@
1
  ---
2
  pipeline_tag: sentence-similarity
3
- license: apache-2.0
4
  tags:
5
  - sentence-transformers
6
  - feature-extraction
7
  - sentence-similarity
8
- - transformers
9
  ---
10
 
11
- # sentence-transformers/clip-ViT-B-32
12
-
13
- This the [OpenAI CLIP Model](https://github.com/openai/CLIP) ported to [sentence-transformers](https://www.SBERT.net) model: It maps images and text to a shared vector space.
14
 
 
15
 
 
16
 
17
  ## Usage (Sentence-Transformers)
18
 
@@ -28,7 +26,7 @@ Then you can use the model like this:
28
  from sentence_transformers import SentenceTransformer
29
  sentences = ["This is an example sentence", "Each sentence is converted"]
30
 
31
- model = SentenceTransformer('sentence-transformers/clip-ViT-B-32')
32
  embeddings = model.encode(sentences)
33
  print(embeddings)
34
  ```
@@ -37,39 +35,19 @@ print(embeddings)
37
 
38
  ## Evaluation Results
39
 
 
40
 
41
-
42
- For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name=sentence-transformers/clip-ViT-B-32)
43
 
44
 
45
 
46
  ## Full Model Architecture
47
  ```
48
  SentenceTransformer(
49
- (0): CLIPModel(
50
- (model): CLIP(
51
- (visual): VisualTransformer()
52
- (transformer): Transformer()
53
- (token_embedding): Embedding(49408, 512)
54
- (ln_final): LayerNorm((512,), eps=1e-05, elementwise_affine=True)
55
- )
56
- )
57
  )
58
  ```
59
 
60
  ## Citing & Authors
61
 
62
- This model was trained by [sentence-transformers](https://www.sbert.net/).
63
-
64
- If you find this model helpful, feel free to cite our publication [Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks](https://arxiv.org/abs/1908.10084):
65
- ```bibtex
66
- @inproceedings{reimers-2019-sentence-bert,
67
- title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
68
- author = "Reimers, Nils and Gurevych, Iryna",
69
- booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
70
- month = "11",
71
- year = "2019",
72
- publisher = "Association for Computational Linguistics",
73
- url = "http://arxiv.org/abs/1908.10084",
74
- }
75
- ```
1
  ---
2
  pipeline_tag: sentence-similarity
 
3
  tags:
4
  - sentence-transformers
5
  - feature-extraction
6
  - sentence-similarity
 
7
  ---
8
 
9
+ # {MODEL_NAME}
 
 
10
 
11
+ This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a None dimensional dense vector space and can be used for tasks like clustering or semantic search.
12
 
13
+ <!--- Describe your model here -->
14
 
15
  ## Usage (Sentence-Transformers)
16
 
26
  from sentence_transformers import SentenceTransformer
27
  sentences = ["This is an example sentence", "Each sentence is converted"]
28
 
29
+ model = SentenceTransformer('{MODEL_NAME}')
30
  embeddings = model.encode(sentences)
31
  print(embeddings)
32
  ```
35
 
36
  ## Evaluation Results
37
 
38
+ <!--- Describe how your model was evaluated -->
39
 
40
+ For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
 
41
 
42
 
43
 
44
  ## Full Model Architecture
45
  ```
46
  SentenceTransformer(
47
+ (0): CLIPModel()
 
 
 
 
 
 
 
48
  )
49
  ```
50
 
51
  ## Citing & Authors
52
 
53
+ <!--- Describe where people can find more information -->
 
 
 
 
 
 
 
 
 
 
 
 
 
config_sentence_transformers.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "__version__": {
3
  "sentence_transformers": "2.0.0",
4
- "transformers": "4.7.0",
5
- "pytorch": "1.9.0+cu102"
6
  }
7
  }
1
  {
2
  "__version__": {
3
  "sentence_transformers": "2.0.0",
4
+ "transformers": "4.6.0",
5
+ "pytorch": "1.7.1"
6
  }
7
  }