I am new to ondevice ml. I was playing with the Mediapipe official android llm power chat app. I can run the android app however, I was curious whether it is using CPU or GPU. I could not found a way to do it.
If anyone know how to configure the runtime on GPU or CPU please help.
I thought probably during loading the model I would be able to set the runtime however in the following function
public static LlmInference createFromOptions(Context context, LlmInferenceOptions options) {
LlmOptionsProto.LlmSessionConfig.Builder sessionConfig = LlmSessionConfig.newBuilder();
sessionConfig.setModelPath(options.modelPath());
sessionConfig.setCacheDir(context.getCacheDir().getAbsolutePath());
sessionConfig.setNumDecodeStepsPerSync(3);
sessionConfig.setMaxTokens(options.maxTokens());
sessionConfig.setTopk(options.topK());
sessionConfig.setTemperature(options.temperature());
sessionConfig.setRandomSeed(options.randomSeed());
return new LlmInference(context, STATS_TAG, (LlmOptionsProto.LlmSessionConfig)sessionConfig.build(), options.resultListener());
} I did search for other class infor where it can be set such as taskoption however I could not figure out how to use that in the Llminference
Mohammad Jaminur Islam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.