Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

fix/Speechrecognition-App #294

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions SpeechRecognition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ In this demo app, we'll show how to quantize, trace, and optimize the wav2vec2 m

## Prerequisites

* PyTorch 1.10.0 and torchaudio 0.10.0 (Optional)
* PyTorch 1.13.0 and torchaudio 0.14.0 (Optional)
* Python 3.8 (Optional)
* Android Pytorch library org.pytorch:pytorch_android_lite:1.10.0
* Android Pytorch library org.pytorch:pytorch_android_lite:1.13.0
* Android Studio 4.0.1 or later

## Quick Start
Expand All @@ -24,19 +24,19 @@ git clone https://github.com/pytorch/android-demo-app
cd android-demo-app/SpeechRecognition
```

If you don't have PyTorch 1.10.0 and torchaudio 0.10.0 installed or want to have a quick try of the demo app, you can download the quantized scripted wav2vec2 model file [here](https://drive.google.com/file/d/1xMh-BZMSIeoohBfZvQFYcemmh5zUn_gh/view?usp=sharing), then drag and drop it to the `app/src/main/assets` folder inside `android-demo-app/SpeechRecognition`, and continue to Step 3.
If you don't have PyTorch 1.13.0 and torchaudio 0.14.0 installed or want to have a quick try of the demo app, you can download the quantized scripted wav2vec2 model file [here](https://drive.google.com/file/d/1xMh-BZMSIeoohBfZvQFYcemmh5zUn_gh/view?usp=sharing), then drag and drop it to the `app/src/main/assets` folder inside `android-demo-app/SpeechRecognition`, and continue to Step 3.

### 2. Prepare the Model

To install PyTorch 1.10.0, torchaudio 0.10.0 and the Hugging Face transformers, you can do something like this:
To install PyTorch 1.13.0, torchaudio 0.14.0 and the Hugging Face transformers, you can do something like this:

```
conda create -n wav2vec2 python=3.8.5
conda activate wav2vec2
pip install torch torchaudio transformers
```

Now with PyTorch 1.10.0 and torchaudio 0.10.0 installed, run the following commands on a Terminal:
Now with PyTorch 1.13.0 and torchaudio 0.14.0 installed, run the following commands on a Terminal:

```
python create_wav2vec2.py
Expand Down
12 changes: 9 additions & 3 deletions SpeechRecognition/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ repositories {
}

android {
compileSdkVersion 30
compileSdkVersion 33
buildToolsVersion "30.0.2"

defaultConfig {
applicationId "org.pytorch.demo.speechrecognition"
minSdkVersion 28
targetSdkVersion 30
targetSdkVersion 33
versionCode 1
versionName "1.0"

Expand All @@ -40,5 +40,11 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation 'org.pytorch:pytorch_android_lite:1.10.0'
implementation 'org.pytorch:pytorch_android_lite:1.13.0'

implementation 'com.facebook.fbjni:fbjni-java-only:0.0.3'

// if using the libraries built from source
// implementation(name:'pytorch_android-release', ext:'aar')
// implementation(name:'pytorch_android_torchvision-release', ext:'aar')
}
3 changes: 2 additions & 1 deletion SpeechRecognition/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
4 changes: 4 additions & 0 deletions SpeechRecognition/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ allprojects {
repositories {
google()
jcenter()
mavenCentral()
flatDir {
dirs 'libs'
}
}
}

Expand Down