Guard moshi quantize patch for moshi>=0.2.12
Browse files- moshi_compat.py +5 -0
moshi_compat.py
CHANGED
|
@@ -7,6 +7,11 @@ from moshi.utils import quantize
|
|
| 7 |
|
| 8 |
|
| 9 |
def patch_bitsandbytes_import_for_unquantized_layers() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
original_linear = quantize.linear
|
| 11 |
original_multi_linear = quantize.multi_linear
|
| 12 |
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
def patch_bitsandbytes_import_for_unquantized_layers() -> None:
|
| 10 |
+
# moshi >=0.2.12 dropped the module-level linear/multi_linear helpers (now QLinear),
|
| 11 |
+
# and its Mimi no longer routes through them, so there is nothing to patch.
|
| 12 |
+
if not hasattr(quantize, "linear") or not hasattr(quantize, "multi_linear"):
|
| 13 |
+
return
|
| 14 |
+
|
| 15 |
original_linear = quantize.linear
|
| 16 |
original_multi_linear = quantize.multi_linear
|
| 17 |
|