Diangle commited on
Commit
b88cf0f
1 Parent(s): 60dd621

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +227 -0
README.md ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ # For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
3
+ # Doc / guide: https://huggingface.co/docs/hub/model-cards
4
+ {}
5
+ ---
6
+
7
+ # Model Card for Model ID
8
+
9
+ This is a trained Clip4Clip model to search videos from a text sentence
10
+
11
+ This modelcard aims to be a base template for new models. It has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md?plain=1).
12
+
13
+ ## Model Details
14
+
15
+ ### Model Description
16
+
17
+ <!-- Provide a longer summary of what this model is. -->
18
+
19
+
20
+
21
+ - **Developed by:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Use
37
+ To encode text:
38
+
39
+ ```python
40
+ import torch
41
+ import numpy as np
42
+ from transformers import AutoTokenizer, CLIPTextModelWithProjection
43
+
44
+ search_sentence = "a woman drinking coffee looking at the sea"
45
+
46
+ my_model = CLIPTextModelWithProjection.from_pretrained("Diangle/clip4clip-webvid")
47
+ tokenizer = AutoTokenizer.from_pretrained("Diangle/clip4clip-webvid")
48
+
49
+
50
+ inputs = tokenizer(text=search_sentence , return_tensors="pt", padding=True)
51
+
52
+ outputs = my_model(input_ids=inputs["input_ids"], attention_mask=inputs["attention_mask"], return_dict=False)
53
+
54
+ text_projection = my_model.state_dict()['text_projection.weight']
55
+ text_embeds = outputs[1] @ text_projection
56
+ final_output = text_embeds[torch.arange(text_embeds.shape[0]), inputs["input_ids"].argmax(dim=-1)]
57
+
58
+
59
+ final_output = final_output / final_output.norm(dim=-1, keepdim=True)
60
+ final_output = final_output.cpu().detach().numpy()
61
+ sequence_output = final_output / np.sum(final_output**2, axis=1, keepdims=True)
62
+ print(sequence_output)
63
+ ```
64
+
65
+
66
+ ### Direct Use
67
+
68
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
69
+
70
+ [More Information Needed]
71
+
72
+ ### Downstream Use [optional]
73
+
74
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
75
+
76
+ [More Information Needed]
77
+
78
+ ### Out-of-Scope Use
79
+
80
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ## Bias, Risks, and Limitations
85
+
86
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
87
+
88
+ [More Information Needed]
89
+
90
+ ### Recommendations
91
+
92
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
93
+
94
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
95
+
96
+ ## How to Get Started with the Model
97
+
98
+ Use the code below to get started with the model.
99
+
100
+ [More Information Needed]
101
+
102
+ ## Training Details
103
+
104
+ ### Training Data
105
+
106
+ <!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
107
+
108
+ [More Information Needed]
109
+
110
+ ### Training Procedure
111
+
112
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
113
+
114
+ #### Preprocessing [optional]
115
+
116
+ [More Information Needed]
117
+
118
+
119
+ #### Training Hyperparameters
120
+
121
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
122
+
123
+ #### Speeds, Sizes, Times [optional]
124
+
125
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
126
+
127
+ [More Information Needed]
128
+
129
+ ## Evaluation
130
+
131
+ <!-- This section describes the evaluation protocols and provides the results. -->
132
+
133
+ ### Testing Data, Factors & Metrics
134
+
135
+ #### Testing Data
136
+
137
+ <!-- This should link to a Data Card if possible. -->
138
+
139
+ [More Information Needed]
140
+
141
+ #### Factors
142
+
143
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
144
+
145
+ [More Information Needed]
146
+
147
+ #### Metrics
148
+
149
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
150
+
151
+ [More Information Needed]
152
+
153
+ ### Results
154
+
155
+ [More Information Needed]
156
+
157
+ #### Summary
158
+
159
+
160
+
161
+ ## Model Examination [optional]
162
+
163
+ <!-- Relevant interpretability work for the model goes here -->
164
+
165
+ [More Information Needed]
166
+
167
+ ## Environmental Impact
168
+
169
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
170
+
171
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
172
+
173
+ - **Hardware Type:** [More Information Needed]
174
+ - **Hours used:** [More Information Needed]
175
+ - **Cloud Provider:** [More Information Needed]
176
+ - **Compute Region:** [More Information Needed]
177
+ - **Carbon Emitted:** [More Information Needed]
178
+
179
+ ## Technical Specifications [optional]
180
+
181
+ ### Model Architecture and Objective
182
+
183
+ [More Information Needed]
184
+
185
+ ### Compute Infrastructure
186
+
187
+ [More Information Needed]
188
+
189
+ #### Hardware
190
+
191
+ [More Information Needed]
192
+
193
+ #### Software
194
+
195
+ [More Information Needed]
196
+
197
+ ## Citation [optional]
198
+
199
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
200
+
201
+ **BibTeX:**
202
+
203
+ [More Information Needed]
204
+
205
+ **APA:**
206
+
207
+ [More Information Needed]
208
+
209
+ ## Glossary [optional]
210
+
211
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
212
+
213
+ [More Information Needed]
214
+
215
+ ## More Information [optional]
216
+
217
+ [More Information Needed]
218
+
219
+ ## Model Card Authors [optional]
220
+
221
+ [More Information Needed]
222
+
223
+ ## Model Card Contact
224
+
225
+ [More Information Needed]
226
+
227
+