mirror of
https://github.com/pyannote/pyannote-audio.git
synced 2026-11-20 13:07:51 +09:00
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:
1 parent
022d040363
commit
222c5b59ce
2 files changed
+6
-1
No files matched your search
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user