audio / README.md
Jlz2's picture
upload README via local relay
bc36334 verified
|
Raw History Blame Contribute Delete
4.58 kB
# Step-Audio2 500-Sample Mechanism Pipeline
This repo is built for RunPod/H200 execution. The local Mac M1 Pro is only for code authoring and lightweight synthetic tests.
The pipeline compares two conditions:
- Condition A: `Step-Audio-2-mini` receives the audio prompt and `<tts_start>`.
- Condition B: `Step-Audio-2-mini-Think` first generates `<think>...</think>`, then `Step-Audio-2-mini` receives the same audio plus injected CoT and `<tts_start>`.
Final answer generation always uses `Step-Audio-2-mini`, so the comparison isolates CoT injection.
## Setup on RunPod
```bash
conda env create -f environment.yml
conda activate hf-audio-lab
pip install -e .
git lfs install
```
Keep the Hugging Face token out of the repo. The scripts read `/Users/j/hf-token.log` if it exists, or `HF_TOKEN` otherwise.
## Smoke Commands
```bash
python scripts/download_all.py
python scripts/make_math_questions.py --n 2
python scripts/synthesize_cosyvoice2.py --limit 2
python scripts/generate_cot.py --limit 1
python scripts/run_inference.py --condition A --limit 1
python scripts/run_inference.py --condition B --limit 1
python scripts/analyze_all.py --limit 1
python scripts/upload_to_hf.py
```
## Full Run
```bash
python scripts/download_all.py
python scripts/import_prompt_dataset.py data/questions/jsy_math-logic.jsonl --output data/questions/jsy_math_logic_500.normalized.jsonl
python scripts/synthesize_cosyvoice2.py
python scripts/generate_cot.py
python scripts/run_inference.py --condition A
python scripts/run_inference.py --condition B
python scripts/analyze_all.py
python scripts/upload_to_hf.py
```
## Artifacts
- Raw prompt dataset: `data/questions/jsy_math-logic.jsonl`
- Normalized questions: `data/questions/jsy_math_logic_500.normalized.jsonl`
- Audio manifest: `data/audio/audio_manifest.jsonl`
- CoT manifest: `data/cot/cot_manifest.jsonl`
- Inference outputs: `outputs/inference/A/<sample_id>/` and `outputs/inference/B/<sample_id>/`
- Per-sample files: `tokens.json`, `topk_logits.npz`, `attention_submatrices.npz`, `meta.json`
- Reports: `reports/tables/*.csv`, `reports/figures/*.png`, `reports/summary.md`
## Upload Policy
The upload script pushes this workspace as a Git repo to `Jlz2/audio`, so Hugging Face shows normal Git history. Official Step-Audio2 and CosyVoice code is vendored as ordinary files; nested `third_party/**/.git` metadata is removed before committing so RunPod pulls the actual files rather than fragile submodule pointers. `.venv`, `third_party`, `models`, `data`, `outputs`, and `reports` are included if they exist. It excludes only explicit secrets and disposable cache noise: `hf-token.log`, `.env`, `*.pem`, `*.key`, `__pycache__`, pytest/mypy/ruff caches, `.DS_Store`, and Python bytecode.
## Local Tests
```bash
python -m pytest -q
```
These tests use synthetic fixtures only and do not load Step-Audio2, CosyVoice2, CUDA, or real model weights.
## Colab Think Model Smoke Notebook
Use `notebooks/step_audio_think_5_token_dump_colab.ipynb` for a small Colab experiment with `stepfun-ai/Step-Audio-2-mini-Think`.
The notebook clones this repo, downloads the Think model, reads the first 5 rows from `data/audio/audio_manifest.jsonl`, and saves:
- `cot_token_ids`
- `answer_token_ids`
- `answer_audio_token_ids`
- decoded `cot_text` and `answer_text`
Output path:
```text
outputs/think_5_token_dump/think_5_token_dump.jsonl
```
The notebook expects audio wavs and `data/audio/audio_manifest.jsonl` to already exist in the repo or be uploaded into the Colab runtime.
## Prompt Dataset
The current 500-line prompt dataset is `data/questions/jsy_math-logic.jsonl`. Each raw row has a single `user` field. Normalize it before TTS:
```bash
python scripts/import_prompt_dataset.py data/questions/jsy_math-logic.jsonl --output data/questions/jsy_math_logic_500.normalized.jsonl
```
Example prompts from the dataset:
```text
Brian Brabazon said his son would get upset but then turn around and befriend his taunters . Her son would get upset , his mom said , but then turn around and befriend his taunters . If the first sentence is true, is the second one also true?
8 friends are living in 8 different flats of an apartment. Each of them was allotted a parking spot to park their cars in the ground floor. But they used to park their cars randomly in any of the 8 parking spots. In how many ways can they park their cars so that exactly 6 people park their cars in the spots allotted to them? Answer Choices: (A) 20 (B) 28 (C) 36 (D) 44 (E) 52
How many numbers from 10 to 50 are exactly divisible by 3?
```