File tree 3 files changed +13
-1
lines changed
3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,11 @@ func (p *Params) SetMaxTokensPerSegment(n int) {
118
118
p .max_tokens = C .int (n )
119
119
}
120
120
121
+ // Set audio encoder context
122
+ func (p * Params ) SetAudioCtx (n int ) {
123
+ p .audio_ctx = C .int (n )
124
+ }
125
+
121
126
///////////////////////////////////////////////////////////////////////////////
122
127
// PRIVATE METHODS
123
128
@@ -141,6 +146,7 @@ func (p *Params) String() string {
141
146
str += fmt .Sprintf (" n_max_text_ctx=%d" , p .n_max_text_ctx )
142
147
str += fmt .Sprintf (" offset_ms=%d" , p .offset_ms )
143
148
str += fmt .Sprintf (" duration_ms=%d" , p .duration_ms )
149
+ str += fmt .Sprintf (" audio_ctx=%d" , p .audio_ctx )
144
150
if p .translate {
145
151
str += " translate"
146
152
}
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ func (context *context) SetSpeedup(v bool) {
82
82
}
83
83
84
84
func (context * context ) SetSplitOnWord (v bool ) {
85
- context .params .SetSplitOnWord (v )
85
+ context .params .SetSplitOnWord (v )
86
86
}
87
87
88
88
// Set number of threads to use
@@ -125,6 +125,11 @@ func (context *context) SetMaxTokensPerSegment(n uint) {
125
125
context .params .SetMaxTokensPerSegment (int (n ))
126
126
}
127
127
128
+ // Set audio encoder context
129
+ func (context * context ) SetAudioCtx (n uint ) {
130
+ context .params .SetAudioCtx (int (n ))
131
+ }
132
+
128
133
// ResetTimings resets the mode timings. Should be called before processing
129
134
func (context * context ) ResetTimings () {
130
135
context .model .ctx .Whisper_reset_timings ()
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ type Context interface {
48
48
SetMaxSegmentLength (uint ) // Set max segment length in characters
49
49
SetTokenTimestamps (bool ) // Set token timestamps flag
50
50
SetMaxTokensPerSegment (uint ) // Set max tokens per segment (0 = no limit)
51
+ SetAudioCtx (uint ) // Set audio encoder context
51
52
52
53
// Process mono audio data and return any errors.
53
54
// If defined, newly generated segments are passed to the
You can’t perform that action at this time.
0 commit comments