Video-Text-to-Text
Transformers
Safetensors
English
Chinese
moss_vl
feature-extraction
SFT
Video-Understanding
Image-Understanding
MOSS-VL
OpenMOSS
multimodal
video
vision-language
custom_code
Instructions to use OpenMOSS-Team/MOSS-VL-Instruct-0708 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenMOSS-Team/MOSS-VL-Instruct-0708 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenMOSS-Team/MOSS-VL-Instruct-0708", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update video_processing_moss_vl.py
Browse files- video_processing_moss_vl.py +12 -3
video_processing_moss_vl.py
CHANGED
|
@@ -231,7 +231,17 @@ def split_indices(indices: List[Union[int, float]], num_chunks: int) -> List[Lis
|
|
| 231 |
|
| 232 |
Returns:
|
| 233 |
List of index chunks.
|
|
|
|
|
|
|
|
|
|
| 234 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
chunk_size = len(indices) // num_chunks
|
| 236 |
chunks = []
|
| 237 |
for i in range(num_chunks - 1):
|
|
@@ -272,7 +282,7 @@ def decode_with_multithreading(indices: List[int], num_threads: int, video_path:
|
|
| 272 |
dict: Contains 'data', 'duration_seconds', 'pts_seconds' tensors.
|
| 273 |
"""
|
| 274 |
chunks = split_indices(indices, num_chunks=num_threads)
|
| 275 |
-
results = Parallel(n_jobs=
|
| 276 |
delayed(decode_sequentially)(chunk, video_path) for chunk in chunks
|
| 277 |
)
|
| 278 |
|
|
@@ -319,7 +329,7 @@ def timestamp_decode_with_multithreading(timestamp_list: List[float], num_thread
|
|
| 319 |
dict: Contains 'data', 'duration_seconds', 'pts_seconds' tensors.
|
| 320 |
"""
|
| 321 |
chunks = split_indices(timestamp_list, num_chunks=num_threads)
|
| 322 |
-
results = Parallel(n_jobs=
|
| 323 |
delayed(decode_sequentially_timestamp)(chunk, video_path) for chunk in chunks
|
| 324 |
)
|
| 325 |
|
|
@@ -1148,4 +1158,3 @@ class MossVLVideoProcessor(BaseVideoProcessor):
|
|
| 1148 |
|
| 1149 |
|
| 1150 |
__all__ = ["MossVLVideoProcessor"]
|
| 1151 |
-
|
|
|
|
| 231 |
|
| 232 |
Returns:
|
| 233 |
List of index chunks.
|
| 234 |
+
|
| 235 |
+
Raises:
|
| 236 |
+
ValueError: If indices is empty or num_chunks is not positive.
|
| 237 |
"""
|
| 238 |
+
if len(indices) == 0:
|
| 239 |
+
raise ValueError("indices must not be empty")
|
| 240 |
+
if num_chunks <= 0:
|
| 241 |
+
raise ValueError("num_chunks must be positive")
|
| 242 |
+
|
| 243 |
+
# Never create empty decode jobs when there are fewer frames than workers.
|
| 244 |
+
num_chunks = min(num_chunks, len(indices))
|
| 245 |
chunk_size = len(indices) // num_chunks
|
| 246 |
chunks = []
|
| 247 |
for i in range(num_chunks - 1):
|
|
|
|
| 282 |
dict: Contains 'data', 'duration_seconds', 'pts_seconds' tensors.
|
| 283 |
"""
|
| 284 |
chunks = split_indices(indices, num_chunks=num_threads)
|
| 285 |
+
results = Parallel(n_jobs=len(chunks), prefer="threads", verbose=0)(
|
| 286 |
delayed(decode_sequentially)(chunk, video_path) for chunk in chunks
|
| 287 |
)
|
| 288 |
|
|
|
|
| 329 |
dict: Contains 'data', 'duration_seconds', 'pts_seconds' tensors.
|
| 330 |
"""
|
| 331 |
chunks = split_indices(timestamp_list, num_chunks=num_threads)
|
| 332 |
+
results = Parallel(n_jobs=len(chunks), prefer="threads", verbose=0)(
|
| 333 |
delayed(decode_sequentially_timestamp)(chunk, video_path) for chunk in chunks
|
| 334 |
)
|
| 335 |
|
|
|
|
| 1158 |
|
| 1159 |
|
| 1160 |
__all__ = ["MossVLVideoProcessor"]
|
|
|