(size_per_head, is_fp32)
| 38 | to_torch_type = {'fp32' : torch.float32, 'fp16' : torch.float16, 'bf16' : torch.bfloat16} |
| 39 | |
| 40 | def get_op_cache_config(size_per_head, is_fp32): |
| 41 | x = 4 if is_fp32 else 8 |
| 42 | use_batch_major_op_cache = True if USE_CACHE_BATCH_MAJOR_ATTENTION == True and \ |
| 43 | size_per_head % x == 0 \ |
| 44 | else False |
| 45 | x = x if use_batch_major_op_cache else 1 |
| 46 | return use_batch_major_op_cache, x |
| 47 | |
| 48 | |
| 49 | class DecodingWeights(object): |