Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Then wrap your TFLite interpreter:
```kotlin
val wildEdge = WildEdge.getInstance()
val interpreter = wildEdge.decorate(
Interpreter(modelFile, Interpreter.Options()), modelFile, modelVersion = "1.0"
Interpreter(modelFile, Interpreter.Options()), modelFile
)

interpreter.run(inputBuffer, outputBuffer)
Expand Down Expand Up @@ -133,7 +133,7 @@ val interpreter = wildEdge.decorate(
val modelFile = File(modelPath) // e.g. "face_detector_fp16.onnx"
val session = wildEdge.decorate(
env.createSession(modelFile.absolutePath, OrtSession.SessionOptions()),
modelFile, modelVersion = "1.0"
modelFile
)
// modelId = "face_detector_fp16", quantization = "f16"

Expand All @@ -155,7 +155,7 @@ faceDetector.process(image).trackWith(handle) { faces ->

```kotlin
val handle = wildEdge.registerLiteRtModel(
"gemma-3n", modelVersion = "1.0", quantization = "int4"
"gemma-3n", quantization = "int4"
)

val inputMeta = WildEdge.analyzeText(userInput)
Expand All @@ -171,7 +171,7 @@ Captures total duration, time to first token, tokens/sec, and estimated tokens i
```kotlin
val interpreter = wildEdge.decorate(
InterpreterApi.create(modelFile, InterpreterApi.Options()),
modelFile, modelVersion = "1.0"
modelFile
)

interpreter.run(inputBuffer, outputBuffer)
Expand Down Expand Up @@ -369,8 +369,8 @@ Integrate the WildEdge Android SDK (dev.wildedge:wildedge-android) into this pro
GenerationOutputMeta(tokensIn = r.usage.promptTokens, tokensOut = r.usage.completionTokens).toMap()
}
For decorator integrations, assign the result to the same variable name as the original
so call sites don't change. Pass a real modelVersion string (check the model filename,
asset path, or any version constant in the code).
so call sites don't change. Only pass modelVersion if you find a real version string
in the model filename, asset path, or an existing version constant.
For streaming LLM output (Flow<String>) use flow.trackWith(handle).

3. Set up WildEdge (pick one):
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/GalleryExample.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GalleryExample {
private val engine = run {
val start = System.currentTimeMillis()
val engine = Engine(config).also { it.initialize() }
wildEdge.decorate(engine, config, loadDurationMs = (System.currentTimeMillis() - start).toInt(), modelVersion = "1.0", accelerator = Accelerator.GPU)
wildEdge.decorate(engine, config, loadDurationMs = (System.currentTimeMillis() - start).toInt(), accelerator = Accelerator.GPU)
}

private val conversation = engine.createConversation()
Expand Down
1 change: 0 additions & 1 deletion examples/onnx/OnnxExample.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class OnnxExample(context: Context) {
private val session = wildEdge.decorate(
OrtEnvironment.getEnvironment().createSession(modelFile.absolutePath, OrtSession.SessionOptions()),
modelFile,
modelVersion = "1.0",
)

fun run(bitmap: Bitmap, inputs: Map<String, OnnxTensor>) = session.run(
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
android.useAndroidX=true
org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=512m

GROUP=dev.wildedge
VERSION_NAME=0.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class MainActivity : AppCompatActivity() {
"mobilenet-v1",
ModelInfo(
modelName = "MobileNet V1",
modelVersion = "1.0",
modelSource = "remote",
modelFormat = "tflite",
quantization = "uint8",
Expand Down Expand Up @@ -84,7 +83,6 @@ class MainActivity : AppCompatActivity() {
wildEdge.decorate(
interpreter,
modelId = "mobilenet-v1",
modelVersion = "1.0",
quantization = "uint8",
),
inShape,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class MainActivity : AppCompatActivity() {
modelFile.nameWithoutExtension,
ModelInfo(
modelName = modelFile.nameWithoutExtension,
modelVersion = "1.0",
modelSource = "remote",
modelFormat = "litertlm",
inputModality = InputModality.Text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class MainActivity : AppCompatActivity() {
modelFile.nameWithoutExtension,
ModelInfo(
modelName = modelFile.nameWithoutExtension,
modelVersion = "1.0",
modelSource = "remote",
modelFormat = "litertlm",
inputModality = InputModality.Text,
Expand Down
4 changes: 2 additions & 2 deletions wildedge/src/main/kotlin/dev/wildedge/sdk/ModelInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package dev.wildedge.sdk
* Metadata describing a registered model.
*
* @property modelName Human-readable model name.
* @property modelVersion Semantic version string.
* @property modelVersion Semantic version string. `null` if unknown.
* @property modelSource Origin of the model (e.g. "huggingface", "custom").
* @property modelFormat Runtime format (e.g. "tflite", "onnx", "gguf").
* @property modelFamily Optional model family (e.g. "llama", "gemma").
Expand All @@ -14,7 +14,7 @@ package dev.wildedge.sdk
*/
data class ModelInfo(
val modelName: String,
val modelVersion: String,
val modelVersion: String? = null,
val modelSource: String,
val modelFormat: String,
val modelFamily: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal class ModelRegistry(private val persistFile: File? = null) {
val obj = root.optJSONObject(modelId) ?: continue

val modelName = obj.optStringOrNull("model_name") ?: continue
val modelVersion = obj.optStringOrNull("model_version") ?: continue
val modelVersion = obj.optStringOrNull("model_version")
val modelSource = obj.optStringOrNull("model_source") ?: continue
val modelFormat = obj.optStringOrNull("model_format") ?: continue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import kotlinx.coroutines.flow.flow
fun WildEdgeClient.registerGoogleAiModel(
modelId: String,
modelName: String = modelId,
modelVersion: String = "unknown",
modelVersion: String? = null,
modelFamily: String? = "gemini",
): ModelHandle = registerModel(
modelId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun WildEdgeClient.decorate(
engine: Engine,
config: EngineConfig,
loadDurationMs: Int = 0,
modelVersion: String = "unknown",
modelVersion: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
): LiteRtEngineDecorator {
val modelFile = File(config.modelPath)
Expand All @@ -60,7 +60,7 @@ fun WildEdgeClient.decorate(
engine: Engine,
loadDurationMs: Int = 0,
modelId: String,
modelVersion: String = "unknown",
modelVersion: String? = null,
quantization: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
): LiteRtEngineDecorator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import dev.wildedge.sdk.events.TextInputMeta
fun WildEdgeClient.registerLiteRtModel(
modelId: String,
modelName: String = modelId,
modelVersion: String = "unknown",
modelVersion: String? = null,
quantization: String? = null,
): ModelHandle = registerModel(
modelId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fun WildEdgeClient.registerMlKitModel(
modelId: String,
modelName: String = modelId,
modelSource: String = "mlkit",
modelVersion: String = "unknown",
modelVersion: String? = null,
): ModelHandle = registerModel(
modelId,
ModelInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class OrtDecorator(
private val session: OrtSession,
private val wildEdge: WildEdgeClient,
modelId: String,
modelVersion: String = "unknown",
modelVersion: String? = null,
quantization: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
private val labels: List<String>? = null,
Expand Down Expand Up @@ -84,7 +84,7 @@ class OrtDecorator(
fun WildEdgeClient.decorate(
session: OrtSession,
modelFile: File,
modelVersion: String = "unknown",
modelVersion: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
labels: List<String>? = null,
numClasses: Int = labels?.size ?: 0,
Expand All @@ -103,7 +103,7 @@ fun WildEdgeClient.decorate(
fun WildEdgeClient.decorate(
session: OrtSession,
modelId: String,
modelVersion: String = "unknown",
modelVersion: String? = null,
quantization: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
labels: List<String>? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PlayServicesTfliteDecorator(
private val interpreter: InterpreterApi,
wildEdge: WildEdgeClient,
modelId: String,
modelVersion: String = "unknown",
modelVersion: String? = null,
quantization: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
private val labels: List<String>? = null,
Expand Down Expand Up @@ -79,7 +79,7 @@ class PlayServicesTfliteDecorator(
fun WildEdgeClient.decorate(
interpreter: InterpreterApi,
modelFile: File,
modelVersion: String = "unknown",
modelVersion: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
labels: List<String>? = null,
numClasses: Int = labels?.size ?: 0,
Expand All @@ -98,7 +98,7 @@ fun WildEdgeClient.decorate(
fun WildEdgeClient.decorate(
interpreter: InterpreterApi,
modelId: String,
modelVersion: String = "unknown",
modelVersion: String? = null,
quantization: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
labels: List<String>? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TFLiteDecorator(
private val interpreter: Interpreter,
private val wildEdge: WildEdgeClient,
modelId: String,
modelVersion: String = "unknown",
modelVersion: String? = null,
quantization: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
private val labels: List<String>? = null,
Expand Down Expand Up @@ -87,7 +87,7 @@ class TFLiteDecorator(
fun WildEdgeClient.decorate(
interpreter: Interpreter,
modelFile: File,
modelVersion: String = "unknown",
modelVersion: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
labels: List<String>? = null,
numClasses: Int = labels?.size ?: 0,
Expand All @@ -106,7 +106,7 @@ fun WildEdgeClient.decorate(
fun WildEdgeClient.decorate(
interpreter: Interpreter,
modelId: String,
modelVersion: String = "unknown",
modelVersion: String? = null,
quantization: String? = null,
accelerator: dev.wildedge.sdk.Accelerator? = null,
labels: List<String>? = null,
Expand Down
Loading