mirror of
https://github.com/shirayu/whispering.git
synced 2024-11-29 04:21:07 +00:00
Add buffer_threshold to WhisperConfig
This commit is contained in:
parent
f1d85762fc
commit
c18f5e4993
2 changed files with 2 additions and 1 deletions
|
@ -22,6 +22,7 @@ class WhisperConfig(BaseModel):
|
||||||
no_speech_threshold: Optional[float] = 0.6
|
no_speech_threshold: Optional[float] = 0.6
|
||||||
logprob_threshold: Optional[float] = -1.0
|
logprob_threshold: Optional[float] = -1.0
|
||||||
compression_ratio_threshold: Optional[float] = 2.4
|
compression_ratio_threshold: Optional[float] = 2.4
|
||||||
|
buffer_threshold: Optional[float] = 0.5
|
||||||
|
|
||||||
|
|
||||||
class Context(BaseModel, arbitrary_types_allowed=True):
|
class Context(BaseModel, arbitrary_types_allowed=True):
|
||||||
|
|
|
@ -221,7 +221,7 @@ class WhisperStreamingTranscriber:
|
||||||
yield chunk
|
yield chunk
|
||||||
ctx.timestamp += duration
|
ctx.timestamp += duration
|
||||||
|
|
||||||
if result.temperature > 0.5:
|
if result.temperature > self.config.buffer_threshold:
|
||||||
# do not feed the prompt tokens if a high temperature was used
|
# do not feed the prompt tokens if a high temperature was used
|
||||||
del ctx.buffer_tokens
|
del ctx.buffer_tokens
|
||||||
ctx.buffer_tokens = []
|
ctx.buffer_tokens = []
|
||||||
|
|
Loading…
Reference in a new issue