Datasets:
Download config.json from Shadow0482/tts-v2: direct link, hf CLI and curl.
- Browser
- Download file 26.1 kB
-
https://huggingface.co/datasets/Shadow0482/tts-v2/resolve/main/config.json
- Command line
-
hf download hf://datasets/Shadow0482/tts-v2/config.json
-
curl -L -o config.json https://huggingface.co/datasets/Shadow0482/tts-v2/resolve/main/config.json
26.1 kB
| { | |
| "TARGET_HOURS": 5.0, | |
| "NUM_TTS_WORKERS": 10, | |
| "TTS_BATCH_SIZE": 4, | |
| "LLM_BATCH_SIZE": 32, | |
| "MAX_TTS_VRAM_GB": 7, | |
| "QWEN_MODEL_SIZE": "0.5B", | |
| "AUDIO_FORMAT": "wav", | |
| "SAMPLE_RATE": 24000, | |
| "HF_DATASET_REPO": "Shadow0482/tts-v2", | |
| "HF_PRIVATE": false, | |
| "ENABLE_HF_UPLOAD": true, | |
| "UPLOAD_EVERY_N_SAMPLES": 1500, | |
| "UPLOAD_BATCH_SIZE": 500, | |
| "LANGUAGE": "en", | |
| "ACCENT": "", | |
| "SPEAKER_ID": "speaker_0001", | |
| "SPEAKER_DESCRIPTION": "", | |
| "SEED": 1234, | |
| "GEN_MAX_NEW_TOKENS": 384, | |
| "MIN_WORDS": 5, | |
| "MAX_WORDS": 38, | |
| "MAX_CHARS": 280, | |
| "CHECKPOINT_INTERVAL": 200, | |
| "REPORT_EVERY_S": 30, | |
| "OMNI_STEPS": 20, | |
| "OMNI_GUIDANCE": 2.0, | |
| "OMNI_SPEED": 1.0, | |
| "OMNIVOICE_PRECISION": "f16", | |
| "TTS_BACKEND": "cuda", | |
| "TEXT_STAGE_MODE": "continuous", | |
| "INITIAL_TEXT_BUFFER": 128, | |
| "LLM_BUFFER_TARGET": 512, | |
| "LLM_GPU": null, | |
| "MAX_JOB_RETRIES": 3, | |
| "MAX_AUDIO_SECONDS": 45.0, | |
| "MIN_AUDIO_SECONDS": 0.6, | |
| "MIN_CPS": 4.0, | |
| "MAX_CPS": 40.0, | |
| "PRUNE_INVALID": true, | |
| "RETRY_FAILED_ON_RESTART": false, | |
| "CONTROL_TAG_RATE": 0.35, | |
| "PRONUNCIATION_RATE": 0.25, | |
| "MAX_PRON_PER_TEXT": 2, | |
| "TEXT_UTILS_SRC": "\nimport re, json, random, collections\nALLOWED_TAGS_EN = [\"[laughter]\", \"[sigh]\", \"[confirmation-en]\", \"[question-en]\", \"[question-ah]\",\n \"[question-oh]\", \"[question-ei]\", \"[question-yi]\", \"[surprise-ah]\", \"[surprise-oh]\",\n \"[surprise-wa]\", \"[surprise-yo]\", \"[dissatisfaction-hnn]\"]\nALLOWED_TAGS_ZH = [\"[laughter]\", \"[sigh]\", \"[question-ah]\", \"[question-oh]\", \"[question-ei]\", \"[question-yi]\",\n \"[surprise-ah]\", \"[surprise-oh]\", \"[surprise-wa]\", \"[surprise-yo]\"]\nPROMPT_TAGS_EN = [\"[laughter]\", \"[sigh]\", \"[question-en]\", \"[surprise-oh]\", \"[confirmation-en]\", \"[dissatisfaction-hnn]\"]\nPROMPT_TAGS_OTHER = [\"[laughter]\", \"[sigh]\"]\nTAG_RE = re.compile(r\"\\[[^\\[\\]]{1,40}\\]\")\nTRAIL_TAGS_RE = re.compile(r\"(\\s*\\[[^\\[\\]]{1,40}\\])+\\s*$\")\nBAD_START = re.compile(r\"^(sure|certainly|here (are|is)|of course|as an ai|i'?m sorry|i am sorry|note:|example|output|json|sentence \\d|text \\d)\", re.I)\nBAD_ANY = re.compile(r\"(dataset|text[- ]to[- ]speech|\\btts\\b|language model|\\bjson\\b|as an ai|generated by|\\bprompt\\b|speaker \\d|\\buser:|\\bassistant:|\\bexample\\b)\", re.I)\nUNSAFE = re.compile(r\"\\b(porn\\w*|sexual\\w*|nazi\\w*|rape\\w*|suicid\\w*|kill (myself|yourself)|terroris\\w*|racist\\w*|fuck\\w*|shit\\w*|cunt|nigg\\w*|faggot|molest\\w*|genocide|massacre|cocaine|heroin|bomb\\w*)\\b\", re.I)\nSYMBOLS = re.compile(r\"[*#_`|~<>{}\\\\/@^=+]\")\nWORD_RE = re.compile(r\"[\\w'\\u2019-]+\", re.U)\nEND_PUNCT = (\".\", \"!\", \"?\", \"\\u2026\", \"\\u3002\", \"\\uff01\", \"\\uff1f\")\n\ndef strip_tags(t):\n return re.sub(r\"\\s+\", \" \", TAG_RE.sub(\" \", t)).strip()\n\ndef norm_key(t):\n return re.sub(r\"[^\\w ]\", \"\", strip_tags(t).lower(), flags=re.U).strip()\n\ndef clean_text(raw, language=\"en\", min_words=5, max_words=38, max_chars=280, allowed_tags=None):\n \"\"\"Return (clean_text, None) or (None, reason). For zh, 'words' means Chinese characters.\"\"\"\n is_zh = language.lower().startswith(\"zh\")\n if allowed_tags is None:\n allowed_tags = (ALLOWED_TAGS_EN if language.lower().startswith(\"en\")\n else ALLOWED_TAGS_ZH if is_zh else [\"[laughter]\", \"[sigh]\"])\n if not isinstance(raw, str):\n return None, \"not_str\"\n t = raw.strip()\n t = re.sub(r\"^\\s*(?:[-*\\u2022]|\\d+[.)])\\s+\", \"\", t)\n t = t.replace(\"\\u201c\", '\"').replace(\"\\u201d\", '\"').replace(\"\\u2018\", \"'\").replace(\"\\u2019\", \"'\")\n t = t.replace(\" \\u2014 \", \", \").replace(\"\\u2014\", \", \").replace(\"\\u2013\", \"-\")\n t = t.strip().strip('\"').strip(\"`\").strip()\n t = TAG_RE.sub(lambda m: m.group(0) if m.group(0).lower() in allowed_tags else \" \", t)\n t = re.sub(r\"\\s+\", \" \", t).strip()\n t = re.sub(r\"\\s+([,.!?;:])\", r\"\\1\", t)\n if '\"' in t:\n t = t.replace('\"', \"\")\n plain = strip_tags(t)\n if not plain:\n return None, \"empty\"\n if re.search(r\"\\d\", plain):\n return None, \"digits\"\n if SYMBOLS.search(plain) or \"http\" in plain.lower() or \"www.\" in plain.lower():\n return None, \"symbols\"\n if BAD_START.search(plain) or BAD_ANY.search(plain):\n return None, \"boilerplate\"\n if UNSAFE.search(plain):\n return None, \"unsafe\"\n words = re.findall(r\"[\\u4e00-\\u9fff]\", plain) if is_zh else WORD_RE.findall(plain)\n if not (min_words <= len(words) <= max_words):\n return None, \"length\"\n if len(t) > max_chars:\n return None, \"chars\"\n if not TRAIL_TAGS_RE.sub(\"\", t).rstrip().endswith(END_PUNCT):\n return None, \"no_end_punct\"\n if language.lower().startswith(\"en\"):\n if sum(c.isascii() for c in plain) / len(plain) < 0.985:\n return None, \"non_ascii\"\n lw = [w.lower() for w in words]\n for i in range(len(lw) - 2):\n if lw[i] == lw[i + 1] == lw[i + 2]:\n return None, \"repeat_word\"\n if len(lw) >= 10 and len(set(lw)) / len(lw) < 0.5:\n return None, \"low_diversity\"\n if sum(1 for c in plain if c in \".!?\\u3002\\uff01\\uff1f\") > 6:\n return None, \"too_many_sentences\"\n return t, None\n\ndef parse_candidates(text):\n \"\"\"Extract candidate strings from a model reply; tolerant of malformed JSON.\"\"\"\n if not isinstance(text, str):\n return [], \"empty\"\n s = text.strip()\n i, j = s.find(\"[\"), s.rfind(\"]\")\n if i != -1 and j > i:\n frag = s[i:j + 1]\n try:\n v = json.loads(frag)\n if isinstance(v, list):\n return [x for x in v if isinstance(x, str)], \"json\"\n except Exception:\n pass\n strs = re.findall(r'\"((?:[^\"\\\\]|\\\\.)*)\"', frag)\n if strs:\n out = []\n for x in strs:\n try:\n out.append(json.loads('\"' + x + '\"'))\n except Exception:\n out.append(x)\n return out, \"regex\"\n lines = [l.strip() for l in s.splitlines() if len(l.strip()) > 15]\n return lines, \"lines\"\n\nclass Deduper:\n def __init__(self, window=3000, thresh=0.7):\n self.keys, self.win, self.thresh = set(), [], thresh\n self.window = window\n @staticmethod\n def _sh(key):\n w = key.split()\n if len(w) >= 3:\n return set(zip(w, w[1:], w[2:]))\n c = key.replace(\" \", \"\") # unspaced scripts (Chinese): character trigrams\n return set(zip(c, c[1:], c[2:])) if len(c) >= 3 else {tuple(w)}\n def seen(self, text):\n k = norm_key(text)\n if not k or k in self.keys:\n return True\n sh = self._sh(k)\n for other in self.win:\n u = len(sh | other)\n if u and len(sh & other) / u >= self.thresh:\n return True\n return False\n def add(self, text):\n if self.seen(text):\n return False\n k = norm_key(text)\n self.keys.add(k)\n self.win.append(self._sh(k))\n if len(self.win) > self.window:\n self.win.pop(0)\n return True\n def force_add(self, text):\n k = norm_key(text)\n if k:\n self.keys.add(k)\n self.win.append(self._sh(k))\n if len(self.win) > self.window:\n self.win.pop(0)\n\nTRAILING_ONLY = {\"[confirmation-en]\", \"[question-en]\", \"[question-ah]\", \"[question-oh]\", \"[question-ei]\", \"[question-yi]\"}\nSTYLE_TAGS = {\"lightly humorous\": [\"[laughter]\"], \"playful\": [\"[laughter]\"], \"soft and sad\": [\"[sigh]\"],\n \"surprised\": [\"[surprise-oh]\", \"[surprise-ah]\", \"[surprise-wa]\", \"[surprise-yo]\"],\n \"serious\": [\"[dissatisfaction-hnn]\", \"[sigh]\"],\n \"curious\": [\"[question-en]\", \"[question-ah]\", \"[question-oh]\"]}\n\nclass Annotator:\n \"\"\"Adds non-verbal tags and pronunciation overrides AFTER the text has been cleaned.\"\"\"\n def __init__(self, language, seed, tag_rate, pron_rate, max_pron):\n self.lang = language.lower().split(\"-\")[0]\n self.rng = random.Random(seed)\n self.tag_rate, self.pron_rate, self.max_pron = tag_rate, pron_rate, max_pron\n self.tags = (ALLOWED_TAGS_EN if self.lang == \"en\" else ALLOWED_TAGS_ZH if self.lang == \"zh\"\n else [\"[laughter]\", \"[sigh]\"])\n self.counts = collections.Counter()\n self.single, self.P = {}, None\n if pron_rate > 0 and self.lang == \"en\":\n import cmudict\n # only words with exactly one dictionary pronunciation -> the override can never be the wrong reading\n self.single = {w: p[0] for w, p in cmudict.dict().items()\n if len(p) == 1 and w.isalpha() and len(w) >= 6 and 3 <= len(p[0]) <= 8}\n elif pron_rate > 0 and self.lang == \"zh\":\n import pypinyin\n self.P = pypinyin\n\n def _eligible(self, text):\n end = text.rstrip()[-1:]\n out = []\n for t in self.tags:\n if t.startswith(\"[question\") and end not in \"?\\uff1f\":\n continue\n if t.startswith(\"[surprise\") and end not in \"!?\\uff01\\uff1f\":\n continue\n out.append(t)\n return out\n\n def add_tag(self, text, style=\"\"):\n if any(m in self.tags for m in TAG_RE.findall(text)) or self.rng.random() >= self.tag_rate:\n return text\n pool = self._eligible(text)\n if not pool:\n return text\n pref = [t for t in pool if t in STYLE_TAGS.get(style, ())]\n if pref and self.rng.random() < 0.7:\n pool = pref\n low = min(self.counts[t] for t in pool) # keep the tag distribution balanced\n tag = self.rng.choice([t for t in pool if self.counts[t] == low])\n commas = [m.end() for m in re.finditer(r\"[,\\uff0c]\", text)]\n if tag in TRAILING_ONLY or not commas:\n if tag in (\"[sigh]\", \"[laughter]\") and self.rng.random() < 0.25:\n return tag + \" \" + text\n return text + \" \" + tag\n pos = self.rng.choice(commas)\n return text[:pos] + \" \" + tag + text[pos:]\n\n def add_pron(self, text):\n if self.pron_rate <= 0 or self.rng.random() >= self.pron_rate:\n return text, []\n return self._pron_en(text) if self.lang == \"en\" else self._pron_zh(text) if self.lang == \"zh\" else (text, [])\n\n def _pron_en(self, text):\n parts = re.split(r\"(\\[[^\\[\\]]{1,40}\\])\", text) # never touch existing tags\n split = [re.split(r\"([A-Za-z]+)\", p) if i % 2 == 0 else None for i, p in enumerate(parts)]\n cands = [(i, j) for i, s in enumerate(split) if s for j in range(1, len(s), 2)\n if s[j].lower() in self.single and not (j + 1 < len(s) and s[j + 1].startswith(\"'\"))]\n if not cands:\n return text, []\n done = []\n for i, j in self.rng.sample(cands, self.rng.randint(1, min(self.max_pron, len(cands)))):\n w = split[i][j]\n ph = \"[\" + \" \".join(self.single[w.lower()]) + \"]\"\n split[i][j] = ph\n done.append({\"word\": w, \"phonemes\": ph})\n return \"\".join(\"\".join(s) if s else p for s, p in zip(split, parts)), done\n\n def _pron_zh(self, text):\n P = self.P\n py = P.pinyin(text, style=P.Style.TONE3, neutral_tone_with_five=True, errors=lambda x: list(x))\n if len(py) != len(text):\n return text, []\n cands, poly = [], []\n for i, ch in enumerate(text):\n if \"\\u4e00\" <= ch <= \"\\u9fff\" and re.fullmatch(r\"[a-z]+[1-4]\", py[i][0]):\n cands.append(i)\n if len(P.pinyin(ch, style=P.Style.TONE3, heteronym=True)[0]) > 1:\n poly.append(i)\n pool = poly or cands # prefer polyphonic characters\n if not pool:\n return text, []\n chars, done = list(text), []\n for i in self.rng.sample(pool, self.rng.randint(1, min(self.max_pron, len(pool)))):\n done.append({\"char\": text[i], \"pinyin\": py[i][0].upper()})\n chars[i] = py[i][0].upper()\n return \"\".join(chars), done\n\n def annotate(self, text, style=\"\"):\n t, prons = self.add_pron(text)\n t = self.add_tag(t, style)\n tags = [m for m in TAG_RE.findall(t) if m in self.tags]\n self.counts.update(tags)\n return t, tags, prons\n", | |
| "LLM_WORKER_SRC": "\nimport os, sys, json, time, random, re\nsys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom omni_text_utils import *\n\ncfg = json.load(open(sys.argv[1]))\nos.environ.setdefault(\"TOKENIZERS_PARALLELISM\", \"false\")\nimport torch\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\ndef log(*a):\n print(time.strftime(\"%H:%M:%S\"), \"[llm]\", *a, flush=True)\n\nTOPICS = [\"a rainy morning commute\", \"learning to cook a favourite family dish\", \"a long train journey\", \"starting a new job\",\n \"a quiet evening at home\", \"growing vegetables on a balcony\", \"a surprise birthday party\", \"an old bookshop\", \"fixing a broken bicycle\",\n \"a thunderstorm at night\", \"a first day at school\", \"planning a small garden\", \"a busy local market\", \"walking along a river\",\n \"a missed bus\", \"a family dinner\", \"learning a musical instrument\", \"a power cut in the evening\", \"moving to a new city\",\n \"a lost umbrella\", \"a childhood memory of summer\", \"waiting at a railway station\", \"a stray cat that visits every day\",\n \"a long phone call with a friend\", \"preparing for an exam\", \"the smell of fresh bread\", \"a crowded festival\", \"a mountain village\",\n \"a broken washing machine\", \"cleaning out an old cupboard\", \"a first snowfall\", \"a lazy Sunday\", \"a football match on television\",\n \"a small neighbourhood shop\", \"teaching someone to swim\", \"an unexpected compliment\", \"the first sip of morning tea\",\n \"a delayed flight\", \"volunteering at a shelter\", \"a new smartphone that confuses everyone\", \"how tides work\", \"why the sky is blue\",\n \"how bees make honey\", \"how to stay calm before a speech\", \"the history of a small town\", \"how a bicycle stays upright\",\n \"why sleep matters\", \"how rainbows form\", \"the joy of finishing a puzzle\", \"a tricky decision\", \"saying sorry to a friend\",\n \"a quiet library\", \"a boat ride at sunset\", \"an old photograph\", \"a neighbour who plays loud music\", \"a first attempt at painting\",\n \"a surprise phone call\", \"the last day of a holiday\", \"a very long queue\", \"a helpful stranger\", \"a favourite song on the radio\"]\nSTYLES = [\"excited\", \"curious\", \"soft and sad\", \"warm and reassuring\", \"lightly humorous\", \"neutral and matter-of-fact\",\n \"thoughtful\", \"encouraging\", \"surprised\", \"calm narration\", \"playful\", \"serious\"]\nFORMS = [\"casual conversational remarks\", \"short narration passages\", \"clear explanations\", \"questions a curious person might ask\",\n \"expressive reactions and exclamations\", \"short pieces of advice\", \"descriptions of a scene\",\n \"small everyday stories told in two sentences\"]\nLANG_NAMES = {\"en\": \"English\", \"hi\": \"Hindi\", \"ta\": \"Tamil\", \"es\": \"Spanish\", \"fr\": \"French\", \"de\": \"German\", \"pt\": \"Portuguese\",\n \"it\": \"Italian\", \"ja\": \"Japanese\", \"zh\": \"Chinese\", \"ar\": \"Arabic\", \"ru\": \"Russian\"}\n\nLANG = cfg[\"language\"]\nIS_ZH = LANG.lower().startswith(\"zh\")\nif IS_ZH:\n EXAMPLE = [\"\\u5348\\u540e\\u7684\\u9633\\u5149\\u7167\\u5728\\u684c\\u4e0a\\uff0c\\u6211\\u5fd8\\u4e86\\u65f6\\u95f4\\u3002\",\n \"\\u4f60\\u6709\\u6ca1\\u6709\\u60f3\\u8fc7\\uff0c\\u4e3a\\u4ec0\\u4e48\\u96e8\\u540e\\u7a7a\\u6c14\\u7279\\u522b\\u6e05\\u65b0\\uff1f\"]\nelse:\n EXAMPLE = ['I never thought a quiet walk could clear my head this much.', 'Do you ever wonder why the streets feel different after midnight?']\nUNIT = \"Chinese characters\" if IS_ZH else \"words\"\nlang_name = LANG_NAMES.get(LANG.lower().split(\"-\")[0], LANG)\ntags_pool = PROMPT_TAGS_EN if LANG.lower().startswith(\"en\") else PROMPT_TAGS_OTHER\n\ntexts_path, ctrl_path = cfg[\"texts_path\"], cfg[\"control_path\"]\ndedupe = Deduper()\nfor e in EXAMPLE:\n dedupe.force_add(e)\nann = Annotator(LANG, cfg[\"seed\"] + 17, cfg[\"tag_rate\"], cfg[\"pron_rate\"], cfg[\"max_pron\"])\nseq = 0\nif os.path.exists(texts_path):\n with open(texts_path, \"r\", encoding=\"utf-8\") as f:\n for line in f:\n try:\n r = json.loads(line)\n except Exception:\n continue\n seq = max(seq, int(r.get(\"seq\", 0)))\n dedupe.force_add(r.get(\"text_plain\") or r.get(\"text\", \"\"))\nlog(f\"resuming at seq={seq}, known texts={len(dedupe.keys)}\")\n\ntok = AutoTokenizer.from_pretrained(cfg[\"model\"])\ntok.padding_side = \"left\"\nif tok.pad_token is None:\n tok.pad_token = tok.eos_token\nmodel = AutoModelForCausalLM.from_pretrained(cfg[\"model\"], torch_dtype=torch.float16, device_map={\"\": 0}).eval()\nrng = random.Random(cfg[\"seed\"] + seq * 7919)\ntorch.manual_seed(cfg[\"seed\"] + seq * 7919)\nbatch = cfg[\"batch_size\"]\nLENS = [((5, 12), 0.35), ((13, 24), 0.40), ((25, 38), 0.25)]\nstats = dict(calls=0, cands=0, kept=0, parse_fail=0, reasons={})\n\ndef make_prompt():\n topic, style, form = rng.choice(TOPICS), rng.choice(STYLES), rng.choice(FORMS)\n r, acc = rng.random(), 0\n for (lo, hi), p in LENS:\n acc += p\n if r <= acc:\n break\n lo = max(lo, cfg[\"min_words\"]); hi = min(hi, cfg[\"max_words\"])\n if lo > hi:\n lo = hi\n accent = f\" Use vocabulary, idioms and spelling natural to {cfg['accent']}.\" if cfg[\"accent\"] else \"\"\n # NOTE: the model writes PLAIN sentences. Tags / pronunciation overrides are added afterwards by the Annotator.\n numrule = \"write all numbers in words\" if IS_ZH else \"spell out all numbers (no digits)\"\n user = (f'Write 4 different {form} on the topic \"{topic}\". Tone: {style}. Language: {lang_name}.{accent}\\n'\n f\"Each item must be {lo} to {hi} {UNIT} of natural spoken language that one person could read aloud. \"\n f\"Rules: {numrule}, no emojis, no square brackets, no lists inside an item, no speaker labels, \"\n \"no quotation marks inside an item, plain punctuation, each item ends with a sentence-ending punctuation mark. \"\n f\"Make the openings different from each other.\\n\"\n f\"Return ONLY a JSON array of 4 strings. Format example (different topic, do not copy): \"\n f\"{json.dumps(EXAMPLE, ensure_ascii=False)}\")\n msgs = [{\"role\": \"system\", \"content\": \"You write short, natural, speech-ready lines for a speech corpus. You never explain; you only output the requested JSON.\"},\n {\"role\": \"user\", \"content\": user}]\n return tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True), (topic, style, form)\n\ndef control():\n try:\n return json.load(open(ctrl_path))\n except Exception:\n return {\"want_more\": True, \"stop\": False}\n\nparent = os.getppid()\nlast = time.time()\nwhile True:\n c = control()\n if c.get(\"stop\") or os.getppid() != parent:\n log(\"stop requested\"); break\n if not c.get(\"want_more\", True):\n time.sleep(0.5); continue\n prompts, metas = zip(*[make_prompt() for _ in range(batch)])\n try:\n enc = tok(list(prompts), return_tensors=\"pt\", padding=True).to(\"cuda\")\n with torch.no_grad():\n out = model.generate(**enc, do_sample=True, temperature=0.9, top_p=0.95, top_k=50, repetition_penalty=1.08,\n max_new_tokens=cfg[\"max_new_tokens\"], pad_token_id=tok.pad_token_id)\n replies = tok.batch_decode(out[:, enc[\"input_ids\"].shape[1]:], skip_special_tokens=True)\n except torch.cuda.OutOfMemoryError:\n torch.cuda.empty_cache(); batch = max(1, batch // 2); log(f\"OOM -> LLM batch now {batch}\"); continue\n stats[\"calls\"] += 1\n new_rows = []\n for rep, (topic, style, form) in zip(replies, metas):\n cands, how = parse_candidates(rep)\n if how != \"json\":\n stats[\"parse_fail\"] += 1\n for cand in cands:\n stats[\"cands\"] += 1\n t, why = clean_text(cand, LANG, cfg[\"min_words\"], cfg[\"max_words\"], cfg[\"max_chars\"])\n if t is None:\n stats[\"reasons\"][why] = stats[\"reasons\"].get(why, 0) + 1; continue\n if not dedupe.add(t):\n stats[\"reasons\"][\"duplicate\"] = stats[\"reasons\"].get(\"duplicate\", 0) + 1; continue\n seq += 1; stats[\"kept\"] += 1\n final, tags, prons = ann.annotate(t, style)\n new_rows.append({\"id\": f\"{seq:06d}\", \"seq\": seq, \"language\": LANG, \"text\": final, \"text_plain\": strip_tags(t),\n \"control_tags\": tags, \"pron_overrides\": prons, \"topic\": topic, \"style\": style,\n \"form\": form, \"accent\": cfg[\"accent\"], \"gen_model\": cfg[\"model\"], \"gen_format\": how,\n \"created_utc\": time.strftime(\"%Y-%m-%dT%H:%M:%SZ\", time.gmtime())})\n if new_rows:\n with open(texts_path, \"a\", encoding=\"utf-8\") as f:\n f.write(\"\".join(json.dumps(r, ensure_ascii=False) + \"\\n\" for r in new_rows)); f.flush(); os.fsync(f.fileno())\n if time.time() - last > 20 or stats[\"calls\"] == 1:\n last = time.time()\n log(f\"calls={stats['calls']} candidates={stats['cands']} kept={stats['kept']} parse_fail={stats['parse_fail']} \"\n f\"reasons={dict(sorted(stats['reasons'].items(), key=lambda kv: -kv[1])[:6])} tags={dict(ann.counts)}\")\n", | |
| "OOM_PAT": "re.compile('out of memory|cudamalloc|failed to allocate|cuda error|cublas_status_alloc|alloc', re.IGNORECASE)", | |
| "WARMUP_TEXT": "Honestly, I did not expect the morning to turn out this well, but here we are, sitting by the window, sipping tea, and watching the rain slowly fade away.", | |
| "WARMUP_TEXT_ZH": "\u8001\u5b9e\u8bf4\uff0c\u6211\u6ca1\u60f3\u5230\u4eca\u5929\u65e9\u4e0a\u4f1a\u8fd9\u4e48\u6109\u5feb\uff0c\u6211\u5750\u5728\u7a97\u8fb9\u559d\u7740\u8336\uff0c\u770b\u7740\u96e8\u6162\u6162\u505c\u4e0b\u6765\u3002", | |
| "REPO_RE": "re.compile('^[A-Za-z0-9][A-Za-z0-9._-]{0,95}/[A-Za-z0-9][A-Za-z0-9._-]{0,95}$')", | |
| "OUT": "/kaggle/working/omnivoice_dataset", | |
| "WORK": "/kaggle/working/_omnivoice_work", | |
| "runtime_url": "https://github.com/0xShug0/audio.cpp/releases/download/v0.9.1/audio-v0.9.1-bin-ubuntu-x64-cuda12.8-colab.tar.gz", | |
| "resolved_sample_rate": 24000, | |
| "voice_route": "voice_ref", | |
| "per_instance": [ | |
| { | |
| "instance": 0, | |
| "gpu": 0, | |
| "clips": 284, | |
| "audio_h": 0.4913, | |
| "mem_saver": false, | |
| "measured_vram_mb": 2571, | |
| "oom_events": 0, | |
| "restarts": 0, | |
| "busy_x_realtime": 0.2 | |
| }, | |
| { | |
| "instance": 1, | |
| "gpu": 1, | |
| "clips": 368, | |
| "audio_h": 0.642, | |
| "mem_saver": false, | |
| "measured_vram_mb": 2571, | |
| "oom_events": 0, | |
| "restarts": 0, | |
| "busy_x_realtime": 0.26 | |
| }, | |
| { | |
| "instance": 2, | |
| "gpu": 0, | |
| "clips": 288, | |
| "audio_h": 0.4727, | |
| "mem_saver": false, | |
| "measured_vram_mb": 2568, | |
| "oom_events": 0, | |
| "restarts": 0, | |
| "busy_x_realtime": 0.19 | |
| }, | |
| { | |
| "instance": 3, | |
| "gpu": 1, | |
| "clips": 360, | |
| "audio_h": 0.653, | |
| "mem_saver": false, | |
| "measured_vram_mb": 2568, | |
| "oom_events": 0, | |
| "restarts": 0, | |
| "busy_x_realtime": 0.26 | |
| }, | |
| { | |
| "instance": 4, | |
| "gpu": 0, | |
| "clips": 279, | |
| "audio_h": 0.5055, | |
| "mem_saver": false, | |
| "measured_vram_mb": 2568, | |
| "oom_events": 0, | |
| "restarts": 0, | |
| "busy_x_realtime": 0.2 | |
| }, | |
| { | |
| "instance": 5, | |
| "gpu": 1, | |
| "clips": 372, | |
| "audio_h": 0.6241, | |
| "mem_saver": false, | |
| "measured_vram_mb": 2568, | |
| "oom_events": 0, | |
| "restarts": 0, | |
| "busy_x_realtime": 0.25 | |
| }, | |
| { | |
| "instance": 6, | |
| "gpu": 0, | |
| "clips": 287, | |
| "audio_h": 0.4831, | |
| "mem_saver": false, | |
| "measured_vram_mb": 2568, | |
| "oom_events": 0, | |
| "restarts": 0, | |
| "busy_x_realtime": 0.19 | |
| }, | |
| { | |
| "instance": 7, | |
| "gpu": 1, | |
| "clips": 370, | |
| "audio_h": 0.6368, | |
| "mem_saver": false, | |
| "measured_vram_mb": 2568, | |
| "oom_events": 0, | |
| "restarts": 0, | |
| "busy_x_realtime": 0.26 | |
| }, | |
| { | |
| "instance": 8, | |
| "gpu": 0, | |
| "clips": 284, | |
| "audio_h": 0.495, | |
| "mem_saver": false, | |
| "measured_vram_mb": 2568, | |
| "oom_events": 0, | |
| "restarts": 0, | |
| "busy_x_realtime": 0.2 | |
| } | |
| ], | |
| "llm": "Qwen/Qwen2.5-0.5B-Instruct", | |
| "generated_utc": "2026-10-09T09:11:19Z", | |
| "validation": { | |
| "records": 2892, | |
| "valid": 2892, | |
| "invalid": 0, | |
| "orphan_audio_files": 0, | |
| "total_hours_valid": 5.0035, | |
| "avg_duration_s": 6.228, | |
| "sample_rates": [ | |
| 24000 | |
| ], | |
| "invalid_reasons": {}, | |
| "clips_with_tags": 945, | |
| "clips_with_pron_overrides": 687, | |
| "tag_counts": { | |
| "[confirmation-en]": 180, | |
| "[dissatisfaction-hnn]": 181, | |
| "[question-oh]": 24, | |
| "[sigh]": 182, | |
| "[surprise-yo]": 26, | |
| "[laughter]": 181, | |
| "[question-en]": 24, | |
| "[surprise-wa]": 26, | |
| "[surprise-oh]": 25, | |
| "[question-yi]": 24, | |
| "[surprise-ah]": 25, | |
| "[question-ah]": 24, | |
| "[question-ei]": 23 | |
| } | |
| } | |
| } |