mirror of
https://github.com/shirayu/whispering.git
synced 2025-02-02 12:02:20 +00:00
Added --temperature argument
This commit is contained in:
parent
57ca9e9102
commit
39fea0b447
2 changed files with 15 additions and 2 deletions
|
@ -23,6 +23,7 @@ def transcribe_from_mic(
|
||||||
sd_device: Optional[Union[int, str]],
|
sd_device: Optional[Union[int, str]],
|
||||||
num_block: int,
|
num_block: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
logger.debug(f"WhisperConfig: {config}")
|
||||||
wsp = WhisperStreamingTranscriber(config=config)
|
wsp = WhisperStreamingTranscriber(config=config)
|
||||||
q = queue.Queue()
|
q = queue.Queue()
|
||||||
|
|
||||||
|
@ -83,6 +84,14 @@ def get_opts() -> argparse.Namespace:
|
||||||
default=20,
|
default=20,
|
||||||
help="Number of operation unit. Larger values can improve accuracy but consume more memory.",
|
help="Number of operation unit. Larger values can improve accuracy but consume more memory.",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--temperature",
|
||||||
|
"-t",
|
||||||
|
type=float,
|
||||||
|
action="append",
|
||||||
|
default=[],
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--mic",
|
"--mic",
|
||||||
)
|
)
|
||||||
|
@ -103,6 +112,9 @@ def main() -> None:
|
||||||
|
|
||||||
if opts.beam_size <= 0:
|
if opts.beam_size <= 0:
|
||||||
opts.beam_size = None
|
opts.beam_size = None
|
||||||
|
if len(opts.temperature) == 0:
|
||||||
|
opts.temperature = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts.mic = int(opts.mic)
|
opts.mic = int(opts.mic)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -113,6 +125,7 @@ def main() -> None:
|
||||||
language=opts.language,
|
language=opts.language,
|
||||||
device=opts.device,
|
device=opts.device,
|
||||||
beam_size=opts.beam_size,
|
beam_size=opts.beam_size,
|
||||||
|
temperatures=opts.temperature,
|
||||||
)
|
)
|
||||||
transcribe_from_mic(
|
transcribe_from_mic(
|
||||||
config=config,
|
config=config,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ class WhisperConfig(BaseModel):
|
||||||
device: str
|
device: str
|
||||||
language: str
|
language: str
|
||||||
|
|
||||||
|
temperatures: List[float]
|
||||||
fp16: bool = True
|
fp16: bool = True
|
||||||
temperatures: Tuple[float, ...] = (0.0, 0.2, 0.4, 0.6, 0.8, 1.0)
|
|
||||||
compression_ratio_threshold: Optional[float] = 2.4
|
compression_ratio_threshold: Optional[float] = 2.4
|
||||||
logprob_threshold: Optional[float] = -1.0
|
logprob_threshold: Optional[float] = -1.0
|
||||||
no_captions_threshold: Optional[float] = 0.6
|
no_captions_threshold: Optional[float] = 0.6
|
||||||
|
|
Loading…
Reference in a new issue