Skip to content

Commit ba020ee

Browse files
authored
Parakeet app skeleton (meta-pytorch#209)
Fork the Whisper demo app to create a Parakeet TDT speech recognition demo, replacing the AsrModule streaming API with the ParakeetModule synchronous API that returns a complete transcription string directly. Key changes from the Whisper app: - Use ParakeetModule instead of AsrModule/AsrCallback - Remove preprocessor file support (not applicable to Parakeet) - Replace 6 Whisper model presets with single Parakeet TDT 0.6B INT4 - Simplify transcription logic (no token streaming or start/end stripping)
1 parent 2ec8bfb commit ba020ee

38 files changed

Lines changed: 2658 additions & 0 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
.idea/
5+
.DS_Store
6+
/build
7+
/captures
8+
.externalNativeBuild
9+
.cxx
10+
local.properties
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Parakeet Demo App
2+
3+
This app demonstrates running the Parakeet TDT speech recognition model on Android using ExecuTorch.
4+
5+
## Download ExecuTorch AAR
6+
7+
Download the prebuilt ExecuTorch AAR (with Parakeet JNI bindings) and place it in `app/libs/`:
8+
9+
```bash
10+
mkdir -p app/libs
11+
curl -L -o app/libs/executorch.aar https://gha-artifacts.s3.amazonaws.com/pytorch/executorch/21934561658/artifacts/executorch.aar
12+
```
13+
14+
## Export Model Files
15+
16+
Export the model `.pte` and tokenizer files following the instructions at:
17+
https://github.com/pytorch/executorch/tree/main/examples/models/parakeet
18+
19+
This app requires a model `.pte` and a tokenizer `.model` file.
20+
21+
## Run the App
22+
23+
1. Download the ExecuTorch AAR (see above)
24+
2. Open ParakeetApp in Android Studio
25+
3. Build and run on device
26+
27+
## Download Models
28+
29+
The app includes a built-in download screen to fetch the Parakeet TDT 0.6B (INT4) model from HuggingFace:
30+
- Model: `parakeet_int4.pte`
31+
- Tokenizer: `tokenizer.model`
32+
33+
Alternatively, push files manually:
34+
```bash
35+
adb push model.pte /data/local/tmp/parakeet/
36+
adb push tokenizer.model /data/local/tmp/parakeet/
37+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
alias(libs.plugins.kotlin.compose)
5+
}
6+
7+
val useLocalAar: Boolean? = (project.findProperty("useLocalAar") as? String)?.toBoolean()
8+
9+
android {
10+
namespace = "com.example.parakeetapp"
11+
compileSdk = 35
12+
13+
defaultConfig {
14+
applicationId = "com.example.parakeetapp"
15+
minSdk = 24
16+
targetSdk = 35
17+
versionCode = 1
18+
versionName = "1.0"
19+
}
20+
21+
buildTypes {
22+
release {
23+
isMinifyEnabled = false
24+
proguardFiles(
25+
getDefaultProguardFile("proguard-android-optimize.txt"),
26+
"proguard-rules.pro"
27+
)
28+
}
29+
}
30+
compileOptions {
31+
sourceCompatibility = JavaVersion.VERSION_11
32+
targetCompatibility = JavaVersion.VERSION_11
33+
}
34+
kotlinOptions {
35+
jvmTarget = "11"
36+
}
37+
buildFeatures {
38+
compose = true
39+
}
40+
}
41+
42+
dependencies {
43+
implementation(libs.androidx.core.ktx)
44+
implementation(libs.androidx.lifecycle.runtime.ktx)
45+
implementation(libs.androidx.activity.compose)
46+
implementation(platform(libs.androidx.compose.bom))
47+
implementation(libs.androidx.ui)
48+
implementation(libs.androidx.ui.graphics)
49+
implementation(libs.androidx.ui.tooling.preview)
50+
implementation(libs.androidx.material3)
51+
debugImplementation(libs.androidx.ui.tooling)
52+
if (useLocalAar == true) {
53+
implementation(files("libs/executorch.aar"))
54+
} else {
55+
implementation("org.pytorch:executorch-android:1.1.0")
56+
}
57+
implementation("com.facebook.fbjni:fbjni:0.5.1")
58+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<application
5+
android:allowBackup="true"
6+
android:icon="@mipmap/ic_launcher"
7+
android:label="@string/app_name"
8+
android:roundIcon="@mipmap/ic_launcher_round"
9+
android:supportsRtl="true"
10+
android:theme="@android:style/Theme.Material.Light.NoActionBar"
11+
android:extractNativeLibs="true">
12+
13+
<uses-native-library
14+
android:name="libcdsprpc.so"
15+
android:required="false" />
16+
17+
<activity
18+
android:name=".MainActivity"
19+
android:exported="true"
20+
android:label="@string/app_name"
21+
android:theme="@android:style/Theme.Material.Light.NoActionBar">
22+
<intent-filter>
23+
<action android:name="android.intent.action.MAIN" />
24+
25+
<category android:name="android.intent.category.LAUNCHER" />
26+
</intent-filter>
27+
</activity>
28+
</application>
29+
30+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
31+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
32+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
33+
<uses-permission android:name="android.permission.INTERNET" />
34+
35+
</manifest>

0 commit comments

Comments
 (0)