Skip to content

Commit da773f1

Browse files
committed
[Perplexity]handling if ort doesn't have support for prefill chunking still chunk_size passed
Signed-off-by: unknown <[email protected]>
1 parent 947e50c commit da773f1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

examples/windows/accuracy_benchmark/perplexity_metrics/perplexity_metrics.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ def perplexity_eval(model_dir, input_len=1024, chunk_size=None):
314314
time_start = time.time()
315315
print(f"\n[RUN] === BEGIN perplexity_eval('{model_dir}') ===")
316316
print(f"[RUN] Loading ONNX model from: {model_dir}")
317+
chunking_failed = False
317318
# Load the ONNX model
318319
# Apply chunk_size overlay if provided
319320
config = og.Config(model_dir)
@@ -325,6 +326,7 @@ def perplexity_eval(model_dir, input_len=1024, chunk_size=None):
325326
print(f"[CONFIG] Successfully applied chunk_size: {chunk_size}")
326327
except Exception as e:
327328
print(f"[WARNING] Failed to apply chunk_size overlay: {e}")
329+
chunking_failed = True
328330
model = og.Model(config)
329331

330332
if DEBUG:
@@ -349,7 +351,7 @@ def perplexity_eval(model_dir, input_len=1024, chunk_size=None):
349351

350352
# Check for chunk_size - prioritize parameter over config file
351353
effective_chunk_size = None
352-
if chunk_size is not None:
354+
if chunk_size is not None and not chunking_failed:
353355
# Use the provided chunk_size parameter (overlaid)
354356
effective_chunk_size = int(chunk_size)
355357
kv_chunking_enabled = True

examples/windows/accuracy_benchmark/perplexity_metrics/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ protobuf>=5.28.2
1515
pytest
1616
sentencepiece
1717
sympy
18+
tokenizers>=0.14.1
1819
torch>=2.0.0
1920
torchaudio
2021
torchvision
21-
transformers
22-
22+
transformers>=4.36
2323

0 commit comments

Comments
 (0)