47z commited on
Commit
e412140
·
verified ·
1 Parent(s): 31e3a3c

Add files using upload-large-folder tool

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. README.md +51 -0
  3. make_kimi_train.py +107 -0
  4. metadata.tsv +3 -0
.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ metadata.tsv filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MoVE Dataset — output-200
2
+
3
+ Bilingual (EN↔ZH) expressive speech-to-speech translation dataset.
4
+ 5 emotion categories: `angry`, `happy`, `sad`, `laugh`, `crying`.
5
+
6
+ ## Directory Structure
7
+
8
+ ```
9
+ output-200/
10
+ ├── en/{emotion}/*.flac # English TTS audio (FLAC, lossless)
11
+ ├── zh/{emotion}/*.flac # Chinese TTS audio (FLAC, lossless)
12
+ ├── metadata/
13
+ │ ├── metadata_shard_*.jsonl # S2ST conversation format (per shard)
14
+ │ └── entries_shard_*.jsonl # Per-entry detail (text, ASR, duration, WER)
15
+ ├── metadata.tsv # Generated by make_metadata_tsv.py
16
+ ├── make_metadata_tsv.py # Step 1: shards → metadata.tsv
17
+ └── make_kimi_train.py # Step 2: metadata.tsv → Kimi training format
18
+ ```
19
+
20
+ ## metadata.tsv
21
+
22
+ Columns: `zh_path`, `en_path`, `zh_text`, `en_text`, `category`
23
+
24
+ All paths are relative to this directory and use `.flac` extension.
25
+
26
+ ```bash
27
+ python make_metadata_tsv.py
28
+ ```
29
+
30
+ ## Kimi-Audio Training Format
31
+
32
+ > ⚠️ **WARNING**: `make_kimi_train.py` converts all `.flac` files to `.wav` **in-place**
33
+ > and deletes the original `.flac` files. WAV files are approximately **2–3× larger**
34
+ > than FLAC. Run this only when you intend to use the data for local Kimi-Audio training
35
+ > and no longer need the FLAC files.
36
+
37
+ Produces `metadata_kimi_train.jsonl` in Kimi-Audio conversation format:
38
+
39
+ ```json
40
+ {"task_type": "s-s", "conversation": [
41
+ {"role": "user", "message_type": "text", "content": "Translate the given English speech into Chinese while preserving its expressiveness."},
42
+ {"role": "user", "message_type": "audio", "content": "en/angry/angry_000001_en.wav"},
43
+ {"role": "assistant", "message_type": "audio-text", "content": ["zh/angry/angry_000001_zh.wav", "..."]}
44
+ ]}
45
+ ```
46
+
47
+ Each pair generates two entries (EN→ZH and ZH→EN).
48
+
49
+ ```bash
50
+ python make_kimi_train.py
51
+ ```
make_kimi_train.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Step 2: metadata.tsv → FLAC-to-WAV conversion + metadata_kimi_train.jsonl
4
+
5
+ WARNING: This script converts all .flac files to .wav IN-PLACE and deletes the .flac.
6
+ WAV files are approximately 2-3x larger than FLAC.
7
+ Purpose: produce training data in Kimi-Audio conversation format.
8
+
9
+ Output: metadata_kimi_train.jsonl (same directory as this script)
10
+ Each pair produces two entries:
11
+ 1. EN→ZH: user gives EN audio, assistant responds with ZH audio + ZH text
12
+ 2. ZH→EN: user gives ZH audio, assistant responds with EN audio + EN text
13
+ """
14
+
15
+ import csv
16
+ import json
17
+ import os
18
+ import soundfile as sf
19
+ from tqdm import tqdm
20
+
21
+ BASE_DIR = os.path.dirname(__file__)
22
+ INPUT_TSV = os.path.join(BASE_DIR, "metadata.tsv")
23
+ OUTPUT_JSONL = os.path.join(BASE_DIR, "metadata_kimi_train.jsonl")
24
+
25
+
26
+ def flac_to_wav(flac_path: str) -> str:
27
+ """Convert a .flac file to .wav in-place (deletes .flac). Returns .wav path."""
28
+ wav_path = flac_path[:-5] + ".wav"
29
+ data, sr = sf.read(flac_path)
30
+ sf.write(wav_path, data, sr)
31
+ os.remove(flac_path)
32
+ return wav_path
33
+
34
+
35
+ def flac_rel_to_wav_rel(p: str) -> str:
36
+ return p[:-5] + ".wav" if p.endswith(".flac") else p
37
+
38
+
39
+ def main():
40
+ with open(INPUT_TSV, "r", encoding="utf-8") as f:
41
+ rows = list(csv.DictReader(f, delimiter="\t"))
42
+ print(f"Loaded {len(rows)} pairs from {INPUT_TSV}")
43
+ print("Converting FLAC → WAV (in-place) and writing metadata_kimi_train.jsonl ...")
44
+
45
+ ok = skip = fail = 0
46
+ out_f = open(OUTPUT_JSONL, "w", encoding="utf-8")
47
+
48
+ for row in tqdm(rows, unit="pairs"):
49
+ zh_flac = os.path.join(BASE_DIR, row["zh_path"])
50
+ en_flac = os.path.join(BASE_DIR, row["en_path"])
51
+ zh_text = row["zh_text"]
52
+ en_text = row["en_text"]
53
+
54
+ # Convert FLAC → WAV for both files
55
+ converted = {}
56
+ for key, flac_abs in [("zh", zh_flac), ("en", en_flac)]:
57
+ wav_abs = flac_abs[:-5] + ".wav"
58
+ if os.path.exists(wav_abs):
59
+ converted[key] = wav_abs
60
+ elif os.path.exists(flac_abs):
61
+ try:
62
+ converted[key] = flac_to_wav(flac_abs)
63
+ except Exception as e:
64
+ print(f"\n FAILED converting {flac_abs}: {e}")
65
+ fail += 1
66
+ break
67
+ else:
68
+ print(f"\n MISSING: {flac_abs}")
69
+ fail += 1
70
+ break
71
+ else:
72
+ # Both converted successfully — write two conversation entries
73
+ en_rel = flac_rel_to_wav_rel(row["en_path"])
74
+ zh_rel = flac_rel_to_wav_rel(row["zh_path"])
75
+
76
+ # EN → ZH
77
+ out_f.write(json.dumps({
78
+ "task_type": "s-s",
79
+ "conversation": [
80
+ {"role": "user", "message_type": "text", "content": "Translate the given English speech into Chinese while preserving its expressiveness."},
81
+ {"role": "user", "message_type": "audio", "content": en_rel},
82
+ {"role": "assistant", "message_type": "audio-text", "content": [zh_rel, zh_text]},
83
+ ]
84
+ }, ensure_ascii=False) + "\n")
85
+
86
+ # ZH → EN
87
+ out_f.write(json.dumps({
88
+ "task_type": "s-s",
89
+ "conversation": [
90
+ {"role": "user", "message_type": "text", "content": "Translate the given Chinese speech into English while preserving its expressiveness."},
91
+ {"role": "user", "message_type": "audio", "content": zh_rel},
92
+ {"role": "assistant", "message_type": "audio-text", "content": [en_rel, en_text]},
93
+ ]
94
+ }, ensure_ascii=False) + "\n")
95
+
96
+ ok += 1
97
+ continue
98
+
99
+ skip += 1
100
+
101
+ out_f.close()
102
+ print(f"\nDone: {ok} pairs converted, {skip} skipped/missing, {fail} errors")
103
+ print(f"Output: {OUTPUT_JSONL} ({ok * 2} total conversation entries)")
104
+
105
+
106
+ if __name__ == "__main__":
107
+ main()
metadata.tsv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63f4b45f6ba7ad2bc0384a01865dc97451835c9312feb2d430713f9e30ab0adc
3
+ size 183396500