Spaces:
Running
on
Zero
Running
on
Zero
improve duration.
Browse files
app.py
CHANGED
@@ -80,7 +80,6 @@ class Chat:
|
|
80 |
return state
|
81 |
|
82 |
@torch.inference_mode()
|
83 |
-
@spaces.GPU
|
84 |
def generate(self, tensor: list, modals: list, prompt: str, first_run: bool, state):
|
85 |
# TODO: support multiple turns of conversation.
|
86 |
assert len(tensor) == len(modals)
|
@@ -131,6 +130,7 @@ def save_video_to_local(video_path):
|
|
131 |
return filename
|
132 |
|
133 |
|
|
|
134 |
def generate(image, video, first_run, state, state_, textbox_in, tensor, modals, dtype=torch.float16):
|
135 |
flag = 1
|
136 |
if not textbox_in:
|
@@ -220,7 +220,7 @@ if __name__ == '__main__':
|
|
220 |
conv_mode = "llama_2"
|
221 |
model_path = 'DAMO-NLP-SG/VideoLLaMA2-7B'
|
222 |
|
223 |
-
handler = Chat(model_path, conv_mode=conv_mode, load_8bit=
|
224 |
handler.model.to(dtype=torch.float16)
|
225 |
|
226 |
if not os.path.exists("temp"):
|
|
|
80 |
return state
|
81 |
|
82 |
@torch.inference_mode()
|
|
|
83 |
def generate(self, tensor: list, modals: list, prompt: str, first_run: bool, state):
|
84 |
# TODO: support multiple turns of conversation.
|
85 |
assert len(tensor) == len(modals)
|
|
|
130 |
return filename
|
131 |
|
132 |
|
133 |
+
@spaces.GPU(duration=120)
|
134 |
def generate(image, video, first_run, state, state_, textbox_in, tensor, modals, dtype=torch.float16):
|
135 |
flag = 1
|
136 |
if not textbox_in:
|
|
|
220 |
conv_mode = "llama_2"
|
221 |
model_path = 'DAMO-NLP-SG/VideoLLaMA2-7B'
|
222 |
|
223 |
+
handler = Chat(model_path, conv_mode=conv_mode, load_8bit=True, load_4bit=False, device='cuda')
|
224 |
handler.model.to(dtype=torch.float16)
|
225 |
|
226 |
if not os.path.exists("temp"):
|