Skip to content

Instantly share code, notes, and snippets.

============================================================
BENCHMARK SUMMARY
============================================================
Model: hamishivi/qwen2_5_openthoughts2
Total batches: 5
Batch size: 256
Unique prompts per batch: 32
Num rollouts: 8
Max tokens: 32000
------------------------------------------------------------
@finbarrtimbers
finbarrtimbers / count_flops.py
Last active July 27, 2025 19:21
count model flops
def calculate_model_usage_per_token(model_path: str) -> int:
"""
Calculate actual FLOPs per token for a transformer model using torch FlopCounterMode.
Args:
model_path: Path to the actual model for precise measurement
Returns:
FLOPs per token as integer.
"""