From 2410b9816936dccb359570515b60364caf7c9397 Mon Sep 17 00:00:00 2001 From: Sebastian Larsson Date: Mon, 19 Oct 2026 10:26:26 +0200 Subject: [PATCH] Arm backend: Require safetensors for super-resolution checkpoints Require safetensors when loading checkpoints to prevent fallback to pickle-based weights. Document that checkpoints must come from trusted sources. Change-Id: If0ccb4f04f0efce876954258038387f39b5d3d40 Signed-off-by: Sebastian Larsson --- .../arm/super_resolution_example_vgf/model_export/README.md | 3 +++ .../arm/super_resolution_example_vgf/model_export/common.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/examples/arm/super_resolution_example_vgf/model_export/README.md b/examples/arm/super_resolution_example_vgf/model_export/README.md index 9489327ed1b..fcab77b1af7 100644 --- a/examples/arm/super_resolution_example_vgf/model_export/README.md +++ b/examples/arm/super_resolution_example_vgf/model_export/README.md @@ -51,6 +51,9 @@ The concrete quick-demo commands below use the pinned revision currently cached for `caidas/swin2SR-classical-sr-x2-64`: `cee1c923c6a37361c6e5650b65dcf4be821e5d52`. +If you choose another checkpoint, use a source you trust and weights saved in +safetensors format. Pickle-based weights are not supported. + ### FP export ```bash diff --git a/examples/arm/super_resolution_example_vgf/model_export/common.py b/examples/arm/super_resolution_example_vgf/model_export/common.py index 617d5575402..631fb53165a 100644 --- a/examples/arm/super_resolution_example_vgf/model_export/common.py +++ b/examples/arm/super_resolution_example_vgf/model_export/common.py @@ -277,12 +277,14 @@ def _load_checkpointed_swin2sr( model = Swin2SRForImageSuperResolution.from_pretrained( # nosec B615 checkpoint, local_files_only=local_files_only, + use_safetensors=True, ).eval() else: model = Swin2SRForImageSuperResolution.from_pretrained( # nosec B615 checkpoint, revision=checkpoint_revision, local_files_only=local_files_only, + use_safetensors=True, ).eval() return Swin2SRWrapper(model)