Skip to content

Commit

Permalink
1.3.2
Browse files Browse the repository at this point in the history
* Squashed internal changes for 1.3.2

  - lyra_codec/README: update benchmark with TF 2.11 OSS numb... by mchinen <[email protected]>
  - lyra/android_example: Update number of conditioning vectors by mchinen <[email protected]>
  - lyra_codec/WORKSPACE: upgrade OSS to TensorFlow 2.11 by mchinen <[email protected]>

* Use bazelisk for 5.3.2 due to 6.0.0 issue; Run test in CI

  Don't run tests for android CI since it builds on ubuntu hosts.

* bump version to 1.3.2
  • Loading branch information
mchinen authored Dec 20, 2022
1 parent 1486761 commit 47698da
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 17 deletions.
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.3.2
10 changes: 8 additions & 2 deletions .github/actions/lyra-builder/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ runs:
- shell: bash
run: |
export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/21.4.7075529"
bazel build -c opt lyra/cli_example:encoder_main ${{ inputs.build-options }}
if [[ "${{inputs.platform}}" != "android" ]]; then
bazelisk test -c opt lyra/cli_example:encoder_main_lib_test ${{ inputs.build-options }}
fi
bazelisk build -c opt lyra/cli_example:encoder_main ${{ inputs.build-options }}
- shell: bash
run: |
export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/21.4.7075529"
bazel build -c opt lyra/cli_example:decoder_main ${{ inputs.build-options }}
if [[ "${{inputs.platform}}" != "android" ]]; then
bazelisk test -c opt lyra/cli_example:decoder_main_lib_test ${{ inputs.build-options }}
fi
bazelisk build -c opt lyra/cli_example:decoder_main ${{ inputs.build-options }}
- shell: bash
run: |
mkdir action-product
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
shell: bash
run: |
export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/21.4.7075529"
bazel build lyra/android_example:lyra_android_example --config=android_arm64 --copt=-DBENCHMARK
bazelisk build lyra/android_example:lyra_android_example --config=android_arm64 --copt=-DBENCHMARK
- name: Copy artifacts
shell: bash
run: |
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ If you press 'Benchmark', you should see something like the following in logcat
on a Pixel 6 Pro when running the benchmark:

```shell
lyra_benchmark: feature_extractor: max: 0.575 ms min: 0.131 ms mean: 0.139 ms stdev: 0.004 ms
lyra_benchmark: quantizer_quantize: max: 0.304 ms min: 0.105 ms mean: 0.109 ms stdev: 0.002 ms
lyra_benchmark: quantizer_decode: max: 0.103 ms min: 0.025 ms mean: 0.026 ms stdev: 0.000 ms
lyra_benchmark: model_decode: max: 0.462 ms min: 0.187 ms mean: 0.197 ms stdev: 0.001 ms
lyra_benchmark: total: max: 1.160 ms min: 0.452 ms mean: 0.473 ms stdev: 0.009 ms
lyra_benchmark: feature_extractor: max: 1.836 ms min: 0.132 ms mean: 0.153 ms stdev: 0.042 ms
lyra_benchmark: quantizer_quantize: max: 1.042 ms min: 0.120 ms mean: 0.130 ms stdev: 0.028 ms
lyra_benchmark: quantizer_decode: max: 0.103 ms min: 0.026 ms mean: 0.029 ms stdev: 0.003 ms
lyra_benchmark: model_decode: max: 0.820 ms min: 0.191 ms mean: 0.212 ms stdev: 0.031 ms
lyra_benchmark: total: max: 2.536 ms min: 0.471 ms mean: 0.525 ms stdev: 0.088 ms
```

This shows that decoding a 50Hz frame (each frame is 20 milliseconds) takes
0.473 milliseconds on average. So decoding is performed at around 42 (20/0.473)
0.525 milliseconds on average. So decoding is performed at around 38 (20/0.525)
times faster than realtime.

To build your own android app, you can either use the cc_library target outputs
Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ maven_install(
git_repository(
name = "org_tensorflow",
remote = "https://github.com/tensorflow/tensorflow.git",
# Below is reproducible and equivalent to `tag = "v2.9.0"`
commit = "8a20d54a3c1bfa38c03ea99a2ad3c1b0a45dfa95",
shallow_since = "1652465115 -0700"
# Below is reproducible and equivalent to `tag = "v2.11.0"`
commit = "d5b57ca93e506df258271ea00fc29cf98383a374",
shallow_since = "1668561432 -0800"
)

# Check bazel version requirement, which is stricter than TensorFlow's.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class MainActivity extends AppCompatActivity {

private static final int REQUEST_RECORD_AUDIO_PERMISSION = 200;
private static final int SAMPLE_RATE = 16000;
private static final int LYRA_NUM_RANDOM_FEATURE_VECTORS = 10000;
private static final String[] permissions = {Manifest.permission.RECORD_AUDIO};

private boolean hasStartedDecode = false;
Expand Down Expand Up @@ -252,7 +253,7 @@ public void runBenchmark(View view) {
Log.i(TAG, "Starting lyraBenchmark()");
// Example of a call to a C++ lyra method on a background
// thread.
lyraBenchmark(2000, weightsDirectory);
lyraBenchmark(LYRA_NUM_RANDOM_FEATURE_VECTORS, weightsDirectory);
Log.i(TAG, "Finished lyraBenchmark()");
tv.post(() -> tv.setText(R.string.benchmark_finished));
button.post(() -> button.setEnabled(true));
Expand Down
2 changes: 1 addition & 1 deletion lyra/lyra_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const int kVersionMajor = 1;
// |identifier| field needs to be set in lyra_config.textproto to match this.
const int kVersionMinor = 3;
// The micro version is for other things like a release of bugfixes.
const int kVersionMicro = 1;
const int kVersionMicro = 2;

const int kNumFeatures = 64;
const int kNumMelBins = 160;
Expand Down
5 changes: 2 additions & 3 deletions lyra/tflite_model_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ std::unique_ptr<TfLiteModelWrapper> TfLiteModelWrapper::Create(
if (use_xnn) {
// Enable XXNPack.
auto options = TfLiteXNNPackDelegateOptionsDefault();
if (int8_quantized) {
options.flags |= TFLITE_XNNPACK_DELEGATE_FLAG_QS8;
}
// TODO(b/219786261) Remove once XNNPACK is enabled by default.
options.flags |= TFLITE_XNNPACK_DELEGATE_FLAG_QU8;
options.num_threads = 1;
auto delegate =
std::unique_ptr<TfLiteDelegate, std::function<void(TfLiteDelegate*)> >(
Expand Down

0 comments on commit 47698da

Please sign in to comment.