videopython 0.23.2__tar.gz → 0.23.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {videopython-0.23.2 → videopython-0.23.3}/PKG-INFO +1 -1
- {videopython-0.23.2 → videopython-0.23.3}/pyproject.toml +1 -1
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/video_analysis.py +7 -27
- {videopython-0.23.2 → videopython-0.23.3}/.gitignore +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/LICENSE +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/README.md +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/__init__.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/__init__.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/_device.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/dubbing/__init__.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/dubbing/dubber.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/dubbing/models.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/dubbing/pipeline.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/dubbing/timing.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/generation/__init__.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/generation/audio.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/generation/image.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/generation/translation.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/generation/video.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/registry.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/swapping/__init__.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/swapping/inpainter.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/swapping/models.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/swapping/segmenter.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/swapping/swapper.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/transforms.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/understanding/__init__.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/understanding/audio.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/understanding/image.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/understanding/separation.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/ai/understanding/temporal.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/__init__.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/audio/__init__.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/audio/analysis.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/audio/audio.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/combine.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/description.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/edit.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/effects.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/exceptions.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/progress.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/registry.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/scene.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/text/__init__.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/text/overlay.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/text/transcription.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/transforms.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/transitions.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/utils.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/base/video.py +0 -0
- {videopython-0.23.2 → videopython-0.23.3}/src/videopython/py.typed +0 -0
|
@@ -398,35 +398,20 @@ class VideoAnalyzer:
|
|
|
398
398
|
|
|
399
399
|
run_whisper = AUDIO_TO_TEXT in enabled
|
|
400
400
|
run_scene_det = SEMANTIC_SCENE_DETECTOR in enabled
|
|
401
|
-
run_vlm = SCENE_VLM in enabled
|
|
402
401
|
|
|
403
402
|
transcription: Transcription | None = None
|
|
404
403
|
detected: list[SceneBoundary] | None = None
|
|
405
404
|
|
|
406
|
-
# Start loading SceneVLM weights in a background thread while
|
|
407
|
-
# Whisper and TransNetV2 run. Model loading is pure I/O + CPU
|
|
408
|
-
# weight deserialization, so it overlaps well with GPU inference.
|
|
409
|
-
vlm_preload_future = None
|
|
410
|
-
scene_vlm_holder: list[SceneVLM | None] = [None]
|
|
411
|
-
if run_vlm and (run_whisper or run_scene_det):
|
|
412
|
-
from concurrent.futures import ThreadPoolExecutor as _TPE
|
|
413
|
-
|
|
414
|
-
_vlm_pool = _TPE(max_workers=1)
|
|
415
|
-
|
|
416
|
-
def _preload_vlm() -> None:
|
|
417
|
-
try:
|
|
418
|
-
vlm = SceneVLM(**self.config.get_params(SCENE_VLM))
|
|
419
|
-
vlm._init_local()
|
|
420
|
-
scene_vlm_holder[0] = vlm
|
|
421
|
-
except Exception:
|
|
422
|
-
logger.warning("SceneVLM preload failed", exc_info=True)
|
|
423
|
-
|
|
424
|
-
vlm_preload_future = _vlm_pool.submit(_preload_vlm)
|
|
425
|
-
|
|
426
405
|
# Whisper and TransNetV2 operate on independent data (audio vs video
|
|
427
406
|
# frames) and both fit comfortably in GPU memory together. Run them
|
|
428
407
|
# concurrently via threads -- the GIL is released during GPU compute
|
|
429
408
|
# and ffmpeg I/O so real parallelism is achieved.
|
|
409
|
+
#
|
|
410
|
+
# SceneVLM is loaded *after* Whisper/TransNetV2 finish (not concurrently)
|
|
411
|
+
# because transformers' from_pretrained(torch_dtype="auto") mutates the
|
|
412
|
+
# process-global torch.get_default_dtype() during model construction,
|
|
413
|
+
# which corrupts Whisper's model weights if they're initialized at the
|
|
414
|
+
# same time.
|
|
430
415
|
if run_whisper and run_scene_det:
|
|
431
416
|
transcription, detected = self._run_whisper_and_scene_detection(source_path=source_path, video=video)
|
|
432
417
|
else:
|
|
@@ -443,11 +428,6 @@ class VideoAnalyzer:
|
|
|
443
428
|
if run_scene_det:
|
|
444
429
|
self._reset_transnetv2_torch_state()
|
|
445
430
|
|
|
446
|
-
# Wait for VLM preload to finish before freeing GPU memory.
|
|
447
|
-
if vlm_preload_future is not None:
|
|
448
|
-
vlm_preload_future.result()
|
|
449
|
-
_vlm_pool.shutdown(wait=False)
|
|
450
|
-
|
|
451
431
|
# Whisper and TransNetV2 are done -- free their GPU memory before
|
|
452
432
|
# loading SceneVLM (~9GB). Python GC doesn't guarantee immediate
|
|
453
433
|
# cleanup, so force it and release the CUDA cache.
|
|
@@ -468,7 +448,7 @@ class VideoAnalyzer:
|
|
|
468
448
|
video=video,
|
|
469
449
|
metadata=metadata,
|
|
470
450
|
scenes=scenes,
|
|
471
|
-
preloaded_scene_vlm=
|
|
451
|
+
preloaded_scene_vlm=None,
|
|
472
452
|
)
|
|
473
453
|
logger.info("Scene analysis completed in %.2fs", time.perf_counter() - t0)
|
|
474
454
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|