Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27c6917149 | ||
|
|
a2dd5feb80 | ||
|
|
779aa534ba | ||
|
|
effe5b347f | ||
|
|
42426e7c10 | ||
|
|
1a6879b8a4 | ||
|
|
3a3aebde0c | ||
|
|
b5bb75a032 | ||
|
|
0e48b214da | ||
|
|
dc45f1b5cd | ||
|
|
c0a264452c | ||
|
|
35e063e102 | ||
|
|
89b1bdbb0e |
No files matched your search
@@ -1,7 +1,6 @@
|
|||||||
steps:
|
steps:
|
||||||
- label: "Dummy pipeline"
|
- label: ":toolbox: Qwen2.5 omni offline example"
|
||||||
if: "false"
|
|
||||||
agents:
|
|
||||||
queue: cpu_queue_premerge_us_east_1
|
|
||||||
commands:
|
commands:
|
||||||
- "echo 'This pipeline is intentionally a no-op.'"
|
- ".buildkite/scripts/run_qwen_offline_example.sh"
|
||||||
|
agents:
|
||||||
|
queue: "gpu_1_queue" # g6.4xlarge instance on AWS, has 1 L4 GPU
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Move to repo root (script lives in .buildkite/scripts/)
|
||||||
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||||
|
cd "${ROOT_DIR}"
|
||||||
|
|
||||||
|
UV_INSTALL_DIR="${ROOT_DIR}/.local/bin"
|
||||||
|
case ":${PATH}:" in
|
||||||
|
*":${UV_INSTALL_DIR}:"*) ;;
|
||||||
|
*) export PATH="${UV_INSTALL_DIR}:${PATH}" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if ! command -v uv >/dev/null 2>&1; then
|
||||||
|
mkdir -p "${UV_INSTALL_DIR}"
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="${UV_INSTALL_DIR}" sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
UV_BIN=(uv)
|
||||||
|
|
||||||
|
"${UV_BIN[@]}" python install 3.12
|
||||||
|
"${UV_BIN[@]}" venv --python 3.12 .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
|
||||||
|
"${UV_BIN[@]}" pip install -e .
|
||||||
|
"${UV_BIN[@]}" pip install vllm==0.11.0 --torch-backend=auto
|
||||||
|
|
||||||
|
EXAMPLE_DIR="examples/offline_inference/qwen2_5_omni"
|
||||||
|
cd "${EXAMPLE_DIR}"
|
||||||
|
|
||||||
|
python end2end.py --query-type text \
|
||||||
|
--no-save-results
|
||||||
@@ -5,6 +5,7 @@ This example shows how to use vLLM-omni for running offline inference
|
|||||||
with the correct prompt format on Qwen2.5-Omni
|
with the correct prompt format on Qwen2.5-Omni
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
import os
|
import os
|
||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
|
|
||||||
@@ -195,35 +196,43 @@ def main(args):
|
|||||||
|
|
||||||
omni_outputs = omni_llm.generate(prompts, sampling_params_list)
|
omni_outputs = omni_llm.generate(prompts, sampling_params_list)
|
||||||
|
|
||||||
# Determine output directory: prefer --output-dir; fallback to --output-wav
|
output_dir = None
|
||||||
output_dir = args.output_dir if getattr(args, "output_dir", None) else args.output_wav
|
if args.save_results:
|
||||||
os.makedirs(output_dir, exist_ok=True)
|
# Determine output directory: prefer --output-dir; fallback to --output-wav
|
||||||
|
output_dir = args.output_dir if getattr(args, "output_dir", None) else args.output_wav
|
||||||
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
for stage_outputs in omni_outputs:
|
for stage_outputs in omni_outputs:
|
||||||
if stage_outputs.final_output_type == "text":
|
if stage_outputs.final_output_type == "text":
|
||||||
for output in stage_outputs.request_output:
|
for output in stage_outputs.request_output:
|
||||||
request_id = int(output.request_id)
|
request_id = int(output.request_id)
|
||||||
text_output = output.outputs[0].text
|
text_output = output.outputs[0].text
|
||||||
# Save aligned text file per request
|
if args.save_results:
|
||||||
prompt_text = prompts[request_id]["prompt"]
|
# Save aligned text file per request
|
||||||
out_txt = os.path.join(output_dir, f"{request_id:05d}.txt")
|
prompt_text = prompts[request_id]["prompt"]
|
||||||
lines = []
|
out_txt = os.path.join(output_dir, f"{request_id:05d}.txt")
|
||||||
lines.append("Prompt:\n")
|
lines = []
|
||||||
lines.append(str(prompt_text) + "\n")
|
lines.append("Prompt:\n")
|
||||||
lines.append("vllm_text_output:\n")
|
lines.append(str(prompt_text) + "\n")
|
||||||
lines.append(str(text_output).strip() + "\n")
|
lines.append("vllm_text_output:\n")
|
||||||
try:
|
lines.append(str(text_output).strip() + "\n")
|
||||||
with open(out_txt, "w", encoding="utf-8") as f:
|
try:
|
||||||
f.writelines(lines)
|
with open(out_txt, "w", encoding="utf-8") as f:
|
||||||
except Exception as e:
|
f.writelines(lines)
|
||||||
print(f"[Warn] Failed writing text file {out_txt}: {e}")
|
except Exception as e:
|
||||||
print(f"Request ID: {request_id}, Text saved to {out_txt}")
|
print(f"[Warn] Failed writing text file {out_txt}: {e}")
|
||||||
|
print(f"Request ID: {request_id}, Text saved to {out_txt}")
|
||||||
|
else:
|
||||||
|
print(f"Request ID: {request_id}, Text output:\n{text_output}")
|
||||||
elif stage_outputs.final_output_type == "audio":
|
elif stage_outputs.final_output_type == "audio":
|
||||||
for output in stage_outputs.request_output:
|
for output in stage_outputs.request_output:
|
||||||
request_id = int(output.request_id)
|
request_id = int(output.request_id)
|
||||||
audio_tensor = output.multimodal_output["audio"]
|
audio_tensor = output.multimodal_output["audio"]
|
||||||
output_wav = os.path.join(output_dir, f"output_{output.request_id}.wav")
|
if args.save_results:
|
||||||
sf.write(output_wav, audio_tensor.detach().cpu().numpy(), samplerate=24000)
|
output_wav = os.path.join(output_dir, f"output_{output.request_id}.wav")
|
||||||
print(f"Request ID: {request_id}, Saved audio to {output_wav}")
|
sf.write(output_wav, audio_tensor.detach().cpu().numpy(), samplerate=24000)
|
||||||
|
print(f"Request ID: {request_id}, Saved audio to {output_wav}")
|
||||||
|
else:
|
||||||
|
print(f"Request ID: {request_id}, Received audio output (not saved).")
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
@@ -266,6 +275,12 @@ def parse_args():
|
|||||||
default=65536,
|
default=65536,
|
||||||
help="Threshold for using shared memory in bytes (default: 65536)",
|
help="Threshold for using shared memory in bytes (default: 65536)",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--save-results",
|
||||||
|
action=argparse.BooleanOptionalAction,
|
||||||
|
default=True,
|
||||||
|
help="Save text/audio outputs to files (default: enabled). Use --no-save-results to disable.",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--output-wav",
|
"--output-wav",
|
||||||
default="output_audio",
|
default="output_audio",
|
||||||
|
|||||||
Reference in new issue
Block a user