The DRED extension found in an Opus packet's padding (RFC 6716 framing, the extension draft's iterator with its repeat mechanism), its payload parsed to integers over RFC 6716's range decoder, the decoder weights file parsed and expanded from its storage layouts, and the lowering dred-int/1: weights quantized from their float32 bits, tanh and the sigmoid as lut16 tables of a fixed integer computation, the decoder as two WHG1 graphs loaded under acc64. A floating-point reference with a deterministic exponential, the draft's feature comparison, a stream under a seeded loss pattern, and the corpus generator. Behind the feature dred_exact; the weights are pinned by digest and fetched, never committed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
40 lines
1.8 KiB
Shell
Executable file
40 lines
1.8 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# fetch.sh <dir> [vectors]
|
|
#
|
|
# Fetch the files of draft-ietf-mlcodec-opus-dred-07 that the corpus names by digest and does not
|
|
# hold, into <dir>, and check each against the SHA-256 the draft states (§7.1):
|
|
#
|
|
# dred_unquantized_weights.bin the decoder weights ([DRED-Weights]): the profile's parameter set
|
|
# dred_testvectors.tar.gz the conformance test vectors ([DRED-Test-Vectors]), with
|
|
# `vectors`, unpacked into <dir>/dred_testvectors/ (the
|
|
# measurement of extensions/opus-dred.md §6 reads them)
|
|
#
|
|
# A file already in <dir> with the right digest is not fetched again. A digest that does not match
|
|
# fails, and the file is removed. The locations are the draft's own references.
|
|
set -euo pipefail
|
|
dir=${1:?usage: fetch.sh <dir> [vectors]}
|
|
base="https://media.xiph.org/opus/ietf/dred_material"
|
|
mkdir -p "$dir"
|
|
sha() { if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi; }
|
|
get() {
|
|
local name=$1 want=$2
|
|
if [ -f "$dir/$name" ] && [ "$(sha "$dir/$name")" = "$want" ]; then return 0; fi
|
|
curl -sSfL --retry 3 -o "$dir/$name.part" "$base/$name"
|
|
local got
|
|
got=$(sha "$dir/$name.part")
|
|
if [ "$got" != "$want" ]; then
|
|
rm -f "$dir/$name.part"
|
|
echo "fetch.sh: $name has SHA-256 $got, not $want" >&2
|
|
exit 1
|
|
fi
|
|
mv "$dir/$name.part" "$dir/$name"
|
|
}
|
|
get dred_unquantized_weights.bin 394f0ecf19926cebd678019dc94a54c88ae078340c16325069707f286cdf28a6
|
|
if [ "${2:-}" = vectors ]; then
|
|
get dred_testvectors.tar.gz 0af7a068783d9d1397a67ed7896615d0777fb69fa258e4f192dea4f61226ad31
|
|
if [ ! -d "$dir/dred_testvectors" ]; then
|
|
tar -xzf "$dir/dred_testvectors.tar.gz" -C "$dir"
|
|
fi
|
|
fi
|
|
echo "fetch.sh: $dir holds the pinned files"
|