DongfuJiang commited on
Commit
ebd686a
1 Parent(s): 21d8a5d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +164 -194
README.md CHANGED
@@ -3,197 +3,167 @@ library_name: transformers
3
  tags: []
4
  ---
5
 
6
- # Model Card for Model ID
7
-
8
- <!-- Provide a quick summary of what the model is/does. -->
9
-
10
-
11
-
12
- ## Model Details
13
-
14
- ### Model Description
15
-
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [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
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset 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. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
-
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- 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).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
-
195
- [More Information Needed]
196
-
197
- ## Model Card Contact
198
-
199
- [More Information Needed]
 
3
  tags: []
4
  ---
5
 
6
+ [📃Paper](https://arxiv.org/abs/2406.15252) | [🌐Website](https://tiger-ai-lab.github.io/VideoScore/) | [💻Github](https://github.com/TIGER-AI-Lab/VideoScore) | [🛢️Datasets](https://huggingface.co/datasets/TIGER-Lab/VideoFeedback) | [🤗Model](https://huggingface.co/TIGER-Lab/VideoScore) | [🤗Demo](https://huggingface.co/spaces/TIGER-Lab/VideoScore) | [📉Wandb](https://api.wandb.ai/links/xuanhe/ptohlfcx)
7
+
8
+
9
+ ![VideoScore](https://tiger-ai-lab.github.io/VideoScore/static/images/teaser.png)
10
+
11
+ ## Introduction
12
+ - VideoScore is a video quality evaluation model, taking [Mantis-8B-Idefics2](https://huggingface.co/TIGER-Lab/Mantis-8B-Idefics2) as base-model
13
+ and trained on [VideoFeedback](https://huggingface.co/datasets/TIGER-Lab/VideoFeedback),
14
+ a large video evaluation dataset with multi-aspect human scores.
15
+
16
+ - VideoScore can reach 75+ Spearman correlation with humans on VideoEval-test, surpassing all the MLLM-prompting methods and feature-based metrics.
17
+
18
+ - VideoScore also beat the best baselines on other three benchmarks EvalCrafter, GenAI-Bench and VBench, showing high alignment with human evaluations.
19
+
20
+ - **This is the regression version of VideoScore**
21
+
22
+ ## Evaluation Results
23
+
24
+ We test our video evaluation model VideoScore on VideoEval-test, EvalCrafter, GenAI-Bench and VBench.
25
+ For the first two benchmarks, we take Spearman corrleation between model's output and human ratings
26
+ averaged among all the evaluation aspects as indicator.
27
+ For GenAI-Bench and VBench, which include human preference data among two or more videos,
28
+ we employ the model's output to predict preferences and use pairwise accuracy as the performance indicator.
29
+
30
+ - We use [VideoScore](https://huggingface.co/TIGER-Lab/VideoScore) trained on the entire VideoFeedback dataset
31
+ for VideoFeedback-test set, while for other three benchmarks.
32
+
33
+ - We use [VideoScore-anno-only](https://huggingface.co/TIGER-Lab/VideoScore-anno-only) trained on VideoFeedback dataset
34
+ excluding the real videos.
35
+
36
+ The evaluation results are coming soon
37
+
38
+ ## Usage
39
+ ### Installation
40
+ ```
41
+ pip install git+https://github.com/TIGER-AI-Lab/VideoScore.git
42
+ # or
43
+ # pip install mantis-vl
44
+ ```
45
+
46
+ ### Inference
47
+ ```
48
+ cd VideoScore/examples
49
+ ```
50
+
51
+ ```python
52
+ """
53
+ pip install qwen_vl_utils mantis-vl
54
+ """
55
+ import torch
56
+ from mantis.models.qwen2_vl import Qwen2VLForSequenceClassification
57
+ from transformers import Qwen2VLProcessor
58
+ from qwen_vl_utils import process_vision_info
59
+
60
+ MAX_NUM_FRAMES=16
61
+ ROUND_DIGIT=3
62
+ REGRESSION_QUERY_PROMPT = """
63
+ Suppose you are an expert in judging and evaluating the quality of AI-generated videos,
64
+ please watch the following frames of a given video and see the text prompt for generating the video,
65
+ then give scores from 5 different dimensions:
66
+ (1) visual quality: the quality of the video in terms of clearness, resolution, brightness, and color
67
+ (2) temporal consistency, both the consistency of objects or humans and the smoothness of motion or movements
68
+ (3) dynamic degree, the degree of dynamic changes
69
+ (4) text-to-video alignment, the alignment between the text prompt and the video content
70
+ (5) factual consistency, the consistency of the video content with the common-sense and factual knowledge
71
+
72
+ for each dimension, output a float number from 1.0 to 4.0,
73
+ the higher the number is, the better the video performs in that sub-score,
74
+ the lowest 1.0 means Bad, the highest 4.0 means Perfect/Real (the video is like a real video)
75
+ Here is an output example:
76
+ visual quality: 3.2
77
+ temporal consistency: 2.7
78
+ dynamic degree: 4.0
79
+ text-to-video alignment: 2.3
80
+ factual consistency: 1.8
81
+
82
+ For this video, the text prompt is "{text_prompt}",
83
+ all the frames of video are as follows:
84
+ """
85
+
86
+ model_name="Mantis-VL/qwen2-vl-video-eval-debug_12288_regression"
87
+ video_path="video1.mp4"
88
+ video_prompt="Near the Elephant Gate village, they approach the haunted house at night. Rajiv feels anxious, but Bhavesh encourages him. As they reach the house, a mysterious sound in the air adds to the suspense."
89
+
90
+ # default: Load the model on the available device(s)
91
+ model = Qwen2VLForSequenceClassification.from_pretrained(
92
+ model_name, torch_dtype="auto", device_map="auto", attn_implementation="flash_attention_2"
93
+ )
94
+
95
+ # default processer
96
+ processor = Qwen2VLProcessor.from_pretrained(model_name)
97
+
98
+
99
+ model.push_to_hub("TIGER-Lab/VideoScore-Qwen2-VL")
100
+ processor.push_to_hub("TIGER-Lab/VideoScore-Qwen2-VL")
101
+ exit(1)
102
+
103
+ # Messages containing a images list as a video and a text query
104
+ messages = [
105
+ {
106
+ "role": "user",
107
+ "content": [
108
+ {
109
+ "type": "video",
110
+ "video": video_path,
111
+ "fps": 8.0,
112
+ },
113
+ {"type": "text", "text": REGRESSION_QUERY_PROMPT.format(text_prompt=video_prompt)},
114
+ ],
115
+ }
116
+ ]
117
+
118
+ # Preparation for inference
119
+ text = processor.apply_chat_template(
120
+ messages, tokenize=False, add_generation_prompt=True
121
+ )
122
+ image_inputs, video_inputs = process_vision_info(messages)
123
+ inputs = processor(
124
+ text=[text],
125
+ images=image_inputs,
126
+ videos=video_inputs,
127
+ padding=True,
128
+ return_tensors="pt",
129
+ )
130
+ inputs = inputs.to("cuda")
131
+ print(inputs['input_ids'].shape)
132
+
133
+ # Inference
134
+ with torch.no_grad():
135
+ outputs = model(**inputs)
136
+
137
+ logits = outputs.logits
138
+ num_aspects = logits.shape[-1]
139
+
140
+ aspect_scores = []
141
+ for i in range(num_aspects):
142
+ aspect_scores.append(round(logits[0, i].item(),ROUND_DIGIT))
143
+ print(aspect_scores)
144
+
145
+ """
146
+ model output on visual quality, temporal consistency, dynamic degree,
147
+ text-to-video alignment, factual consistency, respectively
148
+
149
+ [3.578, 3.594, 3.703, 3.156, 3.688]
150
+ """
151
+ ```
152
+
153
+ ### Training
154
+ see [VideoScore/training](https://github.com/TIGER-AI-Lab/VideoScore/tree/main/training) for details
155
+
156
+ ### Evaluation
157
+ see [VideoScore/benchmark](https://github.com/TIGER-AI-Lab/VideoScore/tree/main/benchmark) for details
158
+
159
+ ## Citation
160
+ ```bibtex
161
+ @article{he2024videoscore,
162
+ title = {VideoScore: Building Automatic Metrics to Simulate Fine-grained Human Feedback for Video Generation},
163
+ author = {He, Xuan and Jiang, Dongfu and Zhang, Ge and Ku, Max and Soni, Achint and Siu, Sherman and Chen, Haonan and Chandra, Abhranil and Jiang, Ziyan and Arulraj, Aaran and Wang, Kai and Do, Quy Duc and Ni, Yuansheng and Lyu, Bohan and Narsupalli, Yaswanth and Fan, Rongqi and Lyu, Zhiheng and Lin, Yuchen and Chen, Wenhu},
164
+ journal = {ArXiv},
165
+ year = {2024},
166
+ volume={abs/2406.15252},
167
+ url = {https://arxiv.org/abs/2406.15252},
168
+ }
169
+ ```