| export function selectEmbeddingPrecision(manifest, adapterFeatures = []) { |
| const features = adapterFeatures instanceof Set ? adapterFeatures : new Set(adapterFeatures); |
| const precision = features.has('shader-f16') ? 'fp16' : 'fp32'; |
| const externalDataChunks = { ...manifest.runtime.externalDataChunks }; |
| delete externalDataChunks['embed_tokens_fp16.onnx']; |
| if (precision === 'fp16') externalDataChunks['embed_tokens_fp16.onnx'] = 1; |
|
|
| return { |
| precision, |
| manifest: { |
| ...manifest, |
| runtime: { |
| ...manifest.runtime, |
| dtype: { ...manifest.runtime.dtype, embed_tokens: precision }, |
| externalDataChunks, |
| }, |
| }, |
| }; |
| } |
|
|