liteRtLmGpuCacheFileNames function

  1. @visibleForTesting
({String program, String weight}) liteRtLmGpuCacheFileNames(
  1. String modelFileName,
  2. int modelSize
)

The names LiteRT's WebGPU accelerator gives the text tower's GPU caches in a cache directory: LiteRT-LM sets the serialization directory and the model cache key <model file name>.text_encoder_<mtime s>_<size> (litert_compiled_model_executor_utils.cc, file_util.cc), and ML Drift appends _mldrift_weight_cache.bin / _mldrift_program_cache.bin. The mtime's seconds are taken as 10 digits, as in liteRtLmCacheFilePathLength. The program cache's is the longer, by one.

Implementation

@visibleForTesting
({String weight, String program}) liteRtLmGpuCacheFileNames(
  String modelFileName,
  int modelSize,
) {
  final key = '$modelFileName${_textTower}_0000000000_$modelSize';
  return (
    weight: '$key$_gpuWeightCacheSuffix',
    program: '$key$_gpuProgramCacheSuffix',
  );
}