Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- BEIT3/beit3.spm +3 -0
- BEIT3/beit3_base_indomain_patch16_224.pth +3 -0
- Bert/.gitattributes +11 -0
- Bert/LICENSE +201 -0
- Bert/README.md +251 -0
- Bert/config.json +23 -0
- Bert/coreml/fill-mask/float32_model.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
- Bert/coreml/fill-mask/float32_model.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
- Bert/coreml/fill-mask/float32_model.mlpackage/Manifest.json +18 -0
- Bert/pytorch_model.bin +3 -0
- Bert/tokenizer.json +0 -0
- Bert/tokenizer_config.json +1 -0
- Bert/vocab.txt +0 -0
- CLIP/ViT-B-16.pt +3 -0
- CLIP/clip-vit-base-patch16/README.md +126 -0
- CLIP/clip-vit-base-patch16/config.json +157 -0
- CLIP/clip-vit-base-patch16/gitattributes.txt +27 -0
- CLIP/clip-vit-base-patch16/merges.txt +0 -0
- CLIP/clip-vit-base-patch16/preprocessor_config.json +19 -0
- CLIP/clip-vit-base-patch16/pytorch_model.bin +3 -0
- CLIP/clip-vit-base-patch16/special_tokens_map.json +1 -0
- CLIP/clip-vit-base-patch16/tokenizer.json +0 -0
- CLIP/clip-vit-base-patch16/tokenizer_config.json +34 -0
- CLIP/clip-vit-base-patch16/vocab.json +0 -0
- CLIP/clip-vit-large-patch14/.gitattributes +28 -0
- CLIP/clip-vit-large-patch14/README.md +145 -0
- CLIP/clip-vit-large-patch14/config.json +171 -0
- CLIP/clip-vit-large-patch14/flax_model.msgpack +3 -0
- CLIP/clip-vit-large-patch14/merges.txt +0 -0
- CLIP/clip-vit-large-patch14/model.safetensors +3 -0
- CLIP/clip-vit-large-patch14/preprocessor_config.json +19 -0
- CLIP/clip-vit-large-patch14/pytorch_model.bin +3 -0
- CLIP/clip-vit-large-patch14/special_tokens_map.json +1 -0
- CLIP/clip-vit-large-patch14/tf_model.h5 +3 -0
- CLIP/clip-vit-large-patch14/tokenizer.json +0 -0
- CLIP/clip-vit-large-patch14/tokenizer_config.json +34 -0
- CLIP/clip-vit-large-patch14/vocab.json +0 -0
- CLIP/clip_b_ml_cascade_maskrcnn_model_224.pth +3 -0
- CLIP/clip_b_ml_cascade_maskrcnn_model_224_peft0111_nolora.pth +3 -0
- CLIP/clip_l_ml_cascade_maskrcnn_model_224.pth +3 -0
- CLIP/download.py +22 -0
- Detr/detr-r101.pth +3 -0
- Detr/detr-r50-mmca.pth +3 -0
- Detr/detr-r50.pth +3 -0
- HiVG/mixup_pretraining_base/mixup/best_checkpoint.pth +3 -0
- HiVG/mixup_pretraining_base/mixup/best_checkpoint_rgbt.pth +3 -0
- HiVG/mixup_pretraining_large/mixup/best_checkpoint.pth +3 -0
- HiVG/mixup_pretraining_large/mixup/best_checkpoint_rgbt.pth +3 -0
- MMVG/mixup_pretraining_base/mixup/best_checkpoint.pth +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
BEIT3/beit3.spm filter=lfs diff=lfs merge=lfs -text
|
BEIT3/beit3.spm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6f5e2fefcf793761a76a6bfb8ad35489f9c203b25557673284b6d032f41043f4
|
| 3 |
+
size 1356293
|
BEIT3/beit3_base_indomain_patch16_224.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6bd34b5c94c5eb8f887756db0ac6c65e0a8ecc8d55fb08e3099e8f55838c1818
|
| 3 |
+
size 554361985
|
Bert/.gitattributes
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
Bert/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
Bert/README.md
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- exbert
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
datasets:
|
| 7 |
+
- bookcorpus
|
| 8 |
+
- wikipedia
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# BERT base model (uncased)
|
| 12 |
+
|
| 13 |
+
Pretrained model on English language using a masked language modeling (MLM) objective. It was introduced in
|
| 14 |
+
[this paper](https://arxiv.org/abs/1810.04805) and first released in
|
| 15 |
+
[this repository](https://github.com/google-research/bert). This model is uncased: it does not make a difference
|
| 16 |
+
between english and English.
|
| 17 |
+
|
| 18 |
+
Disclaimer: The team releasing BERT did not write a model card for this model so this model card has been written by
|
| 19 |
+
the Hugging Face team.
|
| 20 |
+
|
| 21 |
+
## Model description
|
| 22 |
+
|
| 23 |
+
BERT is a transformers model pretrained on a large corpus of English data in a self-supervised fashion. This means it
|
| 24 |
+
was pretrained on the raw texts only, with no humans labeling them in any way (which is why it can use lots of
|
| 25 |
+
publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it
|
| 26 |
+
was pretrained with two objectives:
|
| 27 |
+
|
| 28 |
+
- Masked language modeling (MLM): taking a sentence, the model randomly masks 15% of the words in the input then run
|
| 29 |
+
the entire masked sentence through the model and has to predict the masked words. This is different from traditional
|
| 30 |
+
recurrent neural networks (RNNs) that usually see the words one after the other, or from autoregressive models like
|
| 31 |
+
GPT which internally masks the future tokens. It allows the model to learn a bidirectional representation of the
|
| 32 |
+
sentence.
|
| 33 |
+
- Next sentence prediction (NSP): the models concatenates two masked sentences as inputs during pretraining. Sometimes
|
| 34 |
+
they correspond to sentences that were next to each other in the original text, sometimes not. The model then has to
|
| 35 |
+
predict if the two sentences were following each other or not.
|
| 36 |
+
|
| 37 |
+
This way, the model learns an inner representation of the English language that can then be used to extract features
|
| 38 |
+
useful for downstream tasks: if you have a dataset of labeled sentences, for instance, you can train a standard
|
| 39 |
+
classifier using the features produced by the BERT model as inputs.
|
| 40 |
+
|
| 41 |
+
## Model variations
|
| 42 |
+
|
| 43 |
+
BERT has originally been released in base and large variations, for cased and uncased input text. The uncased models also strips out an accent markers.
|
| 44 |
+
Chinese and multilingual uncased and cased versions followed shortly after.
|
| 45 |
+
Modified preprocessing with whole word masking has replaced subpiece masking in a following work, with the release of two models.
|
| 46 |
+
Other 24 smaller models are released afterward.
|
| 47 |
+
|
| 48 |
+
The detailed release history can be found on the [google-research/bert readme](https://github.com/google-research/bert/blob/master/README.md) on github.
|
| 49 |
+
|
| 50 |
+
| Model | #params | Language |
|
| 51 |
+
|------------------------|--------------------------------|-------|
|
| 52 |
+
| [`bert-base-uncased`](https://huggingface.co/bert-base-uncased) | 110M | English |
|
| 53 |
+
| [`bert-large-uncased`](https://huggingface.co/bert-large-uncased) | 340M | English | sub
|
| 54 |
+
| [`bert-base-cased`](https://huggingface.co/bert-base-cased) | 110M | English |
|
| 55 |
+
| [`bert-large-cased`](https://huggingface.co/bert-large-cased) | 340M | English |
|
| 56 |
+
| [`bert-base-chinese`](https://huggingface.co/bert-base-chinese) | 110M | Chinese |
|
| 57 |
+
| [`bert-base-multilingual-cased`](https://huggingface.co/bert-base-multilingual-cased) | 110M | Multiple |
|
| 58 |
+
| [`bert-large-uncased-whole-word-masking`](https://huggingface.co/bert-large-uncased-whole-word-masking) | 340M | English |
|
| 59 |
+
| [`bert-large-cased-whole-word-masking`](https://huggingface.co/bert-large-cased-whole-word-masking) | 340M | English |
|
| 60 |
+
|
| 61 |
+
## Intended uses & limitations
|
| 62 |
+
|
| 63 |
+
You can use the raw model for either masked language modeling or next sentence prediction, but it's mostly intended to
|
| 64 |
+
be fine-tuned on a downstream task. See the [model hub](https://huggingface.co/models?filter=bert) to look for
|
| 65 |
+
fine-tuned versions of a task that interests you.
|
| 66 |
+
|
| 67 |
+
Note that this model is primarily aimed at being fine-tuned on tasks that use the whole sentence (potentially masked)
|
| 68 |
+
to make decisions, such as sequence classification, token classification or question answering. For tasks such as text
|
| 69 |
+
generation you should look at model like GPT2.
|
| 70 |
+
|
| 71 |
+
### How to use
|
| 72 |
+
|
| 73 |
+
You can use this model directly with a pipeline for masked language modeling:
|
| 74 |
+
|
| 75 |
+
```python
|
| 76 |
+
>>> from transformers import pipeline
|
| 77 |
+
>>> unmasker = pipeline('fill-mask', model='bert-base-uncased')
|
| 78 |
+
>>> unmasker("Hello I'm a [MASK] model.")
|
| 79 |
+
|
| 80 |
+
[{'sequence': "[CLS] hello i'm a fashion model. [SEP]",
|
| 81 |
+
'score': 0.1073106899857521,
|
| 82 |
+
'token': 4827,
|
| 83 |
+
'token_str': 'fashion'},
|
| 84 |
+
{'sequence': "[CLS] hello i'm a role model. [SEP]",
|
| 85 |
+
'score': 0.08774490654468536,
|
| 86 |
+
'token': 2535,
|
| 87 |
+
'token_str': 'role'},
|
| 88 |
+
{'sequence': "[CLS] hello i'm a new model. [SEP]",
|
| 89 |
+
'score': 0.05338378623127937,
|
| 90 |
+
'token': 2047,
|
| 91 |
+
'token_str': 'new'},
|
| 92 |
+
{'sequence': "[CLS] hello i'm a super model. [SEP]",
|
| 93 |
+
'score': 0.04667217284440994,
|
| 94 |
+
'token': 3565,
|
| 95 |
+
'token_str': 'super'},
|
| 96 |
+
{'sequence': "[CLS] hello i'm a fine model. [SEP]",
|
| 97 |
+
'score': 0.027095865458250046,
|
| 98 |
+
'token': 2986,
|
| 99 |
+
'token_str': 'fine'}]
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
Here is how to use this model to get the features of a given text in PyTorch:
|
| 103 |
+
|
| 104 |
+
```python
|
| 105 |
+
from transformers import BertTokenizer, BertModel
|
| 106 |
+
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
|
| 107 |
+
model = BertModel.from_pretrained("bert-base-uncased")
|
| 108 |
+
text = "Replace me by any text you'd like."
|
| 109 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
| 110 |
+
output = model(**encoded_input)
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
and in TensorFlow:
|
| 114 |
+
|
| 115 |
+
```python
|
| 116 |
+
from transformers import BertTokenizer, TFBertModel
|
| 117 |
+
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
|
| 118 |
+
model = TFBertModel.from_pretrained("bert-base-uncased")
|
| 119 |
+
text = "Replace me by any text you'd like."
|
| 120 |
+
encoded_input = tokenizer(text, return_tensors='tf')
|
| 121 |
+
output = model(encoded_input)
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
### Limitations and bias
|
| 125 |
+
|
| 126 |
+
Even if the training data used for this model could be characterized as fairly neutral, this model can have biased
|
| 127 |
+
predictions:
|
| 128 |
+
|
| 129 |
+
```python
|
| 130 |
+
>>> from transformers import pipeline
|
| 131 |
+
>>> unmasker = pipeline('fill-mask', model='bert-base-uncased')
|
| 132 |
+
>>> unmasker("The man worked as a [MASK].")
|
| 133 |
+
|
| 134 |
+
[{'sequence': '[CLS] the man worked as a carpenter. [SEP]',
|
| 135 |
+
'score': 0.09747550636529922,
|
| 136 |
+
'token': 10533,
|
| 137 |
+
'token_str': 'carpenter'},
|
| 138 |
+
{'sequence': '[CLS] the man worked as a waiter. [SEP]',
|
| 139 |
+
'score': 0.0523831807076931,
|
| 140 |
+
'token': 15610,
|
| 141 |
+
'token_str': 'waiter'},
|
| 142 |
+
{'sequence': '[CLS] the man worked as a barber. [SEP]',
|
| 143 |
+
'score': 0.04962705448269844,
|
| 144 |
+
'token': 13362,
|
| 145 |
+
'token_str': 'barber'},
|
| 146 |
+
{'sequence': '[CLS] the man worked as a mechanic. [SEP]',
|
| 147 |
+
'score': 0.03788609802722931,
|
| 148 |
+
'token': 15893,
|
| 149 |
+
'token_str': 'mechanic'},
|
| 150 |
+
{'sequence': '[CLS] the man worked as a salesman. [SEP]',
|
| 151 |
+
'score': 0.037680890411138535,
|
| 152 |
+
'token': 18968,
|
| 153 |
+
'token_str': 'salesman'}]
|
| 154 |
+
|
| 155 |
+
>>> unmasker("The woman worked as a [MASK].")
|
| 156 |
+
|
| 157 |
+
[{'sequence': '[CLS] the woman worked as a nurse. [SEP]',
|
| 158 |
+
'score': 0.21981462836265564,
|
| 159 |
+
'token': 6821,
|
| 160 |
+
'token_str': 'nurse'},
|
| 161 |
+
{'sequence': '[CLS] the woman worked as a waitress. [SEP]',
|
| 162 |
+
'score': 0.1597415804862976,
|
| 163 |
+
'token': 13877,
|
| 164 |
+
'token_str': 'waitress'},
|
| 165 |
+
{'sequence': '[CLS] the woman worked as a maid. [SEP]',
|
| 166 |
+
'score': 0.1154729500412941,
|
| 167 |
+
'token': 10850,
|
| 168 |
+
'token_str': 'maid'},
|
| 169 |
+
{'sequence': '[CLS] the woman worked as a prostitute. [SEP]',
|
| 170 |
+
'score': 0.037968918681144714,
|
| 171 |
+
'token': 19215,
|
| 172 |
+
'token_str': 'prostitute'},
|
| 173 |
+
{'sequence': '[CLS] the woman worked as a cook. [SEP]',
|
| 174 |
+
'score': 0.03042375110089779,
|
| 175 |
+
'token': 5660,
|
| 176 |
+
'token_str': 'cook'}]
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
This bias will also affect all fine-tuned versions of this model.
|
| 180 |
+
|
| 181 |
+
## Training data
|
| 182 |
+
|
| 183 |
+
The BERT model was pretrained on [BookCorpus](https://yknzhu.wixsite.com/mbweb), a dataset consisting of 11,038
|
| 184 |
+
unpublished books and [English Wikipedia](https://en.wikipedia.org/wiki/English_Wikipedia) (excluding lists, tables and
|
| 185 |
+
headers).
|
| 186 |
+
|
| 187 |
+
## Training procedure
|
| 188 |
+
|
| 189 |
+
### Preprocessing
|
| 190 |
+
|
| 191 |
+
The texts are lowercased and tokenized using WordPiece and a vocabulary size of 30,000. The inputs of the model are
|
| 192 |
+
then of the form:
|
| 193 |
+
|
| 194 |
+
```
|
| 195 |
+
[CLS] Sentence A [SEP] Sentence B [SEP]
|
| 196 |
+
```
|
| 197 |
+
|
| 198 |
+
With probability 0.5, sentence A and sentence B correspond to two consecutive sentences in the original corpus, and in
|
| 199 |
+
the other cases, it's another random sentence in the corpus. Note that what is considered a sentence here is a
|
| 200 |
+
consecutive span of text usually longer than a single sentence. The only constrain is that the result with the two
|
| 201 |
+
"sentences" has a combined length of less than 512 tokens.
|
| 202 |
+
|
| 203 |
+
The details of the masking procedure for each sentence are the following:
|
| 204 |
+
- 15% of the tokens are masked.
|
| 205 |
+
- In 80% of the cases, the masked tokens are replaced by `[MASK]`.
|
| 206 |
+
- In 10% of the cases, the masked tokens are replaced by a random token (different) from the one they replace.
|
| 207 |
+
- In the 10% remaining cases, the masked tokens are left as is.
|
| 208 |
+
|
| 209 |
+
### Pretraining
|
| 210 |
+
|
| 211 |
+
The model was trained on 4 cloud TPUs in Pod configuration (16 TPU chips total) for one million steps with a batch size
|
| 212 |
+
of 256. The sequence length was limited to 128 tokens for 90% of the steps and 512 for the remaining 10%. The optimizer
|
| 213 |
+
used is Adam with a learning rate of 1e-4, \\(\beta_{1} = 0.9\\) and \\(\beta_{2} = 0.999\\), a weight decay of 0.01,
|
| 214 |
+
learning rate warmup for 10,000 steps and linear decay of the learning rate after.
|
| 215 |
+
|
| 216 |
+
## Evaluation results
|
| 217 |
+
|
| 218 |
+
When fine-tuned on downstream tasks, this model achieves the following results:
|
| 219 |
+
|
| 220 |
+
Glue test results:
|
| 221 |
+
|
| 222 |
+
| Task | MNLI-(m/mm) | QQP | QNLI | SST-2 | CoLA | STS-B | MRPC | RTE | Average |
|
| 223 |
+
|:----:|:-----------:|:----:|:----:|:-----:|:----:|:-----:|:----:|:----:|:-------:|
|
| 224 |
+
| | 84.6/83.4 | 71.2 | 90.5 | 93.5 | 52.1 | 85.8 | 88.9 | 66.4 | 79.6 |
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
### BibTeX entry and citation info
|
| 228 |
+
|
| 229 |
+
```bibtex
|
| 230 |
+
@article{DBLP:journals/corr/abs-1810-04805,
|
| 231 |
+
author = {Jacob Devlin and
|
| 232 |
+
Ming{-}Wei Chang and
|
| 233 |
+
Kenton Lee and
|
| 234 |
+
Kristina Toutanova},
|
| 235 |
+
title = {{BERT:} Pre-training of Deep Bidirectional Transformers for Language
|
| 236 |
+
Understanding},
|
| 237 |
+
journal = {CoRR},
|
| 238 |
+
volume = {abs/1810.04805},
|
| 239 |
+
year = {2018},
|
| 240 |
+
url = {http://arxiv.org/abs/1810.04805},
|
| 241 |
+
archivePrefix = {arXiv},
|
| 242 |
+
eprint = {1810.04805},
|
| 243 |
+
timestamp = {Tue, 30 Oct 2018 20:39:56 +0100},
|
| 244 |
+
biburl = {https://dblp.org/rec/journals/corr/abs-1810-04805.bib},
|
| 245 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
| 246 |
+
}
|
| 247 |
+
```
|
| 248 |
+
|
| 249 |
+
<a href="https://huggingface.co/exbert/?model=bert-base-uncased">
|
| 250 |
+
<img width="300px" src="https://cdn-media.huggingface.co/exbert/button.png">
|
| 251 |
+
</a>
|
Bert/config.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"BertForMaskedLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.1,
|
| 6 |
+
"gradient_checkpointing": false,
|
| 7 |
+
"hidden_act": "gelu",
|
| 8 |
+
"hidden_dropout_prob": 0.1,
|
| 9 |
+
"hidden_size": 768,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"intermediate_size": 3072,
|
| 12 |
+
"layer_norm_eps": 1e-12,
|
| 13 |
+
"max_position_embeddings": 512,
|
| 14 |
+
"model_type": "bert",
|
| 15 |
+
"num_attention_heads": 12,
|
| 16 |
+
"num_hidden_layers": 12,
|
| 17 |
+
"pad_token_id": 0,
|
| 18 |
+
"position_embedding_type": "absolute",
|
| 19 |
+
"transformers_version": "4.6.0.dev0",
|
| 20 |
+
"type_vocab_size": 2,
|
| 21 |
+
"use_cache": true,
|
| 22 |
+
"vocab_size": 30522
|
| 23 |
+
}
|
Bert/coreml/fill-mask/float32_model.mlpackage/Data/com.apple.CoreML/model.mlmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:59ebda1b73ce46947d8e6be8b39f018aae7d6c4d5809537225fdaaadd940e993
|
| 3 |
+
size 164911
|
Bert/coreml/fill-mask/float32_model.mlpackage/Data/com.apple.CoreML/weights/weight.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0e6c059b4692b2c344ec3ae352b007fe0bf76713c568254ffcb521c8f832278d
|
| 3 |
+
size 134
|
Bert/coreml/fill-mask/float32_model.mlpackage/Manifest.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"fileFormatVersion": "1.0.0",
|
| 3 |
+
"itemInfoEntries": {
|
| 4 |
+
"9D749A46-ADA0-43CA-B5C2-8E722B91F41E": {
|
| 5 |
+
"author": "com.apple.CoreML",
|
| 6 |
+
"description": "CoreML Model Specification",
|
| 7 |
+
"name": "model.mlmodel",
|
| 8 |
+
"path": "com.apple.CoreML/model.mlmodel"
|
| 9 |
+
},
|
| 10 |
+
"D545B13F-2D5E-4CFB-BFF1-C10E9EFD70DA": {
|
| 11 |
+
"author": "com.apple.CoreML",
|
| 12 |
+
"description": "CoreML Model Weights",
|
| 13 |
+
"name": "weights",
|
| 14 |
+
"path": "com.apple.CoreML/weights"
|
| 15 |
+
}
|
| 16 |
+
},
|
| 17 |
+
"rootModelIdentifier": "9D749A46-ADA0-43CA-B5C2-8E722B91F41E"
|
| 18 |
+
}
|
Bert/pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:097417381d6c7230bd9e3557456d726de6e83245ec8b24f529f60198a67b203a
|
| 3 |
+
size 440473133
|
Bert/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Bert/tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"do_lower_case": true, "model_max_length": 512}
|
Bert/vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
CLIP/ViT-B-16.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5806e77cd80f8b59890b7e101eabd078d9fb84e6937f9e85e4ecb61988df416f
|
| 3 |
+
size 350837078
|
CLIP/clip-vit-base-patch16/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- vision
|
| 4 |
+
widget:
|
| 5 |
+
- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/cat-dog-music.png
|
| 6 |
+
candidate_labels: playing music, playing sports
|
| 7 |
+
example_title: Cat & Dog
|
| 8 |
+
---
|
| 9 |
+
# Model Card: CLIP
|
| 10 |
+
Disclaimer: The model card is taken and modified from the official CLIP repository, it can be found [here](https://github.com/openai/CLIP/blob/main/model-card.md).
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
## Model Details
|
| 14 |
+
The CLIP model was developed by researchers at OpenAI to learn about what contributes to robustness in computer vision tasks. The model was also developed to test the ability of models to generalize to arbitrary image classification tasks in a zero-shot manner. It was not developed for general model deployment - to deploy models like CLIP, researchers will first need to carefully study their capabilities in relation to the specific context they’re being deployed within.
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
### Model Date
|
| 18 |
+
January 2021
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
### Model Type
|
| 22 |
+
The base model uses a ViT-B/16 Transformer architecture as an image encoder and uses a masked self-attention Transformer as a text encoder. These encoders are trained to maximize the similarity of (image, text) pairs via a contrastive loss.
|
| 23 |
+
|
| 24 |
+
The original implementation had two variants: one using a ResNet image encoder and the other using a Vision Transformer. This repository has the variant with the Vision Transformer.
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
### Documents
|
| 28 |
+
- [Blog Post](https://openai.com/blog/clip/)
|
| 29 |
+
- [CLIP Paper](https://arxiv.org/abs/2103.00020)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
### Use with Transformers
|
| 33 |
+
```python3
|
| 34 |
+
from PIL import Image
|
| 35 |
+
import requests
|
| 36 |
+
from transformers import CLIPProcessor, CLIPModel
|
| 37 |
+
model = CLIPModel.from_pretrained("openai/clip-vit-base-patch16")
|
| 38 |
+
processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch16")
|
| 39 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 40 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
| 41 |
+
inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
|
| 42 |
+
outputs = model(**inputs)
|
| 43 |
+
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
|
| 44 |
+
probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
## Model Use
|
| 49 |
+
|
| 50 |
+
### Intended Use
|
| 51 |
+
The model is intended as a research output for research communities. We hope that this model will enable researchers to better understand and explore zero-shot, arbitrary image classification. We also hope it can be used for interdisciplinary studies of the potential impact of such models - the CLIP paper includes a discussion of potential downstream impacts to provide an example for this sort of analysis.
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
#### Primary intended uses
|
| 55 |
+
The primary intended users of these models are AI researchers.
|
| 56 |
+
We primarily imagine the model will be used by researchers to better understand robustness, generalization, and other capabilities, biases, and constraints of computer vision models.
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
### Out-of-Scope Use Cases
|
| 60 |
+
**Any** deployed use case of the model - whether commercial or not - is currently out of scope. Non-deployed use cases such as image search in a constrained environment, are also not recommended unless there is thorough in-domain testing of the model with a specific, fixed class taxonomy. This is because our safety assessment demonstrated a high need for task specific testing especially given the variability of CLIP’s performance with different class taxonomies. This makes untested and unconstrained deployment of the model in any use case currently potentially harmful.
|
| 61 |
+
Certain use cases which would fall under the domain of surveillance and facial recognition are always out-of-scope regardless of performance of the model. This is because the use of artificial intelligence for tasks such as these can be premature currently given the lack of testing norms and checks to ensure its fair use.
|
| 62 |
+
Since the model has not been purposefully trained in or evaluated on any languages other than English, its use should be limited to English language use cases.
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
## Data
|
| 66 |
+
The model was trained on publicly available image-caption data. This was done through a combination of crawling a handful of websites and using commonly-used pre-existing image datasets such as [YFCC100M](http://projects.dfki.uni-kl.de/yfcc100m/). A large portion of the data comes from our crawling of the internet. This means that the data is more representative of people and societies most connected to the internet which tend to skew towards more developed nations, and younger, male users.
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
### Data Mission Statement
|
| 70 |
+
Our goal with building this dataset was to test out robustness and generalizability in computer vision tasks. As a result, the focus was on gathering large quantities of data from different publicly-available internet data sources. The data was gathered in a mostly non-interventionist manner. However, we only crawled websites that had policies against excessively violent and adult images and allowed us to filter out such content. We do not intend for this dataset to be used as the basis for any commercial or deployed model and will not be releasing the dataset.
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Performance and Limitations
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
### Performance
|
| 77 |
+
We have evaluated the performance of CLIP on a wide range of benchmarks across a variety of computer vision datasets such as OCR to texture recognition to fine-grained classification. The paper describes model performance on the following datasets:
|
| 78 |
+
- Food101
|
| 79 |
+
- CIFAR10
|
| 80 |
+
- CIFAR100
|
| 81 |
+
- Birdsnap
|
| 82 |
+
- SUN397
|
| 83 |
+
- Stanford Cars
|
| 84 |
+
- FGVC Aircraft
|
| 85 |
+
- VOC2007
|
| 86 |
+
- DTD
|
| 87 |
+
- Oxford-IIIT Pet dataset
|
| 88 |
+
- Caltech101
|
| 89 |
+
- Flowers102
|
| 90 |
+
- MNIST
|
| 91 |
+
- SVHN
|
| 92 |
+
- IIIT5K
|
| 93 |
+
- Hateful Memes
|
| 94 |
+
- SST-2
|
| 95 |
+
- UCF101
|
| 96 |
+
- Kinetics700
|
| 97 |
+
- Country211
|
| 98 |
+
- CLEVR Counting
|
| 99 |
+
- KITTI Distance
|
| 100 |
+
- STL-10
|
| 101 |
+
- RareAct
|
| 102 |
+
- Flickr30
|
| 103 |
+
- MSCOCO
|
| 104 |
+
- ImageNet
|
| 105 |
+
- ImageNet-A
|
| 106 |
+
- ImageNet-R
|
| 107 |
+
- ImageNet Sketch
|
| 108 |
+
- ObjectNet (ImageNet Overlap)
|
| 109 |
+
- Youtube-BB
|
| 110 |
+
- ImageNet-Vid
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
## Limitations
|
| 114 |
+
CLIP and our analysis of it have a number of limitations. CLIP currently struggles with respect to certain tasks such as fine grained classification and counting objects. CLIP also poses issues with regards to fairness and bias which we discuss in the paper and briefly in the next section. Additionally, our approach to testing CLIP also has an important limitation- in many cases we have used linear probes to evaluate the performance of CLIP and there is evidence suggesting that linear probes can underestimate model performance.
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
### Bias and Fairness
|
| 118 |
+
We find that the performance of CLIP - and the specific biases it exhibits - can depend significantly on class design and the choices one makes for categories to include and exclude. We tested the risk of certain kinds of denigration with CLIP by classifying images of people from [Fairface](https://arxiv.org/abs/1908.04913) into crime-related and non-human animal categories. We found significant disparities with respect to race and gender. Additionally, we found that these disparities could shift based on how the classes were constructed. (Details captured in the Broader Impacts Section in the paper).
|
| 119 |
+
We also tested the performance of CLIP on gender, race and age classification using the Fairface dataset (We default to using race categories as they are constructed in the Fairface dataset.) in order to assess quality of performance across different demographics. We found accuracy >96% across all races for gender classification with ‘Middle Eastern’ having the highest accuracy (98.4%) and ‘White’ having the lowest (96.5%). Additionally, CLIP averaged ~93% for racial classification and ~63% for age classification. Our use of evaluations to test for gender, race and age classification as well as denigration harms is simply to evaluate performance of the model across people and surface potential risks and not to demonstrate an endorsement/enthusiasm for such tasks.
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
## Feedback
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
### Where to send questions or comments about the model
|
| 126 |
+
Please use [this Google Form](https://forms.gle/Uv7afRH5dvY34ZEs9)
|
CLIP/clip-vit-base-patch16/config.json
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"CLIPModel"
|
| 4 |
+
],
|
| 5 |
+
"initializer_factor": 1.0,
|
| 6 |
+
"logit_scale_init_value": 2.6592,
|
| 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 |
+
"hidden_act": "quick_gelu",
|
| 28 |
+
"hidden_size": 512,
|
| 29 |
+
"id2label": {
|
| 30 |
+
"0": "LABEL_0",
|
| 31 |
+
"1": "LABEL_1"
|
| 32 |
+
},
|
| 33 |
+
"initializer_factor": 1.0,
|
| 34 |
+
"initializer_range": 0.02,
|
| 35 |
+
"intermediate_size": 2048,
|
| 36 |
+
"is_decoder": false,
|
| 37 |
+
"is_encoder_decoder": false,
|
| 38 |
+
"label2id": {
|
| 39 |
+
"LABEL_0": 0,
|
| 40 |
+
"LABEL_1": 1
|
| 41 |
+
},
|
| 42 |
+
"layer_norm_eps": 1e-05,
|
| 43 |
+
"length_penalty": 1.0,
|
| 44 |
+
"max_length": 20,
|
| 45 |
+
"max_position_embeddings": 77,
|
| 46 |
+
"min_length": 0,
|
| 47 |
+
"model_type": "clip_text_model",
|
| 48 |
+
"no_repeat_ngram_size": 0,
|
| 49 |
+
"num_attention_heads": 8,
|
| 50 |
+
"num_beam_groups": 1,
|
| 51 |
+
"num_beams": 1,
|
| 52 |
+
"num_hidden_layers": 12,
|
| 53 |
+
"num_return_sequences": 1,
|
| 54 |
+
"output_attentions": false,
|
| 55 |
+
"output_hidden_states": false,
|
| 56 |
+
"output_scores": false,
|
| 57 |
+
"pad_token_id": 1,
|
| 58 |
+
"prefix": null,
|
| 59 |
+
"problem_type": null,
|
| 60 |
+
"projection_dim" : 512,
|
| 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 |
+
"torch_dtype": null,
|
| 75 |
+
"torchscript": false,
|
| 76 |
+
"transformers_version": "4.12.0.dev0",
|
| 77 |
+
"use_bfloat16": false,
|
| 78 |
+
"vocab_size": 49408
|
| 79 |
+
},
|
| 80 |
+
"text_config_dict": null,
|
| 81 |
+
"torch_dtype": "float32",
|
| 82 |
+
"transformers_version": null,
|
| 83 |
+
"vision_config": {
|
| 84 |
+
"_name_or_path": "",
|
| 85 |
+
"add_cross_attention": false,
|
| 86 |
+
"architectures": null,
|
| 87 |
+
"attention_dropout": 0.0,
|
| 88 |
+
"bad_words_ids": null,
|
| 89 |
+
"bos_token_id": null,
|
| 90 |
+
"chunk_size_feed_forward": 0,
|
| 91 |
+
"decoder_start_token_id": null,
|
| 92 |
+
"diversity_penalty": 0.0,
|
| 93 |
+
"do_sample": false,
|
| 94 |
+
"dropout": 0.0,
|
| 95 |
+
"early_stopping": false,
|
| 96 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 97 |
+
"eos_token_id": null,
|
| 98 |
+
"finetuning_task": null,
|
| 99 |
+
"forced_bos_token_id": null,
|
| 100 |
+
"forced_eos_token_id": null,
|
| 101 |
+
"hidden_act": "quick_gelu",
|
| 102 |
+
"hidden_size": 768,
|
| 103 |
+
"id2label": {
|
| 104 |
+
"0": "LABEL_0",
|
| 105 |
+
"1": "LABEL_1"
|
| 106 |
+
},
|
| 107 |
+
"image_size": 224,
|
| 108 |
+
"initializer_factor": 1.0,
|
| 109 |
+
"initializer_range": 0.02,
|
| 110 |
+
"intermediate_size": 3072,
|
| 111 |
+
"is_decoder": false,
|
| 112 |
+
"is_encoder_decoder": false,
|
| 113 |
+
"label2id": {
|
| 114 |
+
"LABEL_0": 0,
|
| 115 |
+
"LABEL_1": 1
|
| 116 |
+
},
|
| 117 |
+
"layer_norm_eps": 1e-05,
|
| 118 |
+
"length_penalty": 1.0,
|
| 119 |
+
"max_length": 20,
|
| 120 |
+
"min_length": 0,
|
| 121 |
+
"model_type": "clip_vision_model",
|
| 122 |
+
"no_repeat_ngram_size": 0,
|
| 123 |
+
"num_attention_heads": 12,
|
| 124 |
+
"num_beam_groups": 1,
|
| 125 |
+
"num_beams": 1,
|
| 126 |
+
"num_hidden_layers": 12,
|
| 127 |
+
"num_return_sequences": 1,
|
| 128 |
+
"output_attentions": false,
|
| 129 |
+
"output_hidden_states": false,
|
| 130 |
+
"output_scores": false,
|
| 131 |
+
"pad_token_id": null,
|
| 132 |
+
"patch_size": 16,
|
| 133 |
+
"prefix": null,
|
| 134 |
+
"problem_type": null,
|
| 135 |
+
"projection_dim" : 512,
|
| 136 |
+
"pruned_heads": {},
|
| 137 |
+
"remove_invalid_values": false,
|
| 138 |
+
"repetition_penalty": 1.0,
|
| 139 |
+
"return_dict": true,
|
| 140 |
+
"return_dict_in_generate": false,
|
| 141 |
+
"sep_token_id": null,
|
| 142 |
+
"task_specific_params": null,
|
| 143 |
+
"temperature": 1.0,
|
| 144 |
+
"tie_encoder_decoder": false,
|
| 145 |
+
"tie_word_embeddings": true,
|
| 146 |
+
"tokenizer_class": null,
|
| 147 |
+
"top_k": 50,
|
| 148 |
+
"top_p": 1.0,
|
| 149 |
+
"torch_dtype": null,
|
| 150 |
+
"torchscript": false,
|
| 151 |
+
"transformers_version": "4.12.0.dev0",
|
| 152 |
+
"use_bfloat16": false
|
| 153 |
+
},
|
| 154 |
+
"vision_config_dict": {
|
| 155 |
+
"patch_size": 16
|
| 156 |
+
}
|
| 157 |
+
}
|
CLIP/clip-vit-base-patch16/gitattributes.txt
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
CLIP/clip-vit-base-patch16/merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
CLIP/clip-vit-base-patch16/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 |
+
}
|
CLIP/clip-vit-base-patch16/pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec89c7b09c749a60aae3c9cd910516f24b58214a7df060b48962d14c469cfbf0
|
| 3 |
+
size 598641023
|
CLIP/clip-vit-base-patch16/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|>"}
|
CLIP/clip-vit-base-patch16/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
CLIP/clip-vit-base-patch16/tokenizer_config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"unk_token": {
|
| 3 |
+
"content": "<|endoftext|>",
|
| 4 |
+
"single_word": false,
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"normalized": true,
|
| 8 |
+
"__type": "AddedToken"
|
| 9 |
+
},
|
| 10 |
+
"bos_token": {
|
| 11 |
+
"content": "<|startoftext|>",
|
| 12 |
+
"single_word": false,
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"rstrip": false,
|
| 15 |
+
"normalized": true,
|
| 16 |
+
"__type": "AddedToken"
|
| 17 |
+
},
|
| 18 |
+
"eos_token": {
|
| 19 |
+
"content": "<|endoftext|>",
|
| 20 |
+
"single_word": false,
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"rstrip": false,
|
| 23 |
+
"normalized": true,
|
| 24 |
+
"__type": "AddedToken"
|
| 25 |
+
},
|
| 26 |
+
"pad_token": "<|endoftext|>",
|
| 27 |
+
"errors": "replace",
|
| 28 |
+
"add_prefix_space": false,
|
| 29 |
+
"do_lower_case": true,
|
| 30 |
+
"name_or_path": "openai/clip-vit-base-patch16",
|
| 31 |
+
"model_max_length": 77,
|
| 32 |
+
"special_tokens_map_file": "./special_tokens_map.json",
|
| 33 |
+
"tokenizer_class": "CLIPTokenizer"
|
| 34 |
+
}
|
CLIP/clip-vit-base-patch16/vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
CLIP/clip-vit-large-patch14/.gitattributes
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
CLIP/clip-vit-large-patch14/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- vision
|
| 4 |
+
widget:
|
| 5 |
+
- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/cat-dog-music.png
|
| 6 |
+
candidate_labels: playing music, playing sports
|
| 7 |
+
example_title: Cat & Dog
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Model Card: CLIP
|
| 11 |
+
|
| 12 |
+
Disclaimer: The model card is taken and modified from the official CLIP repository, it can be found [here](https://github.com/openai/CLIP/blob/main/model-card.md).
|
| 13 |
+
|
| 14 |
+
## Model Details
|
| 15 |
+
|
| 16 |
+
The CLIP model was developed by researchers at OpenAI to learn about what contributes to robustness in computer vision tasks. The model was also developed to test the ability of models to generalize to arbitrary image classification tasks in a zero-shot manner. It was not developed for general model deployment - to deploy models like CLIP, researchers will first need to carefully study their capabilities in relation to the specific context they’re being deployed within.
|
| 17 |
+
|
| 18 |
+
### Model Date
|
| 19 |
+
|
| 20 |
+
January 2021
|
| 21 |
+
|
| 22 |
+
### Model Type
|
| 23 |
+
|
| 24 |
+
The base model uses a ViT-L/14 Transformer architecture as an image encoder and uses a masked self-attention Transformer as a text encoder. These encoders are trained to maximize the similarity of (image, text) pairs via a contrastive loss.
|
| 25 |
+
|
| 26 |
+
The original implementation had two variants: one using a ResNet image encoder and the other using a Vision Transformer. This repository has the variant with the Vision Transformer.
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
### Documents
|
| 30 |
+
|
| 31 |
+
- [Blog Post](https://openai.com/blog/clip/)
|
| 32 |
+
- [CLIP Paper](https://arxiv.org/abs/2103.00020)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
### Use with Transformers
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
from PIL import Image
|
| 39 |
+
import requests
|
| 40 |
+
|
| 41 |
+
from transformers import CLIPProcessor, CLIPModel
|
| 42 |
+
|
| 43 |
+
model = CLIPModel.from_pretrained("openai/clip-vit-large-patch14")
|
| 44 |
+
processor = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14")
|
| 45 |
+
|
| 46 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 47 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
| 48 |
+
|
| 49 |
+
inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
|
| 50 |
+
|
| 51 |
+
outputs = model(**inputs)
|
| 52 |
+
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
|
| 53 |
+
probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
## Model Use
|
| 58 |
+
|
| 59 |
+
### Intended Use
|
| 60 |
+
|
| 61 |
+
The model is intended as a research output for research communities. We hope that this model will enable researchers to better understand and explore zero-shot, arbitrary image classification. We also hope it can be used for interdisciplinary studies of the potential impact of such models - the CLIP paper includes a discussion of potential downstream impacts to provide an example for this sort of analysis.
|
| 62 |
+
|
| 63 |
+
#### Primary intended uses
|
| 64 |
+
|
| 65 |
+
The primary intended users of these models are AI researchers.
|
| 66 |
+
|
| 67 |
+
We primarily imagine the model will be used by researchers to better understand robustness, generalization, and other capabilities, biases, and constraints of computer vision models.
|
| 68 |
+
|
| 69 |
+
### Out-of-Scope Use Cases
|
| 70 |
+
|
| 71 |
+
**Any** deployed use case of the model - whether commercial or not - is currently out of scope. Non-deployed use cases such as image search in a constrained environment, are also not recommended unless there is thorough in-domain testing of the model with a specific, fixed class taxonomy. This is because our safety assessment demonstrated a high need for task specific testing especially given the variability of CLIP’s performance with different class taxonomies. This makes untested and unconstrained deployment of the model in any use case currently potentially harmful.
|
| 72 |
+
|
| 73 |
+
Certain use cases which would fall under the domain of surveillance and facial recognition are always out-of-scope regardless of performance of the model. This is because the use of artificial intelligence for tasks such as these can be premature currently given the lack of testing norms and checks to ensure its fair use.
|
| 74 |
+
|
| 75 |
+
Since the model has not been purposefully trained in or evaluated on any languages other than English, its use should be limited to English language use cases.
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
## Data
|
| 80 |
+
|
| 81 |
+
The model was trained on publicly available image-caption data. This was done through a combination of crawling a handful of websites and using commonly-used pre-existing image datasets such as [YFCC100M](http://projects.dfki.uni-kl.de/yfcc100m/). A large portion of the data comes from our crawling of the internet. This means that the data is more representative of people and societies most connected to the internet which tend to skew towards more developed nations, and younger, male users.
|
| 82 |
+
|
| 83 |
+
### Data Mission Statement
|
| 84 |
+
|
| 85 |
+
Our goal with building this dataset was to test out robustness and generalizability in computer vision tasks. As a result, the focus was on gathering large quantities of data from different publicly-available internet data sources. The data was gathered in a mostly non-interventionist manner. However, we only crawled websites that had policies against excessively violent and adult images and allowed us to filter out such content. We do not intend for this dataset to be used as the basis for any commercial or deployed model and will not be releasing the dataset.
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
## Performance and Limitations
|
| 90 |
+
|
| 91 |
+
### Performance
|
| 92 |
+
|
| 93 |
+
We have evaluated the performance of CLIP on a wide range of benchmarks across a variety of computer vision datasets such as OCR to texture recognition to fine-grained classification. The paper describes model performance on the following datasets:
|
| 94 |
+
|
| 95 |
+
- Food101
|
| 96 |
+
- CIFAR10
|
| 97 |
+
- CIFAR100
|
| 98 |
+
- Birdsnap
|
| 99 |
+
- SUN397
|
| 100 |
+
- Stanford Cars
|
| 101 |
+
- FGVC Aircraft
|
| 102 |
+
- VOC2007
|
| 103 |
+
- DTD
|
| 104 |
+
- Oxford-IIIT Pet dataset
|
| 105 |
+
- Caltech101
|
| 106 |
+
- Flowers102
|
| 107 |
+
- MNIST
|
| 108 |
+
- SVHN
|
| 109 |
+
- IIIT5K
|
| 110 |
+
- Hateful Memes
|
| 111 |
+
- SST-2
|
| 112 |
+
- UCF101
|
| 113 |
+
- Kinetics700
|
| 114 |
+
- Country211
|
| 115 |
+
- CLEVR Counting
|
| 116 |
+
- KITTI Distance
|
| 117 |
+
- STL-10
|
| 118 |
+
- RareAct
|
| 119 |
+
- Flickr30
|
| 120 |
+
- MSCOCO
|
| 121 |
+
- ImageNet
|
| 122 |
+
- ImageNet-A
|
| 123 |
+
- ImageNet-R
|
| 124 |
+
- ImageNet Sketch
|
| 125 |
+
- ObjectNet (ImageNet Overlap)
|
| 126 |
+
- Youtube-BB
|
| 127 |
+
- ImageNet-Vid
|
| 128 |
+
|
| 129 |
+
## Limitations
|
| 130 |
+
|
| 131 |
+
CLIP and our analysis of it have a number of limitations. CLIP currently struggles with respect to certain tasks such as fine grained classification and counting objects. CLIP also poses issues with regards to fairness and bias which we discuss in the paper and briefly in the next section. Additionally, our approach to testing CLIP also has an important limitation- in many cases we have used linear probes to evaluate the performance of CLIP and there is evidence suggesting that linear probes can underestimate model performance.
|
| 132 |
+
|
| 133 |
+
### Bias and Fairness
|
| 134 |
+
|
| 135 |
+
We find that the performance of CLIP - and the specific biases it exhibits - can depend significantly on class design and the choices one makes for categories to include and exclude. We tested the risk of certain kinds of denigration with CLIP by classifying images of people from [Fairface](https://arxiv.org/abs/1908.04913) into crime-related and non-human animal categories. We found significant disparities with respect to race and gender. Additionally, we found that these disparities could shift based on how the classes were constructed. (Details captured in the Broader Impacts Section in the paper).
|
| 136 |
+
|
| 137 |
+
We also tested the performance of CLIP on gender, race and age classification using the Fairface dataset (We default to using race categories as they are constructed in the Fairface dataset.) in order to assess quality of performance across different demographics. We found accuracy >96% across all races for gender classification with ‘Middle Eastern’ having the highest accuracy (98.4%) and ‘White’ having the lowest (96.5%). Additionally, CLIP averaged ~93% for racial classification and ~63% for age classification. Our use of evaluations to test for gender, race and age classification as well as denigration harms is simply to evaluate performance of the model across people and surface potential risks and not to demonstrate an endorsement/enthusiasm for such tasks.
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
## Feedback
|
| 142 |
+
|
| 143 |
+
### Where to send questions or comments about the model
|
| 144 |
+
|
| 145 |
+
Please use [this Google Form](https://forms.gle/Uv7afRH5dvY34ZEs9)
|
CLIP/clip-vit-large-patch14/config.json
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "clip-vit-large-patch14/",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"CLIPModel"
|
| 5 |
+
],
|
| 6 |
+
"initializer_factor": 1.0,
|
| 7 |
+
"logit_scale_init_value": 2.6592,
|
| 8 |
+
"model_type": "clip",
|
| 9 |
+
"projection_dim": 768,
|
| 10 |
+
"text_config": {
|
| 11 |
+
"_name_or_path": "",
|
| 12 |
+
"add_cross_attention": false,
|
| 13 |
+
"architectures": null,
|
| 14 |
+
"attention_dropout": 0.0,
|
| 15 |
+
"bad_words_ids": null,
|
| 16 |
+
"bos_token_id": 0,
|
| 17 |
+
"chunk_size_feed_forward": 0,
|
| 18 |
+
"cross_attention_hidden_size": null,
|
| 19 |
+
"decoder_start_token_id": null,
|
| 20 |
+
"diversity_penalty": 0.0,
|
| 21 |
+
"do_sample": false,
|
| 22 |
+
"dropout": 0.0,
|
| 23 |
+
"early_stopping": false,
|
| 24 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 25 |
+
"eos_token_id": 2,
|
| 26 |
+
"finetuning_task": null,
|
| 27 |
+
"forced_bos_token_id": null,
|
| 28 |
+
"forced_eos_token_id": null,
|
| 29 |
+
"hidden_act": "quick_gelu",
|
| 30 |
+
"hidden_size": 768,
|
| 31 |
+
"id2label": {
|
| 32 |
+
"0": "LABEL_0",
|
| 33 |
+
"1": "LABEL_1"
|
| 34 |
+
},
|
| 35 |
+
"initializer_factor": 1.0,
|
| 36 |
+
"initializer_range": 0.02,
|
| 37 |
+
"intermediate_size": 3072,
|
| 38 |
+
"is_decoder": false,
|
| 39 |
+
"is_encoder_decoder": false,
|
| 40 |
+
"label2id": {
|
| 41 |
+
"LABEL_0": 0,
|
| 42 |
+
"LABEL_1": 1
|
| 43 |
+
},
|
| 44 |
+
"layer_norm_eps": 1e-05,
|
| 45 |
+
"length_penalty": 1.0,
|
| 46 |
+
"max_length": 20,
|
| 47 |
+
"max_position_embeddings": 77,
|
| 48 |
+
"min_length": 0,
|
| 49 |
+
"model_type": "clip_text_model",
|
| 50 |
+
"no_repeat_ngram_size": 0,
|
| 51 |
+
"num_attention_heads": 12,
|
| 52 |
+
"num_beam_groups": 1,
|
| 53 |
+
"num_beams": 1,
|
| 54 |
+
"num_hidden_layers": 12,
|
| 55 |
+
"num_return_sequences": 1,
|
| 56 |
+
"output_attentions": false,
|
| 57 |
+
"output_hidden_states": false,
|
| 58 |
+
"output_scores": false,
|
| 59 |
+
"pad_token_id": 1,
|
| 60 |
+
"prefix": null,
|
| 61 |
+
"problem_type": null,
|
| 62 |
+
"projection_dim" : 768,
|
| 63 |
+
"pruned_heads": {},
|
| 64 |
+
"remove_invalid_values": false,
|
| 65 |
+
"repetition_penalty": 1.0,
|
| 66 |
+
"return_dict": true,
|
| 67 |
+
"return_dict_in_generate": false,
|
| 68 |
+
"sep_token_id": null,
|
| 69 |
+
"task_specific_params": null,
|
| 70 |
+
"temperature": 1.0,
|
| 71 |
+
"tie_encoder_decoder": false,
|
| 72 |
+
"tie_word_embeddings": true,
|
| 73 |
+
"tokenizer_class": null,
|
| 74 |
+
"top_k": 50,
|
| 75 |
+
"top_p": 1.0,
|
| 76 |
+
"torch_dtype": null,
|
| 77 |
+
"torchscript": false,
|
| 78 |
+
"transformers_version": "4.16.0.dev0",
|
| 79 |
+
"use_bfloat16": false,
|
| 80 |
+
"vocab_size": 49408
|
| 81 |
+
},
|
| 82 |
+
"text_config_dict": {
|
| 83 |
+
"hidden_size": 768,
|
| 84 |
+
"intermediate_size": 3072,
|
| 85 |
+
"num_attention_heads": 12,
|
| 86 |
+
"num_hidden_layers": 12,
|
| 87 |
+
"projection_dim": 768
|
| 88 |
+
},
|
| 89 |
+
"torch_dtype": "float32",
|
| 90 |
+
"transformers_version": null,
|
| 91 |
+
"vision_config": {
|
| 92 |
+
"_name_or_path": "",
|
| 93 |
+
"add_cross_attention": false,
|
| 94 |
+
"architectures": null,
|
| 95 |
+
"attention_dropout": 0.0,
|
| 96 |
+
"bad_words_ids": null,
|
| 97 |
+
"bos_token_id": null,
|
| 98 |
+
"chunk_size_feed_forward": 0,
|
| 99 |
+
"cross_attention_hidden_size": null,
|
| 100 |
+
"decoder_start_token_id": null,
|
| 101 |
+
"diversity_penalty": 0.0,
|
| 102 |
+
"do_sample": false,
|
| 103 |
+
"dropout": 0.0,
|
| 104 |
+
"early_stopping": false,
|
| 105 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 106 |
+
"eos_token_id": null,
|
| 107 |
+
"finetuning_task": null,
|
| 108 |
+
"forced_bos_token_id": null,
|
| 109 |
+
"forced_eos_token_id": null,
|
| 110 |
+
"hidden_act": "quick_gelu",
|
| 111 |
+
"hidden_size": 1024,
|
| 112 |
+
"id2label": {
|
| 113 |
+
"0": "LABEL_0",
|
| 114 |
+
"1": "LABEL_1"
|
| 115 |
+
},
|
| 116 |
+
"image_size": 224,
|
| 117 |
+
"initializer_factor": 1.0,
|
| 118 |
+
"initializer_range": 0.02,
|
| 119 |
+
"intermediate_size": 4096,
|
| 120 |
+
"is_decoder": false,
|
| 121 |
+
"is_encoder_decoder": false,
|
| 122 |
+
"label2id": {
|
| 123 |
+
"LABEL_0": 0,
|
| 124 |
+
"LABEL_1": 1
|
| 125 |
+
},
|
| 126 |
+
"layer_norm_eps": 1e-05,
|
| 127 |
+
"length_penalty": 1.0,
|
| 128 |
+
"max_length": 20,
|
| 129 |
+
"min_length": 0,
|
| 130 |
+
"model_type": "clip_vision_model",
|
| 131 |
+
"no_repeat_ngram_size": 0,
|
| 132 |
+
"num_attention_heads": 16,
|
| 133 |
+
"num_beam_groups": 1,
|
| 134 |
+
"num_beams": 1,
|
| 135 |
+
"num_hidden_layers": 24,
|
| 136 |
+
"num_return_sequences": 1,
|
| 137 |
+
"output_attentions": false,
|
| 138 |
+
"output_hidden_states": false,
|
| 139 |
+
"output_scores": false,
|
| 140 |
+
"pad_token_id": null,
|
| 141 |
+
"patch_size": 14,
|
| 142 |
+
"prefix": null,
|
| 143 |
+
"problem_type": null,
|
| 144 |
+
"projection_dim" : 768,
|
| 145 |
+
"pruned_heads": {},
|
| 146 |
+
"remove_invalid_values": false,
|
| 147 |
+
"repetition_penalty": 1.0,
|
| 148 |
+
"return_dict": true,
|
| 149 |
+
"return_dict_in_generate": false,
|
| 150 |
+
"sep_token_id": null,
|
| 151 |
+
"task_specific_params": null,
|
| 152 |
+
"temperature": 1.0,
|
| 153 |
+
"tie_encoder_decoder": false,
|
| 154 |
+
"tie_word_embeddings": true,
|
| 155 |
+
"tokenizer_class": null,
|
| 156 |
+
"top_k": 50,
|
| 157 |
+
"top_p": 1.0,
|
| 158 |
+
"torch_dtype": null,
|
| 159 |
+
"torchscript": false,
|
| 160 |
+
"transformers_version": "4.16.0.dev0",
|
| 161 |
+
"use_bfloat16": false
|
| 162 |
+
},
|
| 163 |
+
"vision_config_dict": {
|
| 164 |
+
"hidden_size": 1024,
|
| 165 |
+
"intermediate_size": 4096,
|
| 166 |
+
"num_attention_heads": 16,
|
| 167 |
+
"num_hidden_layers": 24,
|
| 168 |
+
"patch_size": 14,
|
| 169 |
+
"projection_dim": 768
|
| 170 |
+
}
|
| 171 |
+
}
|
CLIP/clip-vit-large-patch14/flax_model.msgpack
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:156f677ed4495acd1ec7197249c091b85c240267c82f2f7f2e4eae4177931fed
|
| 3 |
+
size 1710486359
|
CLIP/clip-vit-large-patch14/merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
CLIP/clip-vit-large-patch14/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a2bf730a0c7debf160f7a6b50b3aaf3703e7e88ac73de7a314903141db026dcb
|
| 3 |
+
size 1710540580
|
CLIP/clip-vit-large-patch14/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 |
+
}
|
CLIP/clip-vit-large-patch14/pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f1a17cdbe0f36fec524f5cafb1c261ea3bbbc13e346e0f74fc9eb0460dedd0d3
|
| 3 |
+
size 1710671599
|
CLIP/clip-vit-large-patch14/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|>"}
|
CLIP/clip-vit-large-patch14/tf_model.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f154e925c18270d662d28f6261523c2ff6e80f1f05292cb034db41d5951c7a4
|
| 3 |
+
size 1711114176
|
CLIP/clip-vit-large-patch14/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
CLIP/clip-vit-large-patch14/tokenizer_config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"unk_token": {
|
| 3 |
+
"content": "<|endoftext|>",
|
| 4 |
+
"single_word": false,
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"normalized": true,
|
| 8 |
+
"__type": "AddedToken"
|
| 9 |
+
},
|
| 10 |
+
"bos_token": {
|
| 11 |
+
"content": "<|startoftext|>",
|
| 12 |
+
"single_word": false,
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"rstrip": false,
|
| 15 |
+
"normalized": true,
|
| 16 |
+
"__type": "AddedToken"
|
| 17 |
+
},
|
| 18 |
+
"eos_token": {
|
| 19 |
+
"content": "<|endoftext|>",
|
| 20 |
+
"single_word": false,
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"rstrip": false,
|
| 23 |
+
"normalized": true,
|
| 24 |
+
"__type": "AddedToken"
|
| 25 |
+
},
|
| 26 |
+
"pad_token": "<|endoftext|>",
|
| 27 |
+
"add_prefix_space": false,
|
| 28 |
+
"errors": "replace",
|
| 29 |
+
"do_lower_case": true,
|
| 30 |
+
"name_or_path": "openai/clip-vit-base-patch32",
|
| 31 |
+
"model_max_length": 77,
|
| 32 |
+
"special_tokens_map_file": "./special_tokens_map.json",
|
| 33 |
+
"tokenizer_class": "CLIPTokenizer"
|
| 34 |
+
}
|
CLIP/clip-vit-large-patch14/vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
CLIP/clip_b_ml_cascade_maskrcnn_model_224.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6a190b4a5d53c7a529b33fa547a7f312a445d8598fbefe043f9e6ea01d75fd7f
|
| 3 |
+
size 614529249
|
CLIP/clip_b_ml_cascade_maskrcnn_model_224_peft0111_nolora.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d74108dd34f3daed9156091af978260d29acada0de2d054471539a4cd92209fc
|
| 3 |
+
size 598647702
|
CLIP/clip_l_ml_cascade_maskrcnn_model_224.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6c8ac60c87b2532695c1d68059c31abf449a5ad753600a6450b5366766b463b0
|
| 3 |
+
size 1745543585
|
CLIP/download.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import snapshot_download
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
# 保存目录
|
| 5 |
+
local_dir = "./clip-vit-large-patch14"
|
| 6 |
+
os.makedirs(local_dir, exist_ok=True)
|
| 7 |
+
|
| 8 |
+
# 设置镜像源
|
| 9 |
+
# 国内可用 Hugging Face 镜像: https://huggingface.co 通过代理或镜像
|
| 10 |
+
# 下面用官方示例 HF_ENDPOINT 替换成国内镜像即可
|
| 11 |
+
os.environ["HF_HOME"] = local_dir # 缓存目录
|
| 12 |
+
os.environ["HF_HUB_OFFLINE"] = "0"
|
| 13 |
+
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
| 14 |
+
os.environ["HF_ENDPOINT"] = "https://mirror-hf.tuna.tsinghua.edu.cn"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# 下载模型
|
| 18 |
+
snapshot_download(
|
| 19 |
+
repo_id="openai/clip-vit-large-patch14",
|
| 20 |
+
local_dir=local_dir,
|
| 21 |
+
resume_download=True, # 支持断点续传
|
| 22 |
+
)
|
Detr/detr-r101.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2c7b67e52d2e687cefa3c4a5e701a148664159c96725c62984600d2d9d5c4104
|
| 3 |
+
size 242846568
|
Detr/detr-r50-mmca.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b08f08a6881a0cf9466d77bdc16a5c81dd6fffa50d9286b748a65a0bd9a107fd
|
| 3 |
+
size 128023578
|
Detr/detr-r50.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e632da11ec76ae67bac2f8579fbed3724e08dead7d200ca13e019b197784eadc
|
| 3 |
+
size 166618694
|
HiVG/mixup_pretraining_base/mixup/best_checkpoint.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e04e283eccb5ec465c936def6f8b73ec526983328e655e31e6c866e1ae68482
|
| 3 |
+
size 1345333118
|
HiVG/mixup_pretraining_base/mixup/best_checkpoint_rgbt.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8d022b7236416576fd076de15981a65b5f6474c89102f7e0d38dde4897be8b47
|
| 3 |
+
size 1345721358
|
HiVG/mixup_pretraining_large/mixup/best_checkpoint.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:63c63126c76ffb77ccc016bd88ed4d2050b27c0463580791b50ef766e06588bc
|
| 3 |
+
size 3050037212
|
HiVG/mixup_pretraining_large/mixup/best_checkpoint_rgbt.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d7204fb92df2811d80c6573d7bc603ce55280fffee5a8a8ec99dfa673a6df5c9
|
| 3 |
+
size 3050806502
|
MMVG/mixup_pretraining_base/mixup/best_checkpoint.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e04e283eccb5ec465c936def6f8b73ec526983328e655e31e6c866e1ae68482
|
| 3 |
+
size 1345333118
|