Repository navigation
Conversation
|
|
108a1a1 to
3c814e2
Compare
| return 6 * 3 * num_heads * key_head_dim * v_head_dim | ||
|
|
||
|
|
||
| def get_vision_flops( |
There was a problem hiding this comment.
Why do we need this complicated calculation that goes through the model every time? Similar to how the decoder flops calculation is done by num_flops_per_token * ntokens_since_last_log, can't each model define a fixed constant, like num_flops_per_patch that can be multiplied to the image size to compute the flops?
Also, another thing to consider is that we do not take into account of the individual document lengths within an input sequence for calculating flops for decoder, but just compute the flops as if the given sequence is a single document. I am wondering if we should also just compute the vision encoder flops just in terms of total number of patches, not taking into account of individual images. cc. @tianyu-l
There was a problem hiding this comment.
afaik vision flops r not linear per total patch count.
that goes through the model every time?
can't each model define a fixed constant like num_flops_per_patch?
👍
I am wondering if we should also just compute the vision encoder flops just in terms of total number of patches, not taking into account of individual images.
same patch count can have different per-image attention flops no?
Closes #4009.
Currently, VLM TFLOPs and MFU are reported from decoder FLOPs alone, so vision-encoder work is missing.
this pr adds per-batch vision FLOPs from grid_thw for Qwen3.5 and Kimi2.5. Then accumulates them over each logging window and then adds them to the existing decoder estimate.
Testing
Ran VLM on 8xH100. Ran fixed-seed branch vs upstream runs which matched at every logged loss value. log_freq=3 run matched independent computed FLOPs at every logging bound (max rel error 7.3e-8).
some observations: tflops/mfu increased by the missing vision work. qwen mem peak was identical and tps stayed within bounds.
test plots