mirror of
https://github.com/shirayu/whispering.git
synced 2024-11-25 18:31:00 +00:00
Remove multi language feature (Close #23)
This commit is contained in:
parent
04bb9f9ad2
commit
526c2ec1d1
3 changed files with 6 additions and 10 deletions
|
@ -31,7 +31,7 @@ whispering --language en --model tiny
|
||||||
|
|
||||||
- ``--help`` shows full options
|
- ``--help`` shows full options
|
||||||
- ``--model`` set the [model name](https://github.com/openai/whisper#available-models-and-languages) to use. Larger models will be more accurate, but may not be able to transcribe in real time.
|
- ``--model`` set the [model name](https://github.com/openai/whisper#available-models-and-languages) to use. Larger models will be more accurate, but may not be able to transcribe in real time.
|
||||||
- ``--language`` sets the language to transcribe. Use ``multi`` for multi languages. The list of languages are shown with ``whispering -h``
|
- ``--language`` sets the language to transcribe. The list of languages are shown with ``whispering -h``
|
||||||
- ``--no-progress`` disables the progress message
|
- ``--no-progress`` disables the progress message
|
||||||
- ``-t`` sets temperatures to decode. You can set several like ``-t 0.0 -t 0.1 -t 0.5``, but too many temperatures exhaust decoding time
|
- ``-t`` sets temperatures to decode. You can set several like ``-t 0.0 -t 0.1 -t 0.5``, but too many temperatures exhaust decoding time
|
||||||
- ``--debug`` outputs logs for debug
|
- ``--debug`` outputs logs for debug
|
||||||
|
|
|
@ -16,7 +16,7 @@ from whisper.audio import N_FRAMES, SAMPLE_RATE
|
||||||
from whisper.tokenizer import LANGUAGES, TO_LANGUAGE_CODE
|
from whisper.tokenizer import LANGUAGES, TO_LANGUAGE_CODE
|
||||||
|
|
||||||
from whispering.pbar import ProgressBar
|
from whispering.pbar import ProgressBar
|
||||||
from whispering.schema import MULTI_LANGUAGE, Context, StdoutWriter, WhisperConfig
|
from whispering.schema import Context, StdoutWriter, WhisperConfig
|
||||||
from whispering.serve import serve_with_websocket
|
from whispering.serve import serve_with_websocket
|
||||||
from whispering.transcriber import WhisperStreamingTranscriber
|
from whispering.transcriber import WhisperStreamingTranscriber
|
||||||
from whispering.websocket_client import run_websocket_client
|
from whispering.websocket_client import run_websocket_client
|
||||||
|
@ -105,9 +105,7 @@ def get_opts() -> argparse.Namespace:
|
||||||
group_model.add_argument(
|
group_model.add_argument(
|
||||||
"--language",
|
"--language",
|
||||||
type=str,
|
type=str,
|
||||||
default=None,
|
choices=sorted(LANGUAGES.keys())
|
||||||
choices=[MULTI_LANGUAGE]
|
|
||||||
+ sorted(LANGUAGES.keys())
|
|
||||||
+ sorted([k.title() for k in TO_LANGUAGE_CODE.keys()]),
|
+ sorted([k.title() for k in TO_LANGUAGE_CODE.keys()]),
|
||||||
)
|
)
|
||||||
group_model.add_argument(
|
group_model.add_argument(
|
||||||
|
@ -206,7 +204,7 @@ def get_opts() -> argparse.Namespace:
|
||||||
def get_wshiper(*, opts) -> WhisperStreamingTranscriber:
|
def get_wshiper(*, opts) -> WhisperStreamingTranscriber:
|
||||||
config = WhisperConfig(
|
config = WhisperConfig(
|
||||||
model_name=opts.model,
|
model_name=opts.model,
|
||||||
language=None if opts.language == MULTI_LANGUAGE else opts.language,
|
language=opts.language,
|
||||||
device=opts.device,
|
device=opts.device,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from typing import Final, List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
from pydantic import BaseModel, root_validator
|
from pydantic import BaseModel, root_validator
|
||||||
|
|
||||||
MULTI_LANGUAGE: Final[str] = "multi"
|
|
||||||
|
|
||||||
|
|
||||||
class WhisperConfig(BaseModel):
|
class WhisperConfig(BaseModel):
|
||||||
model_name: str
|
model_name: str
|
||||||
device: str
|
device: str
|
||||||
language: Optional[str]
|
language: str
|
||||||
fp16: bool = True
|
fp16: bool = True
|
||||||
|
|
||||||
@root_validator
|
@root_validator
|
||||||
|
|
Loading…
Reference in a new issue