Download src/psi/data/seed/full_duplex_timing.py from Tinghong-Ye22/code-HFD: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/Tinghong-Ye22/code-HFD/resolve/main/src/psi/data/seed/full_duplex_timing.py
- Command line
-
hf download hf://Tinghong-Ye22/code-HFD/src/psi/data/seed/full_duplex_timing.py
-
curl -L -o full_duplex_timing.py https://huggingface.co/Tinghong-Ye22/code-HFD/resolve/main/src/psi/data/seed/full_duplex_timing.py
1.34 kB
| from __future__ import annotations | |
| AUDIO_RATE = 16_000 | |
| MOTION_FPS = 50 | |
| AUDIO_WINDOW_SECONDS = 0.6 | |
| # Qwen consumes one overlapping audio window every 0.4 seconds. | |
| AUDIO_STRIDE_FRAMES = 20 | |
| # Dense action supervision shifts the current state by one 50 Hz frame. | |
| ACTION_SAMPLE_STEP_FRAMES = 1 | |
| ACTION_CHUNK_FRAMES = 30 | |
| ACTION_EXEC_FRAMES = 20 | |
| RTC_PREFIX_FRAMES = 10 | |
| def complete_audio_clip_starts( | |
| total_samples: int, | |
| *, | |
| sampling_rate: int = AUDIO_RATE, | |
| window_seconds: float = AUDIO_WINDOW_SECONDS, | |
| stride_frames: int = AUDIO_STRIDE_FRAMES, | |
| motion_fps: int = MOTION_FPS, | |
| ) -> list[int]: | |
| """Return the exact complete-window starts used by the training exporter.""" | |
| window_samples = int(round(float(window_seconds) * int(sampling_rate))) | |
| stride_samples = int(round(int(stride_frames) / float(motion_fps) * int(sampling_rate))) | |
| if total_samples < window_samples: | |
| return [] | |
| return list(range(0, int(total_samples) - window_samples + 1, stride_samples)) | |
| def aligned_motion_start_frame( | |
| total_samples: int, | |
| *, | |
| sampling_rate: int = AUDIO_RATE, | |
| motion_fps: int = MOTION_FPS, | |
| ) -> int: | |
| """First motion frame at or after the exact decoded audio end sample.""" | |
| return (int(total_samples) * int(motion_fps) + int(sampling_rate) - 1) // int( | |
| sampling_rate | |
| ) | |