Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rhasspy/wyoming-faster-whisper
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.3.0
Choose a base ref
...
head repository: rhasspy/wyoming-faster-whisper
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Dec 10, 2024

  1. Copy the full SHA
    85bd1e7 View commit details
Showing with 20 additions and 2 deletions.
  1. +4 −0 CHANGELOG.md
  2. +1 −1 wyoming_faster_whisper/VERSION
  3. +15 −1 wyoming_faster_whisper/__main__.py
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.4.0

- Add "auto" for model and beam size (0) to select values based on CPU

## 2.3.0

- Bump faster-whisper package to 1.1.0
2 changes: 1 addition & 1 deletion wyoming_faster_whisper/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.4.0
16 changes: 15 additions & 1 deletion wyoming_faster_whisper/__main__.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
import argparse
import asyncio
import logging
import platform
import re
from functools import partial

@@ -21,7 +22,7 @@ async def main() -> None:
parser.add_argument(
"--model",
required=True,
help="Name of faster-whisper model to use",
help="Name of faster-whisper model to use (or auto)",
)
parser.add_argument("--uri", required=True, help="unix:// or tcp://")
parser.add_argument(
@@ -52,6 +53,7 @@ async def main() -> None:
"--beam-size",
type=int,
default=5,
help="Size of beam during decoding (0 for auto)",
)
parser.add_argument(
"--initial-prompt",
@@ -79,6 +81,18 @@ async def main() -> None:
)
_LOGGER.debug(args)

# Automatic configuration for ARM
machine = platform.machine().lower()
is_arm = ("arm" in machine) or ("aarch" in machine)
if args.model == "auto":
args.model = "tiny-int8" if is_arm else "base-int8"
_LOGGER.debug("Model automatically selected: %s", args.model)

if args.beam_size <= 0:
args.beam_size = 1 if is_arm else 5
_LOGGER.debug("Beam size automatically selected: %s", args.beam_size)

# Resolve model name
model_name = args.model
match = re.match(r"^(tiny|base|small|medium)[.-]int8$", args.model)
if match: