From 96c90f5e819ce429516c300ee696cdfa316c6cb3 Mon Sep 17 00:00:00 2001 From: Tianshu Cheng <26018552+tianshuc0731@users.noreply.github.com> Date: Fri, 23 May 2025 18:56:53 -0700 Subject: [PATCH 1/3] update --- orpheus-best-performance/call.py | 65 +++++++++++++++++++++++++--- orpheus-best-performance/config.yaml | 2 +- 2 files changed, 60 insertions(+), 7 deletions(-) diff --git a/orpheus-best-performance/call.py b/orpheus-best-performance/call.py index 7d307a067..382f35f08 100644 --- a/orpheus-best-performance/call.py +++ b/orpheus-best-performance/call.py @@ -2,14 +2,14 @@ import aiohttp import uuid import time -import os +import struct from concurrent.futures import ProcessPoolExecutor # Configuration -MODEL = "dq4rlnkw" +MODEL = "03yxn1lq" BASETEN_HOST = f"https://model-{MODEL}.api.baseten.co/production/predict" -BASETEN_API_KEY = os.environ["BASETEN_API_KEY"] -PAYLOADS_PER_PROCESS = 2000 +BASETEN_API_KEY = "zcqOMgeU.xGJlLqKffJHr1ASqJ5qBC9QVP5wLV9Z8" +PAYLOADS_PER_PROCESS = 1 NUM_PROCESSES = 4 MAX_REQUESTS_PER_PROCESS = 8 @@ -87,9 +87,11 @@ async def run_session( return elif run_id < 3: fn = f"output_{ptype}_run{run_id}.wav" + # Convert raw PCM data to proper WAV format + wav_data = pcm_to_wav(buf) with open(fn, "wb") as f: - f.write(buf) - print(f"[{label}] ➔ saved {fn}") + f.write(wav_data) + print(f"[{label}] ➔ saved {fn} (converted to WAV)") except Exception as e: print(f"[{label}] 🛑 failed: {e!r}") @@ -130,5 +132,56 @@ def main(): print("🎉 All processes completed.") +def pcm_to_wav( + pcm_data: bytes, + sample_rate: int = 24000, + channels: int = 1, + bits_per_sample: int = 16, +) -> bytes: + """Convert raw PCM data to WAV format with proper headers.""" + # WAV file header + # RIFF header + riff_header = b"RIFF" + # File size (will be calculated) + file_size = 36 + len(pcm_data) + file_size_bytes = struct.pack(" Date: Fri, 23 May 2025 19:01:16 -0700 Subject: [PATCH 2/3] update --- orpheus-best-performance/call.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orpheus-best-performance/call.py b/orpheus-best-performance/call.py index 382f35f08..09537c8ff 100644 --- a/orpheus-best-performance/call.py +++ b/orpheus-best-performance/call.py @@ -6,9 +6,9 @@ from concurrent.futures import ProcessPoolExecutor # Configuration -MODEL = "03yxn1lq" +MODEL = "YOUR_MODEL_ID" BASETEN_HOST = f"https://model-{MODEL}.api.baseten.co/production/predict" -BASETEN_API_KEY = "zcqOMgeU.xGJlLqKffJHr1ASqJ5qBC9QVP5wLV9Z8" +BASETEN_API_KEY = os.getenv("BASETEN_API_KEY") PAYLOADS_PER_PROCESS = 1 NUM_PROCESSES = 4 MAX_REQUESTS_PER_PROCESS = 8 From f522a8c5ff0823ecb979e9ee3a1d507e61af0976 Mon Sep 17 00:00:00 2001 From: Tianshu Cheng <26018552+tianshuc0731@users.noreply.github.com> Date: Fri, 23 May 2025 19:03:46 -0700 Subject: [PATCH 3/3] update --- orpheus-best-performance/call.py | 1 + 1 file changed, 1 insertion(+) diff --git a/orpheus-best-performance/call.py b/orpheus-best-performance/call.py index 09537c8ff..71f3753a7 100644 --- a/orpheus-best-performance/call.py +++ b/orpheus-best-performance/call.py @@ -1,4 +1,5 @@ import asyncio +import os import aiohttp import uuid import time