Instructions to use litert-community/Julia-1-LiteRT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/Julia-1-LiteRT with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Android sample in android/ (Kotlin host: tokenizer, strict sequence builder, float16 table lookup, GPU FP32 CompiledModel call, decoder; Compose UI), card rows for it, SHA256SUMS extended
8b40504 verified Download android/app/src/test/java/com/julia1/JuliaTestData.kt from litert-community/Julia-1-LiteRT: direct link, hf CLI and curl.
- Browser
- Download file 2.56 kB
-
https://huggingface.co/litert-community/Julia-1-LiteRT/resolve/main/android/app/src/test/java/com/julia1/JuliaTestData.kt
- Command line
-
hf download hf://litert-community/Julia-1-LiteRT/android/app/src/test/java/com/julia1/JuliaTestData.kt
-
curl -L -o JuliaTestData.kt https://huggingface.co/litert-community/Julia-1-LiteRT/resolve/main/android/app/src/test/java/com/julia1/JuliaTestData.kt
2.56 kB
| // SPDX-License-Identifier: Apache-2.0 | |
| package com.julia1 | |
| import java.io.File | |
| import org.junit.Assert.assertTrue | |
| /** Reads an explicitly supplied fixture bundle without depending on a conversion checkout. */ | |
| object JuliaTestData { | |
| private val dataRoot: File by lazy { | |
| val path = | |
| requireNotNull(System.getProperty("julia1.testData")) { | |
| "Set JULIA1_TEST_DATA to the fixture bundle directory; see scripts/TEST_DATA.md" | |
| } | |
| File(path).canonicalFile.also { | |
| require(File(it, "fixtures").isDirectory) { | |
| "Missing fixtures: $it; see scripts/TEST_DATA.md" | |
| } | |
| } | |
| } | |
| val tokenizer: JuliaTokenizer by lazy { JuliaTokenizer(required("host_assets/tokenizer.json")) } | |
| fun required(relative: String): File = | |
| File(dataRoot, relative).also { | |
| require(it.isFile) { "Required local test fixture is missing: $it" } | |
| } | |
| fun read(relative: String): Any? = JuliaJson.parse(required(relative)) | |
| /** All 2,100 oracle requests with the reference host's ids, markers, qtype and logits. */ | |
| fun requests(): List<Map<String, Any?>> = | |
| JuliaJson.asArray(JuliaJson.asObject(read("fixtures/gate_requests.json"))["rows"]) | |
| .map(JuliaJson::asObject) | |
| fun ints(value: Any?): IntArray = | |
| JuliaJson.asArray(value).map { (it as Number).toInt() }.toIntArray() | |
| fun doubles(value: Any?): DoubleArray = | |
| JuliaJson.asArray(value).map { (it as Number).toDouble() }.toDoubleArray() | |
| /** The author's request row (state, question, type, options) of a fixture row. */ | |
| fun question(row: Map<String, Any?>): JuliaQuestion { | |
| val request = JuliaJson.asObject(row["request"]) | |
| val type = request["type"] as? String ?: "choice" | |
| val options = JuliaJson.asArray(request["options"]).map { it as String } | |
| val criteria: Any? = | |
| when (type) { | |
| "choice" -> options.indices.associateTo(LinkedHashMap()) { "option$it" to options[it] } | |
| "score" -> options | |
| else -> linkedMapOf("false" to options[0], "true" to options[1]) | |
| } | |
| return JuliaQuestion(type, request["question"] as String, criteria) | |
| } | |
| fun report(name: String, data: Any?) { | |
| val directory = File(requireNotNull(System.getProperty("julia1.testResults"))) | |
| val destination = File(directory, name) | |
| requireNotNull(destination.parentFile).mkdirs() | |
| destination.writeText(JuliaJson.stringify(data) + "\n", Charsets.UTF_8) | |
| } | |
| fun assertNoFailures(label: String, failures: List<Map<String, Any?>>) { | |
| assertTrue("$label: ${failures.size} failures; ${failures.take(8)}", failures.isEmpty()) | |
| } | |
| } | |