J Z commited on
Update float_lipsync.py
Browse files- float_lipsync.py +11 -12
float_lipsync.py
CHANGED
|
@@ -28,23 +28,22 @@ import face_alignment
|
|
| 28 |
import albumentations as A
|
| 29 |
import albumentations.pytorch.transforms as A_pytorch
|
| 30 |
from transformers import Wav2Vec2FeatureExtractor
|
| 31 |
-
try:
|
| 32 |
-
import transformers.utils.import_utils as _tf_import
|
| 33 |
-
if hasattr(_tf_import, 'check_torch_load_is_safe'):
|
| 34 |
-
_tf_import.check_torch_load_is_safe = lambda: None
|
| 35 |
-
logger.info("[FLOAT] Patched transformers torch.load safety check for torch 2.5 compat")
|
| 36 |
-
except Exception:
|
| 37 |
-
pass
|
| 38 |
|
| 39 |
# Workaround: transformers now requires torch>=2.6 for torch.load safety (CVE-2025-32434)
|
| 40 |
# but vLLM 0.7.3 pins torch 2.5.1. Disable the check since we only load trusted local checkpoints.
|
| 41 |
try:
|
| 42 |
import transformers.utils.import_utils as _tf_import
|
|
|
|
|
|
|
|
|
|
| 43 |
if hasattr(_tf_import, 'check_torch_load_is_safe'):
|
| 44 |
-
_tf_import.check_torch_load_is_safe =
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
# Import FLOAT model from cloned repo
|
| 50 |
from models.float.FLOAT import FLOAT
|
|
@@ -429,4 +428,4 @@ def get_lipsync() -> FloatLipsync:
|
|
| 429 |
global _lipsync_instance
|
| 430 |
if _lipsync_instance is None:
|
| 431 |
_lipsync_instance = FloatLipsync()
|
| 432 |
-
return _lipsync_instance
|
|
|
|
| 28 |
import albumentations as A
|
| 29 |
import albumentations.pytorch.transforms as A_pytorch
|
| 30 |
from transformers import Wav2Vec2FeatureExtractor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# Workaround: transformers now requires torch>=2.6 for torch.load safety (CVE-2025-32434)
|
| 33 |
# but vLLM 0.7.3 pins torch 2.5.1. Disable the check since we only load trusted local checkpoints.
|
| 34 |
try:
|
| 35 |
import transformers.utils.import_utils as _tf_import
|
| 36 |
+
import transformers.modeling_utils as _tf_modeling
|
| 37 |
+
_noop = lambda: None
|
| 38 |
+
# Patch the source function
|
| 39 |
if hasattr(_tf_import, 'check_torch_load_is_safe'):
|
| 40 |
+
_tf_import.check_torch_load_is_safe = _noop
|
| 41 |
+
# Patch the local reference in modeling_utils (imported via 'from ... import')
|
| 42 |
+
if hasattr(_tf_modeling, 'check_torch_load_is_safe'):
|
| 43 |
+
_tf_modeling.check_torch_load_is_safe = _noop
|
| 44 |
+
logger.info("[FLOAT] Patched transformers torch.load safety check for torch 2.5 compat")
|
| 45 |
+
except Exception as e:
|
| 46 |
+
logger.warning(f"[FLOAT] Failed to patch torch.load safety check: {e}")
|
| 47 |
|
| 48 |
# Import FLOAT model from cloned repo
|
| 49 |
from models.float.FLOAT import FLOAT
|
|
|
|
| 428 |
global _lipsync_instance
|
| 429 |
if _lipsync_instance is None:
|
| 430 |
_lipsync_instance = FloatLipsync()
|
| 431 |
+
return _lipsync_instance
|