(filename: string)
| 101 | * @returns Quantization type or null |
| 102 | */ |
| 103 | export function parseQuantizationType(filename: string): string | null { |
| 104 | const patterns = [ |
| 105 | 'Q8_0', 'Q6_K', 'Q5_K_M', 'Q5_K_S', 'Q5_1', 'Q5_0', |
| 106 | 'Q4_K_M', 'Q4_K_S', 'Q4_1', 'Q4_0', |
| 107 | 'Q3_K_L', 'Q3_K_M', 'Q3_K_S', 'Q2_K', |
| 108 | 'F32', 'F16' |
| 109 | ]; |
| 110 | |
| 111 | const upperFilename = filename.toUpperCase(); |
| 112 | for (const pattern of patterns) { |
| 113 | if (upperFilename.includes(pattern)) { |
| 114 | return pattern; |
| 115 | } |
| 116 | } |
| 117 | return null; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Get hardware compatibility badge for a model file |
nothing calls this directly
no outgoing calls
no test coverage detected