hexuan21 commited on
Commit
4be6147
·
verified ·
1 Parent(s): fde4000

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -4
README.md CHANGED
@@ -70,12 +70,12 @@ The best in MantisScore series is in bold and the best in baselines is underline
70
 
71
  ## Usage
72
  ### Installation
73
- ```bash
74
  git clone https://github.com/TIGER-AI-Lab/MantisScore.git
75
  ```
76
 
77
  ### Inference
78
- ```shell
79
  cd MantisScore/examples
80
  ```
81
 
@@ -83,6 +83,7 @@ cd MantisScore/examples
83
  import av
84
  import numpy as np
85
  from typing import List
 
86
  import torch
87
  from transformers import AutoProcessor
88
  from models.idefics2 import Idefics2ForSequenceClassification
@@ -128,11 +129,12 @@ For this video, the text prompt is "{text_prompt}",
128
  all the frames of video are as follows:
129
  """
130
 
 
131
  video_path="video1.mp4"
132
  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."
133
 
134
- processor = AutoProcessor.from_pretrained(f"TIGER-Lab/MantisScore",torch_dtype=torch.bfloat16)
135
- model = Idefics2ForSequenceClassification.from_pretrained(f"TIGER-Lab/MantisScore",torch_dtype=torch.bfloat16).eval()
136
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
137
  model.to(device)
138
 
 
70
 
71
  ## Usage
72
  ### Installation
73
+ ```
74
  git clone https://github.com/TIGER-AI-Lab/MantisScore.git
75
  ```
76
 
77
  ### Inference
78
+ ```
79
  cd MantisScore/examples
80
  ```
81
 
 
83
  import av
84
  import numpy as np
85
  from typing import List
86
+ from PIL import Image
87
  import torch
88
  from transformers import AutoProcessor
89
  from models.idefics2 import Idefics2ForSequenceClassification
 
129
  all the frames of video are as follows:
130
  """
131
 
132
+ model_name="TIGER-Lab/MantisScore"
133
  video_path="video1.mp4"
134
  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."
135
 
136
+ processor = AutoProcessor.from_pretrained(model_name,torch_dtype=torch.bfloat16)
137
+ model = Idefics2ForSequenceClassification.from_pretrained(model_name,torch_dtype=torch.bfloat16).eval()
138
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
139
  model.to(device)
140