mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-22 21:23:02 +01:00
* Rename voice-control to hex everywhere, without migrations The Cargo package and binary are now hex, every OS keeps its data in a hex folder, and VOICE_CONTROL_* variables are HEX_*. Hex is a fresh app: the macOS voice-control rename, its symlink, and the Windows and Linux beta settings imports are gone. The Windows installer gets a new AppId so it never takes over an old voice-control install's entry. * Format * Drop the Windows paste-last default only the beta import used
57 lines
2.1 KiB
Shell
Executable file
57 lines
2.1 KiB
Shell
Executable file
#!/bin/sh
|
|
set -eu
|
|
|
|
if [ "$#" -ne 1 ] || [ "$(uname -s)" != Darwin ]; then
|
|
echo "Usage (macOS): $0 /path/to/cohere-transcribe-03-2026-Q8_0.gguf" >&2
|
|
exit 2
|
|
fi
|
|
|
|
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
model=$(python3 -c 'import os,sys; print(os.path.abspath(sys.argv[1]))' "$1")
|
|
test -f "$model"
|
|
fixtures=$(mktemp -d "${TMPDIR:-/tmp}/hex-cohere-fixtures.XXXXXX")
|
|
cleanup() {
|
|
result=$?
|
|
if [ "$result" -eq 0 ] && [ "${HEX_KEEP_COHERE_FIXTURES:-0}" != 1 ]; then
|
|
rm -rf "$fixtures"
|
|
else
|
|
echo "Synthetic fixture evidence retained at $fixtures" >&2
|
|
fi
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
python3 - "$root/tests/fixtures/cohere-long-form.txt" "$fixtures" <<'PY'
|
|
from pathlib import Path
|
|
import sys
|
|
paragraphs = Path(sys.argv[1]).read_text().strip().split("\n\n")
|
|
assert len(paragraphs) == 3
|
|
for name, text in zip(("opening", "middle", "ending"), paragraphs):
|
|
(Path(sys.argv[2]) / f"{name}.txt").write_text(text)
|
|
PY
|
|
|
|
for part in opening middle ending; do
|
|
/usr/bin/say -v Samantha -r 165 -f "$fixtures/$part.txt" \
|
|
-o "$fixtures/$part.wav" --file-format=WAVE --data-format=LEI16@16000
|
|
done
|
|
|
|
python3 - "$fixtures" <<'PY'
|
|
from pathlib import Path
|
|
import sys, wave
|
|
root = Path(sys.argv[1])
|
|
parts = []
|
|
for name in ("opening", "middle", "ending"):
|
|
with wave.open(str(root / f"{name}.wav"), "rb") as audio:
|
|
assert (audio.getnchannels(), audio.getsampwidth(), audio.getframerate()) == (1, 2, 16000)
|
|
parts.append(audio.readframes(audio.getnframes()))
|
|
for name, pause, repeats in (("long-continuous", 0, 1), ("long-pauses", 8, 1), ("long-repeated", 8, 3)):
|
|
with wave.open(str(root / f"{name}.wav"), "wb") as audio:
|
|
audio.setparams((1, 2, 16000, 0, "NONE", "not compressed"))
|
|
audio.writeframes((b"\0\0" * (16000 * pause)).join(parts * repeats))
|
|
PY
|
|
|
|
# This runs inference on generated speech only, without a listener or microphone.
|
|
cd "$root"
|
|
HEX_APPLICATION_SUPPORT_DIR="$fixtures/support" \
|
|
HEX_COHERE_MODEL="$model" HEX_COHERE_FIXTURES="$fixtures" \
|
|
cargo test --locked --release --bin hex \
|
|
cohere_long_form_keeps_all_sections_with_and_without_pauses -- --ignored --nocapture
|