zhanghaoji
commited on
Commit
·
595db44
1
Parent(s):
f2b16e9
upd
Browse files
flash_vstream/constants.py
CHANGED
@@ -13,3 +13,6 @@ DEFAULT_IMAGE_PATCH_TOKEN = "<im_patch>"
|
|
13 |
DEFAULT_IM_START_TOKEN = "<im_start>"
|
14 |
DEFAULT_IM_END_TOKEN = "<im_end>"
|
15 |
IMAGE_PLACEHOLDER = "<image-placeholder>"
|
|
|
|
|
|
|
|
13 |
DEFAULT_IM_START_TOKEN = "<im_start>"
|
14 |
DEFAULT_IM_END_TOKEN = "<im_end>"
|
15 |
IMAGE_PLACEHOLDER = "<image-placeholder>"
|
16 |
+
|
17 |
+
# Data Constants
|
18 |
+
MAX_IMAGE_LENGTH = 3600
|
flash_vstream/serve/demo.py
CHANGED
@@ -3,7 +3,7 @@ from ..constants import *
|
|
3 |
from ..conversation import conv_templates, SeparatorStyle
|
4 |
from ..model.builder import load_pretrained_model
|
5 |
from ..utils import disable_torch_init
|
6 |
-
from ..mm_utils import tokenizer_image_token, KeywordsStoppingCriteria
|
7 |
from PIL import Image
|
8 |
import os
|
9 |
from decord import VideoReader, cpu
|
@@ -13,7 +13,8 @@ import numpy as np
|
|
13 |
class Chat:
|
14 |
def __init__(self, model_path, conv_mode="simple", load_8bit=False, load_4bit=False):
|
15 |
disable_torch_init()
|
16 |
-
|
|
|
17 |
|
18 |
mm_use_im_start_end = getattr(self.model.config, "mm_use_im_start_end", False)
|
19 |
mm_use_im_patch_token = getattr(self.model.config, "mm_use_im_patch_token", True)
|
@@ -120,19 +121,16 @@ class Chat:
|
|
120 |
|
121 |
title_markdown = ("""
|
122 |
<div style="display: flex; justify-content: center; align-items: center; text-align: center;">
|
123 |
-
<a href="https://github.com/PKU-YuanGroup/Chat-UniVi" style="margin-right: 20px; text-decoration: none; display: flex; align-items: center;">
|
124 |
-
<img src="https://z1.ax1x.com/2023/11/22/pidlXh4.jpg" alt="Chat-UniVi🚀" style="max-width: 120px; height: auto;">
|
125 |
-
</a>
|
126 |
<div>
|
127 |
-
<h1 >
|
128 |
<h5 style="margin: 0;">If you like our project, please give us a star ✨ on Github for the latest update.</h5>
|
129 |
</div>
|
130 |
</div>
|
131 |
<div align="center">
|
132 |
<div style="display:flex; gap: 0.25rem;" align="center">
|
133 |
-
<a href=
|
134 |
-
<a href="https://arxiv.org/
|
135 |
-
<a href='https://github.com/
|
136 |
</div>
|
137 |
</div>
|
138 |
""")
|
|
|
3 |
from ..conversation import conv_templates, SeparatorStyle
|
4 |
from ..model.builder import load_pretrained_model
|
5 |
from ..utils import disable_torch_init
|
6 |
+
from ..mm_utils import tokenizer_image_token, KeywordsStoppingCriteria, get_model_name_from_path
|
7 |
from PIL import Image
|
8 |
import os
|
9 |
from decord import VideoReader, cpu
|
|
|
13 |
class Chat:
|
14 |
def __init__(self, model_path, conv_mode="simple", load_8bit=False, load_4bit=False):
|
15 |
disable_torch_init()
|
16 |
+
model_name = get_model_name_from_path(model_path)
|
17 |
+
self.tokenizer, self.model, self.image_processor, context_len = load_pretrained_model(model_path, None, model_name, load_8bit=load_8bit, load_4bit=load_4bit)
|
18 |
|
19 |
mm_use_im_start_end = getattr(self.model.config, "mm_use_im_start_end", False)
|
20 |
mm_use_im_patch_token = getattr(self.model.config, "mm_use_im_patch_token", True)
|
|
|
121 |
|
122 |
title_markdown = ("""
|
123 |
<div style="display: flex; justify-content: center; align-items: center; text-align: center;">
|
|
|
|
|
|
|
124 |
<div>
|
125 |
+
<h1 >Flash-VStream: Memory-Based Real-Time Understanding for Long Video Streams</h1>
|
126 |
<h5 style="margin: 0;">If you like our project, please give us a star ✨ on Github for the latest update.</h5>
|
127 |
</div>
|
128 |
</div>
|
129 |
<div align="center">
|
130 |
<div style="display:flex; gap: 0.25rem;" align="center">
|
131 |
+
<a href="https://invinciblewyq.github.io/vstream-page/"><img src='https://img.shields.io/badge/Project-Page-Green'></a>
|
132 |
+
<a href="https://arxiv.org/abs/2406.08085v1"><img src='https://img.shields.io/badge/Paper-Arxiv-red'></a>
|
133 |
+
<a href='https://github.com/IVGSZ/Flash-VStream'><img src='https://img.shields.io/badge/Github-Code-blue'></a>
|
134 |
</div>
|
135 |
</div>
|
136 |
""")
|