might2901 commited on
Commit
fedd345
·
verified ·
1 Parent(s): 7cdc59a

Fix missing _AUX_SLOT_MANIFEST_K and aux helper functions

Browse files
Files changed (1) hide show
  1. miner.py +29 -0
miner.py CHANGED
@@ -5961,6 +5961,35 @@ __all__ = [
5961
  "TTS_TEXT_WINDOW_SIZE",
5962
  "TTS_SPEECH_WINDOW_SIZE",
5963
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5964
  def _default_aux_shard_fp(repo_root: str) -> str:
5965
  return os.path.join(repo_root, "aux_lm_residual_projection.safetensors")
5966
 
 
5961
  "TTS_TEXT_WINDOW_SIZE",
5962
  "TTS_SPEECH_WINDOW_SIZE",
5963
  ]
5964
+ _AUX_SLOT_MANIFEST_K = "vv.pipeline.aux_slot_manifest"
5965
+ DEFAULT_AUX_SLICE_ID = "male_mid_normal_adult_serious_formal_uk"
5966
+
5967
+
5968
+ def _resolve_aux_coeff_tensor(
5969
+ handles: Dict[str, Any],
5970
+ slice_query: str,
5971
+ *,
5972
+ default_slice_id: str = DEFAULT_AUX_SLICE_ID,
5973
+ ) -> Tuple[Any, str, str, bool]:
5974
+ q = slice_query.strip()
5975
+ if q in handles:
5976
+ return (handles[q], q, q, False)
5977
+ if default_slice_id in handles:
5978
+ return (handles[default_slice_id], default_slice_id, q, True)
5979
+ q_low = q.lower()
5980
+ for preset_k, binding in handles.items():
5981
+ if preset_k.lower() in q_low or q_low in preset_k.lower():
5982
+ return (binding, preset_k, q, False)
5983
+ if handles:
5984
+ first_k = next(iter(handles.keys()))
5985
+ return (handles[first_k], first_k, q, False)
5986
+ raise ValueError("empty auxiliary coefficient handle map")
5987
+
5988
+
5989
+ def _accum_tensor_key(slot_idx: int) -> str:
5990
+ return f"model.decoder.aux_residual.accum.{slot_idx :04d}.u8_payload"
5991
+
5992
+
5993
  def _default_aux_shard_fp(repo_root: str) -> str:
5994
  return os.path.join(repo_root, "aux_lm_residual_projection.safetensors")
5995