From 3e55e54f50330836e852af89c696d8bf85445206 Mon Sep 17 00:00:00 2001 From: Sebastian Larsson Date: Mon, 19 Oct 2026 14:54:33 +0200 Subject: [PATCH] Arm backend: Require safetensors for Ethos-U 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: Iedc3fcd56b5654e52de17c13af4dcf0638c6e49c --- .../model_export/README.md | 3 +++ .../model_export/export_deit.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/arm/image_classification_example_ethos_u/model_export/README.md b/examples/arm/image_classification_example_ethos_u/model_export/README.md index 541edd75904..649737c54f3 100644 --- a/examples/arm/image_classification_example_ethos_u/model_export/README.md +++ b/examples/arm/image_classification_example_ethos_u/model_export/README.md @@ -30,6 +30,9 @@ Running this script achieves a test set accuracy of 86.10% in FP32. ## Export and quantize +The exporter requires a safetensors checkpoint. The training script saves +this format by default. Legacy PyTorch `.bin` checkpoints are not accepted. + The `export_deit.py` script can be run as follows: ```bash diff --git a/examples/arm/image_classification_example_ethos_u/model_export/export_deit.py b/examples/arm/image_classification_example_ethos_u/model_export/export_deit.py index cd8557588b7..60632a85858 100644 --- a/examples/arm/image_classification_example_ethos_u/model_export/export_deit.py +++ b/examples/arm/image_classification_example_ethos_u/model_export/export_deit.py @@ -96,7 +96,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", @@ -123,6 +123,7 @@ def measure_accuracy(quantized_model, test_set): num_labels=37, ignore_mismatched_sizes=True, revision="b3428f18dcc7b543470d07f14b4a4157815d1880", + use_safetensors=True, ).eval() image_preprocessor = AutoImageProcessor.from_pretrained( "facebook/deit-tiny-patch16-224",