LogosAccessibleExpression commited on
Commit
8f0aeb5
·
verified ·
1 Parent(s): ccd029b

Upload wav2vec2_optuna_job.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. wav2vec2_optuna_job.py +4 -2
wav2vec2_optuna_job.py CHANGED
@@ -18,7 +18,7 @@ WER gap. Objective = word accuracy (1 - WER) with LM decoding.
18
  fp32 (not fp16): CTC's log-sum-exp overflows to nan in fp16. Runs on T4 at batch 4.
19
  Output: best LoRA ADAPTER + the LM → HF_PUSH_REPO/subfolder (kept separate, swappable).
20
  """
21
- import os, re, gc, random, subprocess, tempfile, logging
22
  import numpy as np
23
  import requests, soundfile as sf, librosa, torch
24
  from pathlib import Path
@@ -123,7 +123,9 @@ def build_lm_decoder():
123
  subprocess.run("git clone --depth 1 https://github.com/kpu/kenlm.git /tmp/klm", shell=True, check=True)
124
  subprocess.run("cmake -S /tmp/klm -B /tmp/klm/build -DCMAKE_BUILD_TYPE=Release && "
125
  "cmake --build /tmp/klm/build -j4 --target lmplz build_binary", shell=True, check=True)
126
- subprocess.run("pip install -q https://github.com/kpu/kenlm/archive/master.zip", shell=True, check=True)
 
 
127
  subprocess.run(f"/tmp/klm/build/bin/lmplz -o {LM_ORDER} --discount_fallback "
128
  f"< /tmp/corpus.txt > /tmp/lm.arpa", shell=True, check=True)
129
  from pyctcdecode import build_ctcdecoder
 
18
  fp32 (not fp16): CTC's log-sum-exp overflows to nan in fp16. Runs on T4 at batch 4.
19
  Output: best LoRA ADAPTER + the LM → HF_PUSH_REPO/subfolder (kept separate, swappable).
20
  """
21
+ import os, re, gc, sys, random, subprocess, tempfile, logging
22
  import numpy as np
23
  import requests, soundfile as sf, librosa, torch
24
  from pathlib import Path
 
123
  subprocess.run("git clone --depth 1 https://github.com/kpu/kenlm.git /tmp/klm", shell=True, check=True)
124
  subprocess.run("cmake -S /tmp/klm -B /tmp/klm/build -DCMAKE_BUILD_TYPE=Release && "
125
  "cmake --build /tmp/klm/build -j4 --target lmplz build_binary", shell=True, check=True)
126
+ # Install into THIS uv venv (plain `pip` hits the wrong env under `uv run --script`).
127
+ subprocess.run(["uv", "pip", "install", "--python", sys.executable,
128
+ "https://github.com/kpu/kenlm/archive/master.zip"], check=True)
129
  subprocess.run(f"/tmp/klm/build/bin/lmplz -o {LM_ORDER} --discount_fallback "
130
  f"< /tmp/corpus.txt > /tmp/lm.arpa", shell=True, check=True)
131
  from pyctcdecode import build_ctcdecoder