{"id":49869096,"url":"https://github.com/jawrainey/hfta","last_synced_at":"2026-05-15T04:35:30.574Z","repository":{"id":324430335,"uuid":"1097193741","full_name":"jawrainey/hfta","owner":"jawrainey","description":"Reference implementation: run any huggingface tokenizer in Android (rust).","archived":false,"fork":false,"pushed_at":"2025-11-15T19:07:43.000Z","size":2145,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-15T20:34:19.188Z","etag":null,"topics":["android","machine-learning","on-device-ml","rust","tokenizers"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jawrainey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-15T17:54:33.000Z","updated_at":"2025-11-15T19:07:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jawrainey/hfta","commit_stats":null,"previous_names":["jawrainey/hfta"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/jawrainey/hfta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawrainey%2Fhfta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawrainey%2Fhfta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawrainey%2Fhfta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawrainey%2Fhfta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jawrainey","download_url":"https://codeload.github.com/jawrainey/hfta/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jawrainey%2Fhfta/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33053935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-15T02:00:06.351Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","machine-learning","on-device-ml","rust","tokenizers"],"created_at":"2026-05-15T04:35:29.933Z","updated_at":"2026-05-15T04:35:30.568Z","avatar_url":"https://github.com/jawrainey.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HuggingFace Tokenizers on Android (HFTA)\n\n\u003e Reference implementation using [HuggingFace's (HF) tokenizers](https://github.com/huggingface/tokenizers) in Android.\n\n## Demo Video\n\nUI to show text to tokens via the tokenizers library in real-time on Android at [`demo/demo.mp4`](demo/demo.mp4):\n\nhttps://github.com/user-attachments/assets/54deb649-49f4-467e-8df9-dd424d3bed41\n\n### Try a Tokenizer\n\n1. Find a model you want to test on HF, e.g., Google's [gemma-3-4b-it](https://huggingface.co/google/gemma-3-4b-it/blob/main/tokenizer.json)\n2. Download and add the `tokenizer.json` to [`app/src/main/assets`](app/src/main/assets) named `gemma-3-4b-it.json`\n3. Modify `SELECTED_TOKENIZER` in [`app/build.gradle.kts`](app/build.gradle.kts)\n\n## Features\n\n- Run any [HuggingFace's (HF) tokenizers](https://github.com/huggingface/tokenizers) on-device in Android.\n- [`rust` to `java` NDK bindings of HF's tokenizers in `rs-hfta`](./rs-hfta/README.md)\n- Use of [JNI bindings between rust and Android](https://github.com/jawrainey/hfta/blob/main/app/src/main/java/com/example/hfta/HFTokenizer.kt#L3)\n- [Parameterized instrumentation tests (runs on-device)](./app/src/androidTest/java/com/example/hfta/HFTokenizer.kt)\n- [compiler optimizations to reduce lib filesize](https://github.com/jawrainey/hfta/commit/4cd5cc10a58248827e5c68db62630dc4d8cbdcf5)\n\n## Implementation Details\n\nRun _any_ HF's tokenizer on Android using the associated `tokenizers.json` from `huggingface.co`. To achieve that, the HF library is built [via rust](./rs-hfta/README.md) into a [shared library](./app/src/main/jniLibs/arm64-v8a/libhfta.so) and uses Java Native Interface (JNI) to load the library.\n\n### Thanks to\n\n- [Hugging Face's `tokenizers` library](https://github.com/huggingface/tokenizers)\n- [Qualcomm's Genie Library](https://softwarecenter.qualcomm.com/api/download/software/sdks/Qualcomm_AI_Runtime_Community/All/2.34.0.250424/v2.34.0.250424.zip) has a rust to C++ static library implementation of HF's tokenizers at `qairt/2.34.0.250424/examples/Genie/Genie/src/qualla/tokenizers/rust`\n- [Shubham Panchal's `Sentence-Embeddings-Android`](https://github.com/shubham0204/Sentence-Embeddings-Android/)\n- [Rust's `profile` docs](https://doc.rust-lang.org/cargo/reference/profiles.html)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawrainey%2Fhfta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjawrainey%2Fhfta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawrainey%2Fhfta/lists"}