Skip to content

Commit c26bc80

Browse files
Arm backend: Require safetensors for VGF DeiT export (#24025)
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 <sebastian.larsson@arm.com>
1 parent 21306f3 commit c26bc80

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎examples/arm/image_classification_example_vgf/model_export/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ python examples/arm/image_classification_example_vgf/model_export/train_deit.py
2525

2626
## Export and quantize for VGF
2727

28+
The exporter requires a safetensors checkpoint. The training script saves
29+
this format by default. Legacy PyTorch `.bin` checkpoints are not accepted.
30+
2831
```bash
2932
python examples/arm/image_classification_example_vgf/model_export/export_deit.py \
3033
--model-path ./deit-tiny-oxford-pet/final_model \

‎examples/arm/image_classification_example_vgf/model_export/export_deit.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def measure_accuracy(quantized_model, test_set):
9393
type=str,
9494
default="./deit-tiny-oxford-pet/final_model",
9595
required=True,
96-
help="Path to the fine-tuned ViT model.",
96+
help="Path to the fine-tuned ViT model saved in safetensors format.",
9797
)
9898
argparser.add_argument(
9999
"--output-path",
@@ -120,7 +120,7 @@ def measure_accuracy(quantized_model, test_set):
120120
num_labels=37,
121121
ignore_mismatched_sizes=True,
122122
revision="b3428f18dcc7b543470d07f14b4a4157815d1880",
123-
use_safetensors=False,
123+
use_safetensors=True,
124124
).eval()
125125
image_preprocessor = AutoImageProcessor.from_pretrained(
126126
"facebook/deit-tiny-patch16-224",

0 commit comments

Comments
 (0)