Skip to content

Commit

Permalink
Add more Python examples doc for SenseVoice (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Jul 28, 2024
1 parent e2f65de commit e2e0d55
Show file tree
Hide file tree
Showing 16 changed files with 949 additions and 11 deletions.
42 changes: 35 additions & 7 deletions .github/workflows/build-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
cd /workspace
which latexmk
apk add --no-cache python3 py3-pip git make gcc zlib-dev libffi-dev openssl-dev musl-dev ghostscript
apk add --no-cache python3 py3-pip git make gcc zlib-dev libffi-dev openssl-dev musl-dev ghostscript curl
python3 --version
Expand All @@ -86,7 +86,20 @@ jobs:
python3 -m pip install -r ./docs/requirements.txt
cd docs
# Download test wave files for SenseVoice
mkdir -p source/_static/sense-voice
pushd source/_static/sense-voice
rm .gitignore
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/lei-jun-test.wav
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/Obama.wav
curl -SL -O https://huggingface.co/csukuangfj/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17/resolve/main/test_wavs/zh.wav
curl -SL -O https://huggingface.co/csukuangfj/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17/resolve/main/test_wavs/en.wav
ls -lh
popd
make html
touch build/html/.nojekyll
export GIT_LFS_SKIP_SMUDGE=1
Expand Down Expand Up @@ -171,12 +184,27 @@ jobs:
popd
git diff
make latex
mkdir -pv build/html/_static
cd build/latex
latexmk -interaction=nonstopmode -f -pdf -dvi- -ps- sherpa.tex || true
ls -lh sherpa.pdf
cp -v sherpa.pdf ../html/
if true; then
make latex >/dev/null 2>&1
mkdir -pv build/html/_static
cd build/latex
latexmk -interaction=nonstopmode -f -pdf -dvi- -ps- sherpa.tex >/dev/null 2>&1 || true
ls -lh sherpa.pdf
cp -v sherpa.pdf ../html/
fi
- name: View generated files
shell: bash
run: |
cd docs/build/html
ls -lh
echo "-----_static-----"
ls -lh _static
echo "-----_static/sense-voice-----"
ls -lh _static/sense-voice
- name: Release sherpa.pdf
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push'
Expand Down
12 changes: 12 additions & 0 deletions docs/source/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.toggle .header {
display: block;
clear: both;
}

.toggle .header:after {
content: " ▶";
}

.toggle .header.open:after {
content: " ▼";
}
1 change: 1 addition & 0 deletions docs/source/_static/sense-voice/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.wav
Binary file not shown.
Empty file added docs/source/_templates/.gitkeep
Empty file.
15 changes: 15 additions & 0 deletions docs/source/_templates/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- see https://stackoverflow.com/questions/2454577/sphinx-restructuredtext-show-hide-code-snippets -->
{% extends "!page.html" %}

{% block footer %}
<script type="text/javascript">
$(document).ready(function() {
$(".toggle > *").hide();
$(".toggle .header").show();
$(".toggle .header").click(function() {
$(this).parent().children().not(".header").toggle(400);
$(this).parent().children(".header").toggleClass("open");
})
});
</script>
{% endblock %}
4 changes: 4 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,7 @@ def get_version():
.. _SenseVoice: https://github.com/FunAudioLLM/SenseVoice
.. _LibriTTS-R: https://www.openslr.org/141/
"""


def setup(app):
app.add_css_file("custom.css")
5 changes: 2 additions & 3 deletions docs/source/onnx/android/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ Android
=======


In this section, we describe how to build an Android app for ``real-time`` speech
recognition with `sherpa-onnx`_.
In this section, we describe how to build an Android app for with `sherpa-onnx`_.

.. hint::

During speech recognition, it does not need to access the Internet.
For real-time speech recognition, it does not need to access the Internet.
Everyting is processed locally on your phone.

.. toctree::
Expand Down
184 changes: 184 additions & 0 deletions docs/source/onnx/sense-voice/code/Obama.srt
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
1
0:00:09,286 --> 0:00:12,486
Everybody, all right, everybody, go ahead and have a seat.

2
0:00:13,094 --> 0:00:15,014
How's everybody doing today?

3
0:00:18,694 --> 0:00:20,742
How about Tim Sper.

4
0:00:25,894 --> 0:00:31,942
I am here with students at Wakefield High School in Arlington, Virginia.

5
0:00:32,710 --> 0:00:48,326
And we've got students tuning in from all across America, from kindergarten through 12th grade. And I am just so glad that all could join us today. And I want to thank Wakefield for being such an outstanding host. Give yourselves a big line.

6
0:00:54,406 --> 0:00:59,238
Now I know that for many of you, today is the first day of school.

7
0:00:59,590 --> 0:01:09,798
And for those of you in kindergarten or starting middle or high school, it's your first day in a new school, so it's understandable if you're a little nervous.

8
0:01:10,630 --> 0:01:16,006
I imagine there's some seniors out there who are feeling pretty good right now with just one more year to go.

9
0:01:18,790 --> 0:01:27,142
And no matter what grade you're in, some of you are probably wishing it we're still summer, and you could have stayed in bed just a little bit longer this morning.

10
0:01:27,942 --> 0:01:29,414
I know that field.

11
0:01:31,654 --> 0:01:51,708
When I was young, my family lived overseas, I lived in Indonesia for a few years and my mother, she didn't have the money to send me where all the American kids went to school, but she thought it was important for me to keep up with American education, so she decided to teach me extra lessons herself.

12
0:01:52,230 --> 0:01:58,790
Monday through Friday, but because she had to go to work, the only time she could do it was at 430 in the morning.

13
0:02:00,038 --> 0:02:03,750
Now as you might imagine, I wasn't too happy about getting up that early.

14
0:02:04,102 --> 0:02:07,302
A lot of times I'd fall asleep right there at the kitchen table.

15
0:02:08,262 --> 0:02:15,014
But whenever I'd complained, my mother would just give me one of those looks and she'd say, this is no picnic for me either, Buster.

16
0:02:17,094 --> 0:02:25,382
So I know that some of you are still adjusting to being back at school, but I'm here today because I have something important to discuss with you.

17
0:02:25,798 --> 0:02:33,798
I'm here because I want to talk with you about your education and what's expected of all of you in this new school year.

18
0:02:34,470 --> 0:02:40,422
I've given a lot of speeches about education, and I've talked about responsibility a lot.

19
0:02:40,806 --> 0:02:47,174
I've talked about teachers responsibility for inspiring students and pushing you to learn.

20
0:02:47,430 --> 0:02:58,726
I talked about your parents' responsibility for making sure you stay on track and you get your homework done and don't spend every waking hour in front of the TV or with the Xbox.

21
0:02:59,078 --> 0:03:00,774
I've talked a lot about.

22
0:03:01,350 --> 0:03:13,286
Your government's responsibility for setting high standards and supporting teachers and principals and turning around schools that aren't working where students aren't getting the opportunities that they deserve.

23
0:03:13,990 --> 0:03:15,366
But at the end of the day.

24
0:03:16,006 --> 0:03:26,054
We can have the most dedicated teachers, the most supportive parents, the best schools in the world, and none of it will make a difference, none of it will matter.

25
0:03:26,694 --> 0:03:30,694
Unless all of you fulfill your responsibilities.

26
0:03:31,238 --> 0:03:43,814
Unless you show up to those schools, unless you pay attention to those teachers, unless you listen to your parents and grandparents and other adults and put in the hard work it takes to succeed.

27
0:03:44,646 --> 0:03:46,598
That's what I want to focus on today.

28
0:03:47,110 --> 0:03:50,918
The responsibility each of you has for your education.

29
0:03:51,718 --> 0:03:54,854
I want to start with the responsibility you have to yourself.

30
0:03:55,654 --> 0:03:59,078
Every single one of you has something that you're good at.

31
0:03:59,782 --> 0:04:02,406
Every single one of you has something to offer.

32
0:04:02,982 --> 0:04:07,590
And you have a responsibility to yourself to discover what that is.

33
0:04:08,326 --> 0:04:11,494
That's the opportunity an education can provide.

34
0:04:12,326 --> 0:04:22,598
Maybe you could be a great writer, maybe even good enough to write a book or articles in a newspaper, but you might not know it until you write that English paper.

35
0:04:23,078 --> 0:04:25,894
That English class paper that's assigned to you.

36
0:04:26,694 --> 0:04:38,726
Maybe you could be an innovator or an inventor, maybe even good enough to come up with the next iPhone or the new medicine or a vaccine, but you might not know it until you do your project for your science class.

37
0:04:39,814 --> 0:04:44,838
Maybe you could be a mayor or a senator or a Supreme Court justice.

38
0:04:45,350 --> 0:04:50,182
But you might not know that until you join student government or the debate team.

39
0:04:51,558 --> 0:04:56,774
And no matter what you want to do with your life, I guarantee that you'll need an education to do it.

40
0:04:57,318 --> 0:05:00,710
You want to be a doctor or a teacher or a police officer?

41
0:05:00,998 --> 0:05:09,702
You want to be a nurse or an architect, a lawyer or a member of our military, you're going to need a good education for every single one of those careers.

42
0:05:10,054 --> 0:05:14,278
You cannot drop out of school and just drop into a good job.

43
0:05:15,174 --> 0:05:19,846
You've got to train for it and work for it and learn for it.

44
0:05:20,518 --> 0:05:23,654
And this isn't just important for your own life and your own future.

45
0:05:24,678 --> 0:05:29,670
What you make of your education will decide nothing less than the future of this country.

46
0:05:29,958 --> 0:05:32,998
The future of America depends on you.

Loading

0 comments on commit e2e0d55

Please sign in to comment.