From a46ec679c2c78fb13a8298a6bc5fc7a39d8040ef Mon Sep 17 00:00:00 2001 From: Nikita Savelyev Date: Mon, 4 Nov 2024 11:42:27 +0100 Subject: [PATCH] Add SDPA to scope overrides (#982) --- .../configs/wav2vec2-base-jpqd.json | 3 +++ .../configs/wav2vec2-base-qat.json | 3 +++ .../image-classification/configs/swin-base-jpqd.json | 11 ++++++++++- optimum/intel/openvino/trainer.py | 7 ++++++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/examples/openvino/audio-classification/configs/wav2vec2-base-jpqd.json b/examples/openvino/audio-classification/configs/wav2vec2-base-jpqd.json index c58903da1..41e53f5cb 100644 --- a/examples/openvino/audio-classification/configs/wav2vec2-base-jpqd.json +++ b/examples/openvino/audio-classification/configs/wav2vec2-base-jpqd.json @@ -54,6 +54,9 @@ "activations": { "{re}.*matmul_0": { "mode": "symmetric" + }, + "{re}.*scaled_dot_product_attention_0": { + "mode": "symmetric" } } }, diff --git a/examples/openvino/audio-classification/configs/wav2vec2-base-qat.json b/examples/openvino/audio-classification/configs/wav2vec2-base-qat.json index 8edc51cf2..191f266a6 100644 --- a/examples/openvino/audio-classification/configs/wav2vec2-base-qat.json +++ b/examples/openvino/audio-classification/configs/wav2vec2-base-qat.json @@ -16,6 +16,9 @@ "activations": { "{re}.*matmul_0": { "mode": "symmetric" + }, + "{re}.*scaled_dot_product_attention_0": { + "mode": "symmetric" } } }, diff --git a/examples/openvino/image-classification/configs/swin-base-jpqd.json b/examples/openvino/image-classification/configs/swin-base-jpqd.json index 23b2fd3d8..a6057f6d7 100644 --- a/examples/openvino/image-classification/configs/swin-base-jpqd.json +++ b/examples/openvino/image-classification/configs/swin-base-jpqd.json @@ -32,7 +32,16 @@ "num_bn_adaptation_samples": 200 } }, - "scope_overrides": {"activations": {"{re}.*matmul_0": {"mode": "symmetric"}}}, + "scope_overrides": { + "activations": { + "{re}.*matmul_0": { + "mode": "symmetric" + }, + "{re}.*scaled_dot_product_attention_0": { + "mode": "symmetric" + } + } + }, "ignored_scopes": [ "{re}.*__add___[0-1]", "{re}.*layer_norm_0", diff --git a/optimum/intel/openvino/trainer.py b/optimum/intel/openvino/trainer.py index bac782205..0edb3a730 100644 --- a/optimum/intel/openvino/trainer.py +++ b/optimum/intel/openvino/trainer.py @@ -148,7 +148,12 @@ "range": {"num_init_samples": 300, "type": "mean_min_max"}, "batchnorm_adaptation": {"num_bn_adaptation_samples": 0}, }, - "scope_overrides": {"activations": {"{re}.*matmul_0": {"mode": "symmetric"}}}, + "scope_overrides": { + "activations": { + "{re}.*matmul_0": {"mode": "symmetric"}, + "{re}.*scaled_dot_product_attention_0": {"mode": "symmetric"}, + } + }, "ignored_scopes": [ "{re}.*Embedding.*", "{re}.*add___.*",