-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
llamacpp:integrate ggml's excellent and amazing llama.cpp to kantv (#104
- Loading branch information
Showing
228 changed files
with
214,962 additions
and
2,132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 33 additions & 24 deletions
57
cdeosplayer/cdeosplayer-lib/src/main/java/org/ggml/whispercpp/whispercpp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,46 @@ | ||
//TODO: re-write entire whispercpp.java with standard Android JNI specification | ||
// interaction between KANTVMgr.java and whispercpp.java | ||
// TODO: 03-05-2024, re-write entire whispercpp.java with standard Android JNI specification | ||
// TODO: 03-26-2024, rename this file to ggmljni to unify the JNI of whisper.cpp and llama.cpp, as these projects are all based on ggml | ||
|
||
package org.ggml.whispercpp; | ||
|
||
public class whispercpp { | ||
private static final String TAG = whispercpp.class.getName(); | ||
private static final String TAG = whispercpp.class.getName(); | ||
|
||
public static final int WHISPER_ASR_MODE_NORMAL = 0; | ||
public static final int WHISPER_ASR_MODE_PRESURETEST = 1; | ||
public static final int WHISPER_ASR_MODE_BECHMARK = 2; | ||
public static final int WHISPER_ASR_MODE_NORMAL = 0; | ||
public static final int WHISPER_ASR_MODE_PRESURETEST = 1; | ||
public static final int WHISPER_ASR_MODE_BECHMARK = 2; | ||
|
||
public static native int asr_init(String strModelPath, int nThreadCounts, int nASRMode); | ||
public static native int asr_init(String strModelPath, int nThreadCounts, int nASRMode); | ||
|
||
public static native void asr_finalize(); | ||
public static native void asr_finalize(); | ||
|
||
public static native void asr_start(); | ||
public static native void asr_stop(); | ||
public static native int asr_reset(String strModelPath, int nThreadCounts, int nASRMode); | ||
public static native void asr_start(); | ||
|
||
public static native String get_systeminfo(); | ||
public static native void asr_stop(); | ||
|
||
public static native int get_cpu_core_counts(); | ||
public static native int asr_reset(String strModelPath, int nThreadCounts, int nASRMode); | ||
|
||
//TODO: not work as expected, just skip this during PoC stage | ||
public static native void set_benchmark_status(int bExitBenchmark); | ||
public static native String asr_get_systeminfo(); | ||
|
||
/** | ||
* | ||
* @param modelPath /sdcard/kantv/ggml-xxxxx.bin | ||
* @param audioPath /sdcard/kantv/jfk.wav | ||
* @param nBenchType 0: asr 1: memcpy 2: mulmat 3: full/whisper_encode | ||
* @param nThreadCounts 1 - 8 | ||
* @return | ||
*/ | ||
public static native String bench(String modelPath, String audioPath, int nBenchType, int nThreadCounts); | ||
public static native int get_cpu_core_counts(); | ||
|
||
//TODO: not work as expected | ||
public static native void asr_set_benchmark_status(int bExitBenchmark); | ||
|
||
/** | ||
* @param modelPath /sdcard/kantv/ggml-xxxxx.bin | ||
* @param audioPath /sdcard/kantv/jfk.wav | ||
* @param nBenchType 0: asr(transcription) 1: memcpy 2: mulmat 3: full/whisper_encode | ||
* @param nThreadCounts 1 - 8 | ||
* @return | ||
*/ | ||
public static native String asr_bench(String modelPath, String audioPath, int nBenchType, int nThreadCounts); | ||
|
||
|
||
public static native String llm_get_systeminfo(); | ||
|
||
|
||
public static native String llm_bench(String modelPath, String prompt, int nBenchType, int nThreadCounts); | ||
|
||
public static native String llm_inference(String modelPath, String prompt, int nBenchType, int nThreadCounts); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
559d2ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't know/have no ide how llama.cpp is really used in project kantv like whisper.cpp based real-time subtitle in online tv.
a GPT-style chat tool?
sometimes the LLM model's answers are wildly incorrect.
559d2ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another question:
how LLAMA handle picture/video? is LLAMA a multimodal large model?