DocWolle commited on
Commit
3316a96
·
verified ·
1 Parent(s): ae9d5e6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -1
README.md CHANGED
@@ -5,4 +5,34 @@ pipeline_tag: automatic-speech-recognition
5
 
6
  # Whisper tflite models for use in Whisper app on F-Droid
7
 
8
- "transcribe-translate" models provide signatures for "serving_transcribe" and "serving_translate" to force the model to perform a certain action
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  # Whisper tflite models for use in Whisper app on F-Droid
7
 
8
+ "transcribe-translate" models provide signatures for "serving_transcribe" and "serving_translate" to force the model to perform a certain action
9
+
10
+ ```
11
+ @tf.function(
12
+ input_signature=[
13
+ tf.TensorSpec((1, 80, 3000), tf.float32, name="input_features"),
14
+ ],
15
+ )
16
+ def transcribe(self, input_features):
17
+ outputs = self.model.generate(
18
+ input_features,
19
+ max_new_tokens=450, # change as needed
20
+ return_dict_in_generate=True,
21
+ forced_decoder_ids=[[2, 50359], [3, 50363]], # forced to transcribe any language with no timestamps
22
+ )
23
+ return {"sequences": outputs["sequences"]}
24
+
25
+ @tf.function(
26
+ input_signature=[
27
+ tf.TensorSpec((1, 80, 3000), tf.float32, name="input_features"),
28
+ ],
29
+ )
30
+ def translate(self, input_features):
31
+ outputs = self.model.generate(
32
+ input_features,
33
+ max_new_tokens=450, # change as needed
34
+ return_dict_in_generate=True,
35
+ forced_decoder_ids=[[2, 50358], [3, 50363]], # different forced_decoder_ids
36
+ )
37
+ return {"sequences": outputs["sequences"]}
38
+ ``