fix(model): fix Model.from_pretrained to support lightning 2.6+ (#1962)

Co-authored-by: Hervé BREDIN <hbredin@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
CopilotandHervé BREDIN authored and GitHub committed 2025-12-04 09:28:51 +01:00
1 parent 022d040363
commit 222c5b59ce
2 files changed
+6 -1

No files matched your search

+1
View File
@@ -3,6 +3,7 @@
## next
- feat(util): add `Calibration.safe_transform` method (supports NaNs as well as any shape)
- fix(model): fix `Model.from_pretrained` to support `lightning` 2.6+
## Version 4.0.2 (2025-11-19)
+5 -1
View File
@@ -599,7 +599,9 @@ class Model(lightning.LightningModule):
map_location = default_map_location
# load checkpoint using lightning
loaded_checkpoint = pl_load(path_to_model_checkpoint, map_location=map_location)
loaded_checkpoint = pl_load(
path_to_model_checkpoint, map_location=map_location, weights_only=False
)
# check that the checkpoint is compatible with the current version
versions = loaded_checkpoint["pyannote.audio"]["versions"]
@@ -620,6 +622,7 @@ class Model(lightning.LightningModule):
path_to_model_checkpoint,
map_location=map_location,
strict=strict,
weights_only=False,
**kwargs,
)
except RuntimeError as e:
@@ -638,6 +641,7 @@ class Model(lightning.LightningModule):
path_to_model_checkpoint,
map_location=map_location,
strict=False,
weights_only=False,
**kwargs,
)
return model