From 5c23ff5649b4ca4587f30c46187b611b00e93b98 Mon Sep 17 00:00:00 2001 From: Sebastian Larsson Date: Mon, 19 Oct 2026 11:32:27 +0200 Subject: [PATCH] Arm backend: Require safetensors for VGF DeiT export Require safetensors when loading the fine-tuned DeiT checkpoint so export does not select legacy pickle-based PyTorch weights. Document the required format in the CLI help and export instructions. Signed-off-by: Sebastian Larsson Change-Id: If852d40ee063e14efdedb1601ae716f26c238192 --- .../image_classification_example_vgf/model_export/README.md | 3 +++ .../model_export/export_deit.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/arm/image_classification_example_vgf/model_export/README.md b/examples/arm/image_classification_example_vgf/model_export/README.md index 1513a393011..df5fd6e35db 100644 --- a/examples/arm/image_classification_example_vgf/model_export/README.md +++ b/examples/arm/image_classification_example_vgf/model_export/README.md @@ -25,6 +25,9 @@ python examples/arm/image_classification_example_vgf/model_export/train_deit.py ## Export and quantize for VGF +The exporter requires a safetensors checkpoint. The training script saves +this format by default. Legacy PyTorch `.bin` checkpoints are not accepted. + ```bash python examples/arm/image_classification_example_vgf/model_export/export_deit.py \ --model-path ./deit-tiny-oxford-pet/final_model \ diff --git a/examples/arm/image_classification_example_vgf/model_export/export_deit.py b/examples/arm/image_classification_example_vgf/model_export/export_deit.py index a46d157bfa5..76a6b4845a7 100644 --- a/examples/arm/image_classification_example_vgf/model_export/export_deit.py +++ b/examples/arm/image_classification_example_vgf/model_export/export_deit.py @@ -93,7 +93,7 @@ def measure_accuracy(quantized_model, test_set): type=str, default="./deit-tiny-oxford-pet/final_model", required=True, - help="Path to the fine-tuned ViT model.", + help="Path to the fine-tuned ViT model saved in safetensors format.", ) argparser.add_argument( "--output-path", @@ -120,7 +120,7 @@ def measure_accuracy(quantized_model, test_set): num_labels=37, ignore_mismatched_sizes=True, revision="b3428f18dcc7b543470d07f14b4a4157815d1880", - use_safetensors=False, + use_safetensors=True, ).eval() image_preprocessor = AutoImageProcessor.from_pretrained( "facebook/deit-tiny-patch16-224",