Spaces:
Running on Zero
scripts: an opt-in device move, to answer the frequency question while blocked
Browse filesThe app does not move the waveform to the VAE's device, which is the open CPU/CUDA
defect, so H17 deliberately does not either — that is what stopped this harness
hiding it, and the flag is off by default.
But device placement does not change arithmetic: the mel, the VAE and the vocoder
compute the same values wherever the tensor lives. So an opt-in move can answer a
question purely about frequency content — which tones survive the round trip, and
whether a loss is frequency-dependent or channel-dependent — while the app path
stays blocked.
The distinction is written into the flag's own logging: it answers nothing about
whether a user's upload works, and a run using it must not be reported as an
app-path pass. Separating "what does the arithmetic do" from "does the product
work" is the point; conflating them is what made the earlier pass mean less than
it appeared to.
Files changed (2)
29 unmodified lines3031323334353629 unmodified linesMATRIX_RUNS MATRIX_OUTPUT_ROOT MATRIX_VIDEO_FIXTURE MATRIX_AUDIO_FIXTURE \MATRIX_BYPASS_STAGE2 EVIDENCE_DIR EVIDENCE_FRAMES EVIDENCE_PAIRS \EVIDENCE_SPECTRA EVIDENCE_FRAME_COUNT LEVELS_ROOT \RAW_OUTPUT_ROOT RAW_VIDEO_FIXTURE MEL_SECONDS MEL_FIXTURE MEL_SWAP MEL_REQUIRE_ALL "$@"; docase "$var" in*=*) FORWARD="$FORWARD export ${var%%=*}='${var#*=}';" ;;*) [ -n "${!var:-}" ] && FORWARD="$FORWARD export $var='${!var}';" ;;29 unmodified lines3031323334353629 unmodified linesMATRIX_RUNS MATRIX_OUTPUT_ROOT MATRIX_VIDEO_FIXTURE MATRIX_AUDIO_FIXTURE \MATRIX_BYPASS_STAGE2 EVIDENCE_DIR EVIDENCE_FRAMES EVIDENCE_PAIRS \EVIDENCE_SPECTRA EVIDENCE_FRAME_COUNT LEVELS_ROOT \RAW_OUTPUT_ROOT RAW_VIDEO_FIXTURE MEL_SECONDS MEL_FIXTURE MEL_SWAP MEL_REQUIRE_ALL MEL_FORCE_DEVICE "$@"; docase "$var" in*=*) FORWARD="$FORWARD export ${var%%=*}='${var#*=}';" ;;*) [ -n "${!var:-}" ] && FORWARD="$FORWARD export $var='${!var}';" ;;
37 unmodified lines383940414243148 unmodified lines19219319419519619737 unmodified linesGiB = 1024**3SECONDS = float(os.environ.get("MEL_SECONDS", "4.0"))SWAP = os.environ.get("MEL_SWAP") == "1"#: (fundamental, harmonic) per channel. The harmonic is the one at risk.TONES_L = (220.0, 1320.0)TONES_R = (440.0, 2640.0)148 unmodified lineslog(f"\nread back via load_waveform: {tuple(loaded.shape)} @ {loaded_rate} Hz "f"dtype={loaded.dtype} device={loaded.device}")dev_wave = loadedlog("\n=== stage 1: forward mel ===")# The app's own transform, unwrapped. `encode_waveform_to_latents` casts to the37 unmodified lines38394041424344148 unmodified lines19319419519619719819920020120220320420520620720820921021121237 unmodified linesGiB = 1024**3SECONDS = float(os.environ.get("MEL_SECONDS", "4.0"))SWAP = os.environ.get("MEL_SWAP") == "1"FORCE_DEVICE = os.environ.get("MEL_FORCE_DEVICE") == "1"#: (fundamental, harmonic) per channel. The harmonic is the one at risk.TONES_L = (220.0, 1320.0)TONES_R = (440.0, 2640.0)148 unmodified lineslog(f"\nread back via load_waveform: {tuple(loaded.shape)} @ {loaded_rate} Hz "f"dtype={loaded.dtype} device={loaded.device}")dev_wave = loadedif FORCE_DEVICE:# Moves the waveform to the VAE's device, which the APP DOES NOT DO -- see# the CPU/CUDA defect at `encode_waveform_to_latents`. Off by default for# exactly that reason.## It is offered because device placement does not change arithmetic: the# mel, the VAE and the vocoder compute the same values wherever the tensor# lives. So this variant can answer a question about FREQUENCY CONTENT --# which tones survive the round trip -- while the app path is blocked. It# answers nothing about whether a user's upload works, and a run using it# must not be reported as an app-path pass.dev_wave = loaded.to(device=vae.device)log(f" MEL_FORCE_DEVICE=1: moved to {dev_wave.device} "f"(answers frequency content only, NOT the app path)")log("\n=== stage 1: forward mel ===")# The app's own transform, unwrapped. `encode_waveform_to_latents` casts to the