Codex commited on
Commit
a1d95d3
·
1 Parent(s): d9d6a4b

Publish reviewed Realtime-Venus configurations, HEARTBEAT index and documentation

Browse files
README.md CHANGED
@@ -155,10 +155,11 @@ python download_models.py --model all --local-dir .
155
  ```
156
 
157
  Use `--model omni` or `--model audio` to download only the model you need.
158
- The downloader reads this repository's root `config.yaml` and downloads each
159
- selected model's complete directory, including weights, custom code, and
160
- assets. It saves a download manifest and uses the Hugging Face Hub's standard
161
- progress display and cache. Each download uses one repository revision.
 
162
 
163
  Install the inference dependencies after downloading. For Omni or `all`:
164
 
@@ -185,8 +186,49 @@ paths = download_models(model="omni", local_dir=".") # "omni", "audio", or "all
185
  model_dir = paths["omni"] # pathlib.Path; use paths["audio"] for Audio
186
  ```
187
 
188
- The inference examples below load the downloaded local model directories. Run
189
- them from the same directory; all asset and output paths are relative to it.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
  As an independent alternative, the ModelScope CLI (installed separately) can
192
  download the entire mirror repository:
@@ -681,7 +723,11 @@ print("Saved generated speech to output/audio_full_duplex.wav")
681
 
682
  </details>
683
 
684
- ## 9. 📝 Citation
 
 
 
 
685
 
686
  If you find Realtime-Venus useful, please cite the technical report:
687
 
@@ -694,7 +740,7 @@ If you find Realtime-Venus useful, please cite the technical report:
694
  }
695
  ```
696
 
697
- ## 10. 📄 License
698
 
699
  This repository includes an [Apache License 2.0](./LICENSE). Please also review
700
  the licenses and acceptable-use terms of the upstream model, third-party
 
155
  ```
156
 
157
  Use `--model omni` or `--model audio` to download only the model you need.
158
+ The downloader first fetches root `config.yaml`, which contains both models'
159
+ complete configurations and directory mapping, then downloads the selected
160
+ model directories in full, including weights, custom code, and assets.
161
+ Each download uses one repository revision and the Hugging Face Hub's
162
+ standard progress display and cache.
163
 
164
  Install the inference dependencies after downloading. For Omni or `all`:
165
 
 
186
  model_dir = paths["omni"] # pathlib.Path; use paths["audio"] for Audio
187
  ```
188
 
189
+ Each model directory's `config.json` references the complete configuration in
190
+ root `config.yaml` at a fixed revision. During loading, the configuration class
191
+ first checks for a matching YAML beside the model directories, then checks the
192
+ Hub cache, and downloads the pinned file if needed and network access is allowed.
193
+ The examples below load `./Realtime-Venus-Omni` or `./Realtime-Venus-Audio`; run
194
+ them from the download directory, with asset and output paths relative to it.
195
+
196
+ ### First load with automatic root configuration download
197
+
198
+ If you use `snapshot_download` to fetch only one model subdirectory, keep your
199
+ existing download code and `allow_patterns` unchanged. For the first
200
+ `AutoModel.from_pretrained` call, omit `local_files_only` or set it to `False`
201
+ when the matching root YAML is not yet available locally or in the cache.
202
+ The model configuration class will download and validate the referenced YAML;
203
+ there is no need to download the other model directory.
204
+
205
+ Alternatively, prepare only the configuration before using the offline model
206
+ initialization examples below. This step does not load model weights:
207
+
208
+ ```python
209
+ from transformers import AutoConfig
210
+
211
+ model_dir = "./Realtime-Venus-Audio" # or "./Realtime-Venus-Omni"
212
+ config = AutoConfig.from_pretrained(model_dir, trust_remote_code=True)
213
+ ```
214
+
215
+ ### Offline loading after preparation
216
+
217
+ The initialization examples below use `local_files_only=True`. They require the
218
+ matching root YAML to be present beside the model directories or in the Hub
219
+ cache, as well as the downloaded model files. If it is missing, loading fails
220
+ with an explicit error; offline mode does not silently download it or fall back
221
+ to another revision. `HF_HUB_OFFLINE=1` and `TRANSFORMERS_OFFLINE=1` also disable
222
+ network access; set these variables before importing the libraries.
223
+
224
+ If you pass `cache_dir`, use the same directory for preparation and later
225
+ loading. Otherwise the loader follows Transformers' default cache configuration,
226
+ including the legacy `TRANSFORMERS_CACHE` setting. Root downloads also preserve
227
+ an explicitly supplied `proxies` argument. The root YAML's Hub cache is separate
228
+ from the `.cache/huggingface` download metadata under a snapshot's `local_dir`.
229
+ When moving a model to an offline machine, also provide the matching root YAML
230
+ beside its directory or transfer the corresponding Hub cache. Copying only the
231
+ model subdirectory does not transfer that cached dependency.
232
 
233
  As an independent alternative, the ModelScope CLI (installed separately) can
234
  download the entire mirror repository:
 
723
 
724
  </details>
725
 
726
+ ## 9. Data
727
+
728
+ HEARTBEAT Challenge evaluates when to respond and what to say in continuous audio or audio-visual interaction, covering reciprocal audio turn-taking and streaming proactive understanding. The challenge grew out of Realtime-Venus; see the [data README](./data/HEARTBEAT_Challenge/README.md) for task details, data organization, and loading instructions.
729
+
730
+ ## 10. 📝 Citation
731
 
732
  If you find Realtime-Venus useful, please cite the technical report:
733
 
 
740
  }
741
  ```
742
 
743
+ ## 11. 📄 License
744
 
745
  This repository includes an [Apache License 2.0](./LICENSE). Please also review
746
  the licenses and acceptable-use terms of the upstream model, third-party
README_zh.md CHANGED
@@ -112,7 +112,7 @@ hf download inclusionAI/Realtime-Venus download_models.py --local-dir .
112
  python download_models.py --model all --local-dir .
113
  ```
114
 
115
- 如只需一款模型,将参数改为 `--model omni` 或 `--model audio`。下载器读取本仓库根目录的 `config.yaml`,下载所选模型的完整子目录,包括权重、自定义代码和资源文件;同时保存下载清单,并使用 Hugging Face Hub 的标准进度显示与缓存。单次下载中的所有文件均来自同一个仓库版本。
116
 
117
  下载后安装推理依赖。选择 Omni 或 `all` 时运行:
118
 
@@ -136,7 +136,26 @@ paths = download_models(model="omni", local_dir=".") # 可选 "omni"、"audio"
136
  model_dir = paths["omni"] # pathlib.Path;Audio 使用 paths["audio"]
137
  ```
138
 
139
- 下文推理示例直接加载下载后的本地模型目录。请在同一目录中运行,资源文件和输出路径均相对于当前目录。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  也可以独立使用 ModelScope CLI(需另行安装)下载整个镜像仓库:
142
 
@@ -594,7 +613,11 @@ print("Saved generated speech to output/audio_full_duplex.wav")
594
 
595
  </details>
596
 
597
- ## 9. 📝 引用
 
 
 
 
598
 
599
  如果 Realtime-Venus 对你的工作有帮助,请引用技术报告:
600
 
@@ -607,6 +630,6 @@ print("Saved generated speech to output/audio_full_duplex.wav")
607
  }
608
  ```
609
 
610
- ## 10. 📄 许可证
611
 
612
  本仓库包含 [Apache License 2.0](./LICENSE)。另请查阅上游模型、第三方库,以及与本模型配合使用的数据各自的许可证和可接受使用条款。
 
112
  python download_models.py --model all --local-dir .
113
  ```
114
 
115
+ 如只需一款模型,将参数改为 `--model omni` 或 `--model audio`。下载器先获取根 `config.yaml`(包含两款模型的完整配置和目录映射),再下载所选模型的完整子目录,包括权重、自定义代码和资源文件。单次下载中的所有文件均来自同一个仓库版本,并使用 Hugging Face Hub 的标准进度显示与缓存。
116
 
117
  下载后安装推理依赖。选择 Omni 或 `all` 时运行:
118
 
 
136
  model_dir = paths["omni"] # pathlib.Path;Audio 使用 paths["audio"]
137
  ```
138
 
139
+ 模型子目录中的 `config.json` 引用固定版本根 `config.yaml` 中的完整配置。加载时,配置类先检查模型目录父级是否有匹配的 YAML,再查找 Hub 缓存;仍缺失且允许联网时,自动下载引用指定的文件。下文示例分别从 `./Realtime-Venus-Omni` 或 `./Realtime-Venus-Audio` 加载模型;请在下载目录中运行,资源文件和输出路径均相对于该目录。
140
+
141
+ ### 首次加载:允许自动获取根配置
142
+
143
+ 如果通过 `snapshot_download` 仅下载一款模型的子目录,原下载代码和 `allow_patterns` 均无需修改。匹配的根 YAML 尚未在本地或缓存中准备好时,首次调用 `AutoModel.from_pretrained` 应省略 `local_files_only`,或将其设为 `False`。配置类会自动下载并校验引用的根 YAML,无需下载另一款模型目录。
144
+
145
+ 也可以先只解析并缓存配置,再执行下文的离线模型初始化示例。这一步不加载模型权重:
146
+
147
+ ```python
148
+ from transformers import AutoConfig
149
+
150
+ model_dir = "./Realtime-Venus-Audio" # 或 "./Realtime-Venus-Omni"
151
+ config = AutoConfig.from_pretrained(model_dir, trust_remote_code=True)
152
+ ```
153
+
154
+ ### 配置准备好后:离线加载
155
+
156
+ 下文初始化示例使用 `local_files_only=True`,前提是模型文件已下载完整,且模型目录父级或 Hub 缓存中已有匹配的根 YAML。缺少时会明确报错;离线模式不会偷偷联网,也不会回退到其他版本。`HF_HUB_OFFLINE=1` 和 `TRANSFORMERS_OFFLINE=1` 同样禁止联网,请在导入库之前设置。
157
+
158
+ 若显式传入 `cache_dir`,首次准备和后续加载应使用同一目录;未传入时,解析器遵循 Transformers 的默认缓存设置,包括旧的 `TRANSFORMERS_CACHE`。根文件下载也会保留调用方显式传入的 `proxies`。根 YAML 所用的 Hub 缓存,与 snapshot 的 `local_dir` 下 `.cache/huggingface` 下载元数据目录是两套机制。搬移到离线机器时,需要把匹配的根 YAML 一并放在模型目录父级,或迁移对应 Hub 缓存;仅复制模型子目录不会同时带走该缓存依赖。
159
 
160
  也可以独立使用 ModelScope CLI(需另行安装)下载整个镜像仓库:
161
 
 
613
 
614
  </details>
615
 
616
+ ## 9. Data
617
+
618
+ HEARTBEAT Challenge 评测系统在连续音频或音视频输入中判断何时回应、说什么的能力,涵盖双向音频轮次交互与流式主动理解两个赛道。该挑战赛由 Realtime-Venus 发展而来,具体任务、数据组织和读取方法见[数据 README](./data/HEARTBEAT_Challenge/README_zh.md)。
619
+
620
+ ## 10. 📝 引用
621
 
622
  如果 Realtime-Venus 对你的工作有帮助,请引用技术报告:
623
 
 
630
  }
631
  ```
632
 
633
+ ## 11. 📄 许可证
634
 
635
  本仓库包含 [Apache License 2.0](./LICENSE)。另请查阅上游模型、第三方库,以及与本模型配合使用的数据各自的许可证和可接受使用条款。
Realtime-Venus-Audio/config.json CHANGED
@@ -1,323 +1,19 @@
1
  {
 
2
  "architectures": [
3
  "MiniCPMO"
4
  ],
5
- "attention_bias": false,
6
- "attention_dropout": 0.0,
7
- "audio_chunk_length": 1.0,
8
- "audio_config": {
9
- "_attn_implementation_autoset": true,
10
- "_name_or_path": "openai/whisper-medium",
11
- "activation_dropout": 0.0,
12
- "activation_function": "gelu",
13
- "apply_spec_augment": false,
14
- "architectures": [
15
- "MiniCPMWhisperEncoder"
16
- ],
17
- "attention_dropout": 0.0,
18
- "begin_suppress_tokens": [
19
- 220,
20
- 50257
21
- ],
22
- "bos_token_id": 50257,
23
- "classifier_proj_size": 256,
24
- "d_model": 1024,
25
- "decoder_attention_heads": 16,
26
- "decoder_ffn_dim": 4096,
27
- "decoder_layerdrop": 0.0,
28
- "decoder_layers": 24,
29
- "decoder_start_token_id": 50258,
30
- "dropout": 0.0,
31
- "dtype": "float32",
32
- "encoder_attention_heads": 16,
33
- "encoder_ffn_dim": 4096,
34
- "encoder_layerdrop": 0.0,
35
- "encoder_layers": 24,
36
- "eos_token_id": 50257,
37
- "forced_decoder_ids": [
38
- [
39
- 1,
40
- 50259
41
- ],
42
- [
43
- 2,
44
- 50359
45
- ],
46
- [
47
- 3,
48
- 50363
49
- ]
50
- ],
51
- "init_std": 0.02,
52
- "mask_feature_length": 10,
53
- "mask_feature_min_masks": 0,
54
- "mask_feature_prob": 0.0,
55
- "mask_time_length": 10,
56
- "mask_time_min_masks": 2,
57
- "mask_time_prob": 0.05,
58
- "max_length": 448,
59
- "max_source_positions": 1500,
60
- "max_target_positions": 448,
61
- "median_filter_width": 7,
62
- "model_type": "whisper",
63
- "num_hidden_layers": 24,
64
- "num_mel_bins": 80,
65
- "pad_token_id": 50257,
66
- "scale_embedding": false,
67
- "suppress_tokens": [
68
- 1,
69
- 2,
70
- 7,
71
- 8,
72
- 9,
73
- 10,
74
- 14,
75
- 25,
76
- 26,
77
- 27,
78
- 28,
79
- 29,
80
- 31,
81
- 58,
82
- 59,
83
- 60,
84
- 61,
85
- 62,
86
- 63,
87
- 90,
88
- 91,
89
- 92,
90
- 93,
91
- 359,
92
- 503,
93
- 522,
94
- 542,
95
- 873,
96
- 893,
97
- 902,
98
- 918,
99
- 922,
100
- 931,
101
- 1350,
102
- 1853,
103
- 1982,
104
- 2460,
105
- 2627,
106
- 3246,
107
- 3253,
108
- 3268,
109
- 3536,
110
- 3846,
111
- 3961,
112
- 4183,
113
- 4667,
114
- 6585,
115
- 6647,
116
- 7273,
117
- 9061,
118
- 9383,
119
- 10428,
120
- 10929,
121
- 11938,
122
- 12033,
123
- 12331,
124
- 12562,
125
- 13793,
126
- 14157,
127
- 14635,
128
- 15265,
129
- 15618,
130
- 16553,
131
- 16604,
132
- 18362,
133
- 18956,
134
- 20075,
135
- 21675,
136
- 22520,
137
- 26130,
138
- 26161,
139
- 26435,
140
- 28279,
141
- 29464,
142
- 31650,
143
- 32302,
144
- 32470,
145
- 36865,
146
- 42863,
147
- 47425,
148
- 49870,
149
- 50254,
150
- 50258,
151
- 50358,
152
- 50359,
153
- 50360,
154
- 50361,
155
- 50362
156
- ],
157
- "use_cache": true,
158
- "use_weighted_layer_sum": false,
159
- "vocab_size": 51865
160
- },
161
- "audio_pool_step": 5,
162
  "auto_map": {
163
  "AutoConfig": "configuration_minicpmo.MiniCPMOConfig",
164
  "AutoModel": "modeling_minicpmo.MiniCPMO",
165
  "AutoModelForCausalLM": "modeling_minicpmo.MiniCPMO"
166
  },
167
- "batch_vision_input": true,
168
- "bos_token_id": 151643,
169
- "drop_vision_last_layer": false,
170
- "dtype": "bfloat16",
171
- "eos_token_id": 151645,
172
- "head_dim": 128,
173
- "hidden_act": "silu",
174
- "hidden_size": 4096,
175
- "image_size": 448,
176
- "init_audio": true,
177
- "init_tts": true,
178
- "init_vision": true,
179
- "initializer_range": 0.02,
180
- "intermediate_size": 12288,
181
- "layer_types": [
182
- "full_attention",
183
- "full_attention",
184
- "full_attention",
185
- "full_attention",
186
- "full_attention",
187
- "full_attention",
188
- "full_attention",
189
- "full_attention",
190
- "full_attention",
191
- "full_attention",
192
- "full_attention",
193
- "full_attention",
194
- "full_attention",
195
- "full_attention",
196
- "full_attention",
197
- "full_attention",
198
- "full_attention",
199
- "full_attention",
200
- "full_attention",
201
- "full_attention",
202
- "full_attention",
203
- "full_attention",
204
- "full_attention",
205
- "full_attention",
206
- "full_attention",
207
- "full_attention",
208
- "full_attention",
209
- "full_attention",
210
- "full_attention",
211
- "full_attention",
212
- "full_attention",
213
- "full_attention",
214
- "full_attention",
215
- "full_attention",
216
- "full_attention",
217
- "full_attention"
218
- ],
219
- "listen_speak_type": "asr",
220
- "max_position_embeddings": 40960,
221
- "max_window_layers": 36,
222
- "model_type": "minicpmo",
223
- "num_attention_heads": 32,
224
- "num_hidden_layers": 36,
225
- "num_key_value_heads": 8,
226
- "patch_size": 14,
227
- "query_num": 64,
228
- "rms_norm_eps": 1e-06,
229
- "rope_scaling": null,
230
- "rope_theta": 1000000,
231
- "slice_config": {
232
- "max_slice_nums": 1,
233
- "model_type": "minicpmv",
234
- "patch_size": 14,
235
- "scale_resolution": 448
236
- },
237
- "slice_mode": true,
238
- "sliding_window": null,
239
- "stream_input": true,
240
- "tie_word_embeddings": false,
241
- "transformers_version": "4.57.6",
242
- "tts_config": {
243
- "_attn_implementation_autoset": true,
244
- "attention_type": "full_attention",
245
- "attn_implementation": "eager",
246
- "audio_bos_token_id": 151687,
247
- "audio_tokenizer_sample_rate": 16000,
248
- "audio_tokenizer_type": "s3tokenizer",
249
- "aug_layer_loss_weight": false,
250
- "aug_loss_weight": false,
251
- "backbone_model": "llama",
252
- "condition_type": "hidden_text_merge",
253
- "cosyvoice_config_path": null,
254
- "cosyvoice_model_dir": null,
255
- "filter_tts_loss": false,
256
- "hidden_act": "silu",
257
- "hidden_size": 768,
258
- "interleaved": false,
259
- "intermediate_size": 3072,
260
- "llm_dim": 4096,
261
- "llm_dim_model_base": 256,
262
- "llm_down_scale": false,
263
- "llm_hidden_size": 4096,
264
- "llm_intermediate_size": 768,
265
- "long_weight": 0.1,
266
- "max_position_embeddings": 4096,
267
- "model_type": "minicpmtts",
268
- "normalize_projected_hidden": true,
269
- "num_attention_heads": 12,
270
- "num_audio_tokens": 6562,
271
- "num_hidden_layers": 20,
272
- "num_key_value_heads": 12,
273
- "num_mel_bins": 100,
274
- "num_text_tokens": 152064,
275
- "num_vq": 1,
276
- "projector_type": "mlp",
277
- "recomputed_chunks": 1,
278
- "s3_stream_chunk_size": 25,
279
- "s3_stream_generate": false,
280
- "s3_stream_n_timesteps": 10,
281
- "s3_stream_prelook_size": 3,
282
- "short_weight": 0.1,
283
- "streaming": false,
284
- "streaming_audio_chunk_size": 50,
285
- "streaming_sliding_window": false,
286
- "streaming_sliding_window_audio_frame_rate": 50,
287
- "streaming_sliding_window_audio_init_text_length": 10,
288
- "streaming_sliding_window_audio_window_size": 300,
289
- "streaming_sliding_window_average_speed": 5,
290
- "streaming_sliding_window_fast_speed": 7,
291
- "streaming_sliding_window_max_text_len": 500,
292
- "streaming_sliding_window_slow_speed": 3,
293
- "streaming_sliding_window_text_window_size": 50,
294
- "streaming_text_chunk_max": 7,
295
- "streaming_text_chunk_min": 3,
296
- "streaming_text_reserved_len": 300,
297
- "text_eos_token_id": 151692,
298
- "tts_filter_loss_fix": false,
299
- "use_llm_hidden_state": false,
300
- "use_text": true,
301
- "window_size": 2
302
- },
303
- "use_cache": true,
304
- "use_image_id": true,
305
- "use_sliding_window": false,
306
- "version": "4.5",
307
- "vision_batch_size": 16,
308
- "vision_config": {
309
- "_attn_implementation_autoset": true,
310
- "attention_dropout": 0.0,
311
- "hidden_act": "gelu_pytorch_tanh",
312
- "hidden_size": 1152,
313
- "image_size": 980,
314
- "intermediate_size": 4304,
315
- "layer_norm_eps": 1e-06,
316
- "model_type": "siglip_vision_model",
317
- "num_attention_heads": 16,
318
- "num_channels": 3,
319
- "num_hidden_layers": 27,
320
- "patch_size": 14
321
- },
322
- "vocab_size": 151752
323
  }
 
1
  {
2
+ "model_type": "minicpmo",
3
  "architectures": [
4
  "MiniCPMO"
5
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  "auto_map": {
7
  "AutoConfig": "configuration_minicpmo.MiniCPMOConfig",
8
  "AutoModel": "modeling_minicpmo.MiniCPMO",
9
  "AutoModelForCausalLM": "modeling_minicpmo.MiniCPMO"
10
  },
11
+ "venus_config_ref": {
12
+ "repo_id": "inclusionAI/Realtime-Venus",
13
+ "repo_type": "model",
14
+ "filename": "config.yaml",
15
+ "revision": "15d5b420cd8557e9582d41a57a80af3e4de18e47",
16
+ "sha256": "f08995a8bc63d59b01835321128ee1bd05a8a74d91fc8d6ef54b5780fefe84dd",
17
+ "model": "audio"
18
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
Realtime-Venus-Audio/configuration_minicpmo.py CHANGED
@@ -259,3 +259,105 @@ class MiniCPMOConfig(Qwen3Config):
259
  self.patch_size = self.vision_config.patch_size
260
 
261
  super().__init__(**kwargs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  self.patch_size = self.vision_config.patch_size
260
 
261
  super().__init__(**kwargs)
262
+
263
+ @classmethod
264
+ def get_config_dict(cls, pretrained_model_name_or_path, **kwargs):
265
+ options = dict(kwargs)
266
+ cls._set_token_in_kwargs(options)
267
+ config, remaining = super().get_config_dict(pretrained_model_name_or_path, **kwargs)
268
+ return _expand_venus_config(config, pretrained_model_name_or_path, options, 'audio'), remaining
269
+
270
+
271
+ """This helper is embedded into each existing model configuration module."""
272
+
273
+
274
+ def _expand_venus_config(config, model_path, options, expected_model):
275
+ import copy
276
+ import hashlib
277
+ import re
278
+ from pathlib import Path
279
+
280
+ ref = config.get('venus_config_ref')
281
+ if ref is None:
282
+ return config
283
+ expected_types = {'audio': 'minicpmo', 'omni': 'realtime_venus_omni'}
284
+ if not isinstance(ref, dict) or set(ref) != {'repo_id','repo_type','filename','revision','sha256','model'}:
285
+ raise ValueError('Invalid venus_config_ref fields')
286
+ if (ref['repo_id'] != 'inclusionAI/Realtime-Venus' or ref['repo_type'] != 'model'
287
+ or ref['filename'] != 'config.yaml' or ref['model'] != expected_model):
288
+ raise ValueError('venus_config_ref repository/file/model identity mismatch')
289
+ if not isinstance(ref['revision'],str) or not re.fullmatch(r'[0-9a-f]{40}', ref['revision']):
290
+ raise ValueError('venus_config_ref requires a fixed full commit SHA')
291
+ if not isinstance(ref['sha256'],str) or not re.fullmatch(r'[0-9a-f]{64}', ref['sha256']):
292
+ raise ValueError('venus_config_ref requires a SHA-256 digest')
293
+ if config.get('model_type') != expected_types[expected_model]:
294
+ raise ValueError('Child configuration model_type mismatch')
295
+
296
+ raw = None
297
+ path = Path(model_path)
298
+ subfolder = options.get('subfolder', '')
299
+ candidates = []
300
+ if path.is_dir():
301
+ model_dir = path / subfolder if subfolder else path
302
+ candidates.append(model_dir.parent / 'config.yaml')
303
+ elif path.is_file():
304
+ candidates.append(path.parent.parent / 'config.yaml')
305
+ for candidate in candidates:
306
+ if candidate.is_file():
307
+ value = candidate.read_bytes()
308
+ if hashlib.sha256(value).hexdigest() == ref['sha256']:
309
+ raw = value
310
+ break
311
+
312
+ if raw is None:
313
+ from huggingface_hub import hf_hub_download, try_to_load_from_cache
314
+ from transformers.utils.hub import TRANSFORMERS_CACHE
315
+ cache_dir = options.get('cache_dir') or TRANSFORMERS_CACHE
316
+ cached = try_to_load_from_cache(ref['repo_id'],ref['filename'],
317
+ revision=ref['revision'],repo_type='model',cache_dir=cache_dir)
318
+ if isinstance(cached,str):
319
+ raw = Path(cached).read_bytes()
320
+ else:
321
+ download_options = {k: options[k] for k in
322
+ ('token','local_files_only','force_download','user_agent','proxies') if k in options}
323
+ download_options['cache_dir'] = cache_dir
324
+ try:
325
+ resolved = hf_hub_download(repo_id=ref['repo_id'],repo_type='model',
326
+ filename=ref['filename'],revision=ref['revision'],**download_options)
327
+ except OSError as error:
328
+ raise OSError('Required pinned Realtime-Venus config.yaml is unavailable locally/in cache; '
329
+ 'download that revision while online or place its verified YAML beside the model directory.') from error
330
+ raw = Path(resolved).read_bytes()
331
+ if hashlib.sha256(raw).hexdigest() != ref['sha256']:
332
+ raise ValueError('Pinned Realtime-Venus config.yaml SHA-256 mismatch')
333
+
334
+ import yaml
335
+ document = yaml.safe_load(raw)
336
+ if not isinstance(document,dict) or document.get('schema_version') != 3 or document.get('name') != 'Realtime-Venus':
337
+ raise ValueError('Invalid Realtime-Venus root YAML schema/name')
338
+ models = document.get('models')
339
+ entry = models.get(expected_model) if isinstance(models,dict) else None
340
+ expected_path = 'Realtime-Venus-Audio' if expected_model == 'audio' else 'Realtime-Venus-Omni'
341
+ if not isinstance(entry,dict) or entry.get('path') != expected_path:
342
+ raise ValueError('Root YAML model path mismatch')
343
+ full = entry.get('hf_config')
344
+ if not isinstance(full,dict) or 'venus_config_ref' in full or full.get('model_type') != expected_types[expected_model]:
345
+ raise ValueError('Root YAML hf_config model identity mismatch')
346
+ if full.get('architectures') != config.get('architectures'):
347
+ raise ValueError('Root YAML architecture mismatch')
348
+ for field in ('audio_config','vision_config','tts_config'):
349
+ if not isinstance(full.get(field),dict):
350
+ raise ValueError('Incomplete root hf_config: ' + field)
351
+ def auto_map_identity(mapping):
352
+ if not isinstance(mapping,dict):
353
+ raise ValueError('Invalid auto_map')
354
+ return {k:v.split('--')[-1] for k,v in mapping.items()}
355
+ if auto_map_identity(full.get('auto_map')) != auto_map_identity(config.get('auto_map')):
356
+ raise ValueError('Root YAML AutoClass identity mismatch')
357
+ expanded = copy.deepcopy(full)
358
+ # Keep the current model snapshot's code/weights revision, not the YAML's.
359
+ if '_commit_hash' in config:
360
+ expanded['_commit_hash'] = config['_commit_hash']
361
+ expanded['auto_map'] = copy.deepcopy(config['auto_map'])
362
+ expanded['_name_or_path'] = str(model_path)
363
+ return expanded
Realtime-Venus-Omni/config.json CHANGED
@@ -1,285 +1,19 @@
1
  {
 
2
  "architectures": [
3
  "RealtimeVenusOmni"
4
  ],
5
- "version": "4.5",
6
- "attention_bias": false,
7
- "attention_dropout": 0.0,
8
- "audio_chunk_length": 1.0,
9
- "audio_config": {
10
- "_attn_implementation_autoset": true,
11
- "_name_or_path": "openai/whisper-medium",
12
- "activation_dropout": 0.0,
13
- "activation_function": "gelu",
14
- "apply_spec_augment": false,
15
- "architectures": [
16
- "RealtimeVenusOmniWhisperEncoder"
17
- ],
18
- "attention_dropout": 0.0,
19
- "begin_suppress_tokens": [
20
- 220,
21
- 50257
22
- ],
23
- "bos_token_id": 50257,
24
- "classifier_proj_size": 256,
25
- "d_model": 1024,
26
- "decoder_attention_heads": 16,
27
- "decoder_ffn_dim": 4096,
28
- "decoder_layerdrop": 0.0,
29
- "decoder_layers": 24,
30
- "decoder_start_token_id": 50258,
31
- "dropout": 0.0,
32
- "encoder_attention_heads": 16,
33
- "encoder_ffn_dim": 4096,
34
- "encoder_layerdrop": 0.0,
35
- "encoder_layers": 24,
36
- "eos_token_id": 50257,
37
- "forced_decoder_ids": [
38
- [
39
- 1,
40
- 50259
41
- ],
42
- [
43
- 2,
44
- 50359
45
- ],
46
- [
47
- 3,
48
- 50363
49
- ]
50
- ],
51
- "init_std": 0.02,
52
- "mask_feature_length": 10,
53
- "mask_feature_min_masks": 0,
54
- "mask_feature_prob": 0.0,
55
- "mask_time_length": 10,
56
- "mask_time_min_masks": 2,
57
- "mask_time_prob": 0.05,
58
- "max_length": 448,
59
- "max_source_positions": 1500,
60
- "max_target_positions": 448,
61
- "median_filter_width": 7,
62
- "model_type": "whisper",
63
- "num_hidden_layers": 24,
64
- "num_mel_bins": 80,
65
- "pad_token_id": 50257,
66
- "scale_embedding": false,
67
- "suppress_tokens": [
68
- 1,
69
- 2,
70
- 7,
71
- 8,
72
- 9,
73
- 10,
74
- 14,
75
- 25,
76
- 26,
77
- 27,
78
- 28,
79
- 29,
80
- 31,
81
- 58,
82
- 59,
83
- 60,
84
- 61,
85
- 62,
86
- 63,
87
- 90,
88
- 91,
89
- 92,
90
- 93,
91
- 359,
92
- 503,
93
- 522,
94
- 542,
95
- 873,
96
- 893,
97
- 902,
98
- 918,
99
- 922,
100
- 931,
101
- 1350,
102
- 1853,
103
- 1982,
104
- 2460,
105
- 2627,
106
- 3246,
107
- 3253,
108
- 3268,
109
- 3536,
110
- 3846,
111
- 3961,
112
- 4183,
113
- 4667,
114
- 6585,
115
- 6647,
116
- 7273,
117
- 9061,
118
- 9383,
119
- 10428,
120
- 10929,
121
- 11938,
122
- 12033,
123
- 12331,
124
- 12562,
125
- 13793,
126
- 14157,
127
- 14635,
128
- 15265,
129
- 15618,
130
- 16553,
131
- 16604,
132
- 18362,
133
- 18956,
134
- 20075,
135
- 21675,
136
- 22520,
137
- 26130,
138
- 26161,
139
- 26435,
140
- 28279,
141
- 29464,
142
- 31650,
143
- 32302,
144
- 32470,
145
- 36865,
146
- 42863,
147
- 47425,
148
- 49870,
149
- 50254,
150
- 50258,
151
- 50358,
152
- 50359,
153
- 50360,
154
- 50361,
155
- 50362
156
- ],
157
- "torch_dtype": "float32",
158
- "use_cache": true,
159
- "use_weighted_layer_sum": false,
160
- "vocab_size": 51865
161
- },
162
- "audio_pool_step": 5,
163
  "auto_map": {
164
  "AutoConfig": "configuration_realtime_venus_omni.RealtimeVenusOmniConfig",
165
  "AutoModel": "modeling_realtime_venus_omni.RealtimeVenusOmni",
166
  "AutoModelForCausalLM": "modeling_realtime_venus_omni.RealtimeVenusOmni"
167
  },
168
- "batch_vision_input": true,
169
- "bos_token_id": 151643,
170
- "drop_vision_last_layer": false,
171
- "eos_token_id": 151645,
172
- "head_dim": 128,
173
- "hidden_act": "silu",
174
- "hidden_size": 4096,
175
- "image_size": 448,
176
- "init_audio": true,
177
- "init_tts": true,
178
- "init_vision": true,
179
- "initializer_range": 0.02,
180
- "intermediate_size": 12288,
181
- "listen_speak_type": "asr",
182
- "max_position_embeddings": 40960,
183
- "max_window_layers": 36,
184
- "model_type": "realtime_venus_omni",
185
- "num_attention_heads": 32,
186
- "num_hidden_layers": 36,
187
- "num_key_value_heads": 8,
188
- "patch_size": 14,
189
- "query_num": 64,
190
- "rms_norm_eps": 1e-06,
191
- "rope_scaling": null,
192
- "rope_theta": 1000000,
193
- "slice_config": {
194
- "max_slice_nums": 1,
195
- "model_type": "realtime_venus_omni_vision",
196
- "patch_size": 14,
197
- "scale_resolution": 448
198
- },
199
- "slice_mode": true,
200
- "sliding_window": null,
201
- "stream_input": true,
202
- "tie_word_embeddings": false,
203
- "torch_dtype": "bfloat16",
204
- "transformers_version": "4.51.0",
205
- "tts_config": {
206
- "_attn_implementation_autoset": true,
207
- "attention_type": "full_attention",
208
- "attn_implementation": "sdpa",
209
- "audio_bos_token_id": 151687,
210
- "audio_tokenizer_sample_rate": 16000,
211
- "audio_tokenizer_type": "s3tokenizer",
212
- "aug_layer_loss_weight": false,
213
- "aug_loss_weight": false,
214
- "backbone_model": "llama",
215
- "condition_type": "hidden_text_merge",
216
- "cosyvoice_config_path": null,
217
- "cosyvoice_model_dir": null,
218
- "filter_tts_loss": false,
219
- "hidden_act": "silu",
220
- "hidden_size": 768,
221
- "interleaved": false,
222
- "intermediate_size": 3072,
223
- "llm_dim": 4096,
224
- "llm_dim_model_base": 256,
225
- "llm_down_scale": false,
226
- "llm_hidden_size": 4096,
227
- "llm_intermediate_size": 768,
228
- "long_weight": 0.1,
229
- "max_position_embeddings": 4096,
230
- "model_type": "realtime_venus_omni_tts",
231
- "normalize_projected_hidden": true,
232
- "num_attention_heads": 12,
233
- "num_audio_tokens": 6562,
234
- "num_hidden_layers": 20,
235
- "num_key_value_heads": 12,
236
- "num_mel_bins": 100,
237
- "num_text_tokens": 152064,
238
- "num_vq": 1,
239
- "projector_type": "mlp",
240
- "recomputed_chunks": 1,
241
- "s3_stream_chunk_size": 25,
242
- "s3_stream_generate": false,
243
- "s3_stream_n_timesteps": 10,
244
- "s3_stream_prelook_size": 3,
245
- "short_weight": 0.1,
246
- "streaming": false,
247
- "streaming_audio_chunk_size": 50,
248
- "streaming_sliding_window": false,
249
- "streaming_sliding_window_audio_frame_rate": 50,
250
- "streaming_sliding_window_audio_init_text_length": 10,
251
- "streaming_sliding_window_audio_window_size": 300,
252
- "streaming_sliding_window_average_speed": 5,
253
- "streaming_sliding_window_fast_speed": 7,
254
- "streaming_sliding_window_max_text_len": 500,
255
- "streaming_sliding_window_slow_speed": 3,
256
- "streaming_sliding_window_text_window_size": 50,
257
- "streaming_text_chunk_max": 7,
258
- "streaming_text_chunk_min": 3,
259
- "streaming_text_reserved_len": 300,
260
- "text_eos_token_id": 151692,
261
- "tts_filter_loss_fix": false,
262
- "use_llm_hidden_state": false,
263
- "use_text": true,
264
- "window_size": 2
265
- },
266
- "use_cache": true,
267
- "use_image_id": true,
268
- "use_sliding_window": false,
269
- "vision_batch_size": 16,
270
- "vision_config": {
271
- "_attn_implementation_autoset": true,
272
- "attention_dropout": 0.0,
273
- "hidden_act": "gelu_pytorch_tanh",
274
- "hidden_size": 1152,
275
- "image_size": 980,
276
- "intermediate_size": 4304,
277
- "layer_norm_eps": 1e-06,
278
- "model_type": "siglip_vision_model",
279
- "num_attention_heads": 16,
280
- "num_channels": 3,
281
- "num_hidden_layers": 27,
282
- "patch_size": 14
283
- },
284
- "vocab_size": 151752
285
  }
 
1
  {
2
+ "model_type": "realtime_venus_omni",
3
  "architectures": [
4
  "RealtimeVenusOmni"
5
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  "auto_map": {
7
  "AutoConfig": "configuration_realtime_venus_omni.RealtimeVenusOmniConfig",
8
  "AutoModel": "modeling_realtime_venus_omni.RealtimeVenusOmni",
9
  "AutoModelForCausalLM": "modeling_realtime_venus_omni.RealtimeVenusOmni"
10
  },
11
+ "venus_config_ref": {
12
+ "repo_id": "inclusionAI/Realtime-Venus",
13
+ "repo_type": "model",
14
+ "filename": "config.yaml",
15
+ "revision": "15d5b420cd8557e9582d41a57a80af3e4de18e47",
16
+ "sha256": "f08995a8bc63d59b01835321128ee1bd05a8a74d91fc8d6ef54b5780fefe84dd",
17
+ "model": "omni"
18
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
Realtime-Venus-Omni/configuration_realtime_venus_omni.py CHANGED
@@ -259,3 +259,105 @@ class RealtimeVenusOmniConfig(Qwen3Config):
259
  self.patch_size = self.vision_config.patch_size
260
 
261
  super().__init__(**kwargs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  self.patch_size = self.vision_config.patch_size
260
 
261
  super().__init__(**kwargs)
262
+
263
+ @classmethod
264
+ def get_config_dict(cls, pretrained_model_name_or_path, **kwargs):
265
+ options = dict(kwargs)
266
+ cls._set_token_in_kwargs(options)
267
+ config, remaining = super().get_config_dict(pretrained_model_name_or_path, **kwargs)
268
+ return _expand_venus_config(config, pretrained_model_name_or_path, options, 'omni'), remaining
269
+
270
+
271
+ """This helper is embedded into each existing model configuration module."""
272
+
273
+
274
+ def _expand_venus_config(config, model_path, options, expected_model):
275
+ import copy
276
+ import hashlib
277
+ import re
278
+ from pathlib import Path
279
+
280
+ ref = config.get('venus_config_ref')
281
+ if ref is None:
282
+ return config
283
+ expected_types = {'audio': 'minicpmo', 'omni': 'realtime_venus_omni'}
284
+ if not isinstance(ref, dict) or set(ref) != {'repo_id','repo_type','filename','revision','sha256','model'}:
285
+ raise ValueError('Invalid venus_config_ref fields')
286
+ if (ref['repo_id'] != 'inclusionAI/Realtime-Venus' or ref['repo_type'] != 'model'
287
+ or ref['filename'] != 'config.yaml' or ref['model'] != expected_model):
288
+ raise ValueError('venus_config_ref repository/file/model identity mismatch')
289
+ if not isinstance(ref['revision'],str) or not re.fullmatch(r'[0-9a-f]{40}', ref['revision']):
290
+ raise ValueError('venus_config_ref requires a fixed full commit SHA')
291
+ if not isinstance(ref['sha256'],str) or not re.fullmatch(r'[0-9a-f]{64}', ref['sha256']):
292
+ raise ValueError('venus_config_ref requires a SHA-256 digest')
293
+ if config.get('model_type') != expected_types[expected_model]:
294
+ raise ValueError('Child configuration model_type mismatch')
295
+
296
+ raw = None
297
+ path = Path(model_path)
298
+ subfolder = options.get('subfolder', '')
299
+ candidates = []
300
+ if path.is_dir():
301
+ model_dir = path / subfolder if subfolder else path
302
+ candidates.append(model_dir.parent / 'config.yaml')
303
+ elif path.is_file():
304
+ candidates.append(path.parent.parent / 'config.yaml')
305
+ for candidate in candidates:
306
+ if candidate.is_file():
307
+ value = candidate.read_bytes()
308
+ if hashlib.sha256(value).hexdigest() == ref['sha256']:
309
+ raw = value
310
+ break
311
+
312
+ if raw is None:
313
+ from huggingface_hub import hf_hub_download, try_to_load_from_cache
314
+ from transformers.utils.hub import TRANSFORMERS_CACHE
315
+ cache_dir = options.get('cache_dir') or TRANSFORMERS_CACHE
316
+ cached = try_to_load_from_cache(ref['repo_id'],ref['filename'],
317
+ revision=ref['revision'],repo_type='model',cache_dir=cache_dir)
318
+ if isinstance(cached,str):
319
+ raw = Path(cached).read_bytes()
320
+ else:
321
+ download_options = {k: options[k] for k in
322
+ ('token','local_files_only','force_download','user_agent','proxies') if k in options}
323
+ download_options['cache_dir'] = cache_dir
324
+ try:
325
+ resolved = hf_hub_download(repo_id=ref['repo_id'],repo_type='model',
326
+ filename=ref['filename'],revision=ref['revision'],**download_options)
327
+ except OSError as error:
328
+ raise OSError('Required pinned Realtime-Venus config.yaml is unavailable locally/in cache; '
329
+ 'download that revision while online or place its verified YAML beside the model directory.') from error
330
+ raw = Path(resolved).read_bytes()
331
+ if hashlib.sha256(raw).hexdigest() != ref['sha256']:
332
+ raise ValueError('Pinned Realtime-Venus config.yaml SHA-256 mismatch')
333
+
334
+ import yaml
335
+ document = yaml.safe_load(raw)
336
+ if not isinstance(document,dict) or document.get('schema_version') != 3 or document.get('name') != 'Realtime-Venus':
337
+ raise ValueError('Invalid Realtime-Venus root YAML schema/name')
338
+ models = document.get('models')
339
+ entry = models.get(expected_model) if isinstance(models,dict) else None
340
+ expected_path = 'Realtime-Venus-Audio' if expected_model == 'audio' else 'Realtime-Venus-Omni'
341
+ if not isinstance(entry,dict) or entry.get('path') != expected_path:
342
+ raise ValueError('Root YAML model path mismatch')
343
+ full = entry.get('hf_config')
344
+ if not isinstance(full,dict) or 'venus_config_ref' in full or full.get('model_type') != expected_types[expected_model]:
345
+ raise ValueError('Root YAML hf_config model identity mismatch')
346
+ if full.get('architectures') != config.get('architectures'):
347
+ raise ValueError('Root YAML architecture mismatch')
348
+ for field in ('audio_config','vision_config','tts_config'):
349
+ if not isinstance(full.get(field),dict):
350
+ raise ValueError('Incomplete root hf_config: ' + field)
351
+ def auto_map_identity(mapping):
352
+ if not isinstance(mapping,dict):
353
+ raise ValueError('Invalid auto_map')
354
+ return {k:v.split('--')[-1] for k,v in mapping.items()}
355
+ if auto_map_identity(full.get('auto_map')) != auto_map_identity(config.get('auto_map')):
356
+ raise ValueError('Root YAML AutoClass identity mismatch')
357
+ expanded = copy.deepcopy(full)
358
+ # Keep the current model snapshot's code/weights revision, not the YAML's.
359
+ if '_commit_hash' in config:
360
+ expanded['_commit_hash'] = config['_commit_hash']
361
+ expanded['auto_map'] = copy.deepcopy(config['auto_map'])
362
+ expanded['_name_or_path'] = str(model_path)
363
+ return expanded
Realtime-Venus-Omni/requirements.txt CHANGED
@@ -47,3 +47,6 @@ huggingface_hub
47
  # aiofiles==23.2.1
48
  # onnxruntime==1.20.1
49
  # pydantic==2.10.6
 
 
 
 
47
  # aiofiles==23.2.1
48
  # onnxruntime==1.20.1
49
  # pydantic==2.10.6
50
+
51
+ # Pinned root config.yaml resolution
52
+ PyYAML>=6.0
config.json ADDED
The diff for this file is too large to render. See raw diff
 
config.yaml CHANGED
@@ -1,6 +1,580 @@
 
1
  name: Realtime-Venus
2
  models:
3
- omni:
4
- path: Realtime-Venus-Omni
5
  audio:
6
  path: Realtime-Venus-Audio
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version: 3
2
  name: Realtime-Venus
3
  models:
 
 
4
  audio:
5
  path: Realtime-Venus-Audio
6
+ hf_config:
7
+ architectures:
8
+ - MiniCPMO
9
+ attention_bias: false
10
+ attention_dropout: 0.0
11
+ audio_chunk_length: 1.0
12
+ audio_config:
13
+ _attn_implementation_autoset: true
14
+ _name_or_path: openai/whisper-medium
15
+ activation_dropout: 0.0
16
+ activation_function: gelu
17
+ apply_spec_augment: false
18
+ architectures:
19
+ - MiniCPMWhisperEncoder
20
+ attention_dropout: 0.0
21
+ begin_suppress_tokens:
22
+ - 220
23
+ - 50257
24
+ bos_token_id: 50257
25
+ classifier_proj_size: 256
26
+ d_model: 1024
27
+ decoder_attention_heads: 16
28
+ decoder_ffn_dim: 4096
29
+ decoder_layerdrop: 0.0
30
+ decoder_layers: 24
31
+ decoder_start_token_id: 50258
32
+ dropout: 0.0
33
+ dtype: float32
34
+ encoder_attention_heads: 16
35
+ encoder_ffn_dim: 4096
36
+ encoder_layerdrop: 0.0
37
+ encoder_layers: 24
38
+ eos_token_id: 50257
39
+ forced_decoder_ids:
40
+ - - 1
41
+ - 50259
42
+ - - 2
43
+ - 50359
44
+ - - 3
45
+ - 50363
46
+ init_std: 0.02
47
+ mask_feature_length: 10
48
+ mask_feature_min_masks: 0
49
+ mask_feature_prob: 0.0
50
+ mask_time_length: 10
51
+ mask_time_min_masks: 2
52
+ mask_time_prob: 0.05
53
+ max_length: 448
54
+ max_source_positions: 1500
55
+ max_target_positions: 448
56
+ median_filter_width: 7
57
+ model_type: whisper
58
+ num_hidden_layers: 24
59
+ num_mel_bins: 80
60
+ pad_token_id: 50257
61
+ scale_embedding: false
62
+ suppress_tokens:
63
+ - 1
64
+ - 2
65
+ - 7
66
+ - 8
67
+ - 9
68
+ - 10
69
+ - 14
70
+ - 25
71
+ - 26
72
+ - 27
73
+ - 28
74
+ - 29
75
+ - 31
76
+ - 58
77
+ - 59
78
+ - 60
79
+ - 61
80
+ - 62
81
+ - 63
82
+ - 90
83
+ - 91
84
+ - 92
85
+ - 93
86
+ - 359
87
+ - 503
88
+ - 522
89
+ - 542
90
+ - 873
91
+ - 893
92
+ - 902
93
+ - 918
94
+ - 922
95
+ - 931
96
+ - 1350
97
+ - 1853
98
+ - 1982
99
+ - 2460
100
+ - 2627
101
+ - 3246
102
+ - 3253
103
+ - 3268
104
+ - 3536
105
+ - 3846
106
+ - 3961
107
+ - 4183
108
+ - 4667
109
+ - 6585
110
+ - 6647
111
+ - 7273
112
+ - 9061
113
+ - 9383
114
+ - 10428
115
+ - 10929
116
+ - 11938
117
+ - 12033
118
+ - 12331
119
+ - 12562
120
+ - 13793
121
+ - 14157
122
+ - 14635
123
+ - 15265
124
+ - 15618
125
+ - 16553
126
+ - 16604
127
+ - 18362
128
+ - 18956
129
+ - 20075
130
+ - 21675
131
+ - 22520
132
+ - 26130
133
+ - 26161
134
+ - 26435
135
+ - 28279
136
+ - 29464
137
+ - 31650
138
+ - 32302
139
+ - 32470
140
+ - 36865
141
+ - 42863
142
+ - 47425
143
+ - 49870
144
+ - 50254
145
+ - 50258
146
+ - 50358
147
+ - 50359
148
+ - 50360
149
+ - 50361
150
+ - 50362
151
+ use_cache: true
152
+ use_weighted_layer_sum: false
153
+ vocab_size: 51865
154
+ audio_pool_step: 5
155
+ auto_map:
156
+ AutoConfig: configuration_minicpmo.MiniCPMOConfig
157
+ AutoModel: modeling_minicpmo.MiniCPMO
158
+ AutoModelForCausalLM: modeling_minicpmo.MiniCPMO
159
+ batch_vision_input: true
160
+ bos_token_id: 151643
161
+ drop_vision_last_layer: false
162
+ dtype: bfloat16
163
+ eos_token_id: 151645
164
+ head_dim: 128
165
+ hidden_act: silu
166
+ hidden_size: 4096
167
+ image_size: 448
168
+ init_audio: true
169
+ init_tts: true
170
+ init_vision: true
171
+ initializer_range: 0.02
172
+ intermediate_size: 12288
173
+ layer_types:
174
+ - full_attention
175
+ - full_attention
176
+ - full_attention
177
+ - full_attention
178
+ - full_attention
179
+ - full_attention
180
+ - full_attention
181
+ - full_attention
182
+ - full_attention
183
+ - full_attention
184
+ - full_attention
185
+ - full_attention
186
+ - full_attention
187
+ - full_attention
188
+ - full_attention
189
+ - full_attention
190
+ - full_attention
191
+ - full_attention
192
+ - full_attention
193
+ - full_attention
194
+ - full_attention
195
+ - full_attention
196
+ - full_attention
197
+ - full_attention
198
+ - full_attention
199
+ - full_attention
200
+ - full_attention
201
+ - full_attention
202
+ - full_attention
203
+ - full_attention
204
+ - full_attention
205
+ - full_attention
206
+ - full_attention
207
+ - full_attention
208
+ - full_attention
209
+ - full_attention
210
+ listen_speak_type: asr
211
+ max_position_embeddings: 40960
212
+ max_window_layers: 36
213
+ model_type: minicpmo
214
+ num_attention_heads: 32
215
+ num_hidden_layers: 36
216
+ num_key_value_heads: 8
217
+ patch_size: 14
218
+ query_num: 64
219
+ rms_norm_eps: 1.0e-06
220
+ rope_scaling: null
221
+ rope_theta: 1000000
222
+ slice_config:
223
+ max_slice_nums: 1
224
+ model_type: minicpmv
225
+ patch_size: 14
226
+ scale_resolution: 448
227
+ slice_mode: true
228
+ sliding_window: null
229
+ stream_input: true
230
+ tie_word_embeddings: false
231
+ transformers_version: 4.57.6
232
+ tts_config:
233
+ _attn_implementation_autoset: true
234
+ attention_type: full_attention
235
+ attn_implementation: eager
236
+ audio_bos_token_id: 151687
237
+ audio_tokenizer_sample_rate: 16000
238
+ audio_tokenizer_type: s3tokenizer
239
+ aug_layer_loss_weight: false
240
+ aug_loss_weight: false
241
+ backbone_model: llama
242
+ condition_type: hidden_text_merge
243
+ cosyvoice_config_path: null
244
+ cosyvoice_model_dir: null
245
+ filter_tts_loss: false
246
+ hidden_act: silu
247
+ hidden_size: 768
248
+ interleaved: false
249
+ intermediate_size: 3072
250
+ llm_dim: 4096
251
+ llm_dim_model_base: 256
252
+ llm_down_scale: false
253
+ llm_hidden_size: 4096
254
+ llm_intermediate_size: 768
255
+ long_weight: 0.1
256
+ max_position_embeddings: 4096
257
+ model_type: minicpmtts
258
+ normalize_projected_hidden: true
259
+ num_attention_heads: 12
260
+ num_audio_tokens: 6562
261
+ num_hidden_layers: 20
262
+ num_key_value_heads: 12
263
+ num_mel_bins: 100
264
+ num_text_tokens: 152064
265
+ num_vq: 1
266
+ projector_type: mlp
267
+ recomputed_chunks: 1
268
+ s3_stream_chunk_size: 25
269
+ s3_stream_generate: false
270
+ s3_stream_n_timesteps: 10
271
+ s3_stream_prelook_size: 3
272
+ short_weight: 0.1
273
+ streaming: false
274
+ streaming_audio_chunk_size: 50
275
+ streaming_sliding_window: false
276
+ streaming_sliding_window_audio_frame_rate: 50
277
+ streaming_sliding_window_audio_init_text_length: 10
278
+ streaming_sliding_window_audio_window_size: 300
279
+ streaming_sliding_window_average_speed: 5
280
+ streaming_sliding_window_fast_speed: 7
281
+ streaming_sliding_window_max_text_len: 500
282
+ streaming_sliding_window_slow_speed: 3
283
+ streaming_sliding_window_text_window_size: 50
284
+ streaming_text_chunk_max: 7
285
+ streaming_text_chunk_min: 3
286
+ streaming_text_reserved_len: 300
287
+ text_eos_token_id: 151692
288
+ tts_filter_loss_fix: false
289
+ use_llm_hidden_state: false
290
+ use_text: true
291
+ window_size: 2
292
+ use_cache: true
293
+ use_image_id: true
294
+ use_sliding_window: false
295
+ version: '4.5'
296
+ vision_batch_size: 16
297
+ vision_config:
298
+ _attn_implementation_autoset: true
299
+ attention_dropout: 0.0
300
+ hidden_act: gelu_pytorch_tanh
301
+ hidden_size: 1152
302
+ image_size: 980
303
+ intermediate_size: 4304
304
+ layer_norm_eps: 1.0e-06
305
+ model_type: siglip_vision_model
306
+ num_attention_heads: 16
307
+ num_channels: 3
308
+ num_hidden_layers: 27
309
+ patch_size: 14
310
+ vocab_size: 151752
311
+ omni:
312
+ path: Realtime-Venus-Omni
313
+ hf_config:
314
+ architectures:
315
+ - RealtimeVenusOmni
316
+ version: '4.5'
317
+ attention_bias: false
318
+ attention_dropout: 0.0
319
+ audio_chunk_length: 1.0
320
+ audio_config:
321
+ _attn_implementation_autoset: true
322
+ _name_or_path: openai/whisper-medium
323
+ activation_dropout: 0.0
324
+ activation_function: gelu
325
+ apply_spec_augment: false
326
+ architectures:
327
+ - RealtimeVenusOmniWhisperEncoder
328
+ attention_dropout: 0.0
329
+ begin_suppress_tokens:
330
+ - 220
331
+ - 50257
332
+ bos_token_id: 50257
333
+ classifier_proj_size: 256
334
+ d_model: 1024
335
+ decoder_attention_heads: 16
336
+ decoder_ffn_dim: 4096
337
+ decoder_layerdrop: 0.0
338
+ decoder_layers: 24
339
+ decoder_start_token_id: 50258
340
+ dropout: 0.0
341
+ encoder_attention_heads: 16
342
+ encoder_ffn_dim: 4096
343
+ encoder_layerdrop: 0.0
344
+ encoder_layers: 24
345
+ eos_token_id: 50257
346
+ forced_decoder_ids:
347
+ - - 1
348
+ - 50259
349
+ - - 2
350
+ - 50359
351
+ - - 3
352
+ - 50363
353
+ init_std: 0.02
354
+ mask_feature_length: 10
355
+ mask_feature_min_masks: 0
356
+ mask_feature_prob: 0.0
357
+ mask_time_length: 10
358
+ mask_time_min_masks: 2
359
+ mask_time_prob: 0.05
360
+ max_length: 448
361
+ max_source_positions: 1500
362
+ max_target_positions: 448
363
+ median_filter_width: 7
364
+ model_type: whisper
365
+ num_hidden_layers: 24
366
+ num_mel_bins: 80
367
+ pad_token_id: 50257
368
+ scale_embedding: false
369
+ suppress_tokens:
370
+ - 1
371
+ - 2
372
+ - 7
373
+ - 8
374
+ - 9
375
+ - 10
376
+ - 14
377
+ - 25
378
+ - 26
379
+ - 27
380
+ - 28
381
+ - 29
382
+ - 31
383
+ - 58
384
+ - 59
385
+ - 60
386
+ - 61
387
+ - 62
388
+ - 63
389
+ - 90
390
+ - 91
391
+ - 92
392
+ - 93
393
+ - 359
394
+ - 503
395
+ - 522
396
+ - 542
397
+ - 873
398
+ - 893
399
+ - 902
400
+ - 918
401
+ - 922
402
+ - 931
403
+ - 1350
404
+ - 1853
405
+ - 1982
406
+ - 2460
407
+ - 2627
408
+ - 3246
409
+ - 3253
410
+ - 3268
411
+ - 3536
412
+ - 3846
413
+ - 3961
414
+ - 4183
415
+ - 4667
416
+ - 6585
417
+ - 6647
418
+ - 7273
419
+ - 9061
420
+ - 9383
421
+ - 10428
422
+ - 10929
423
+ - 11938
424
+ - 12033
425
+ - 12331
426
+ - 12562
427
+ - 13793
428
+ - 14157
429
+ - 14635
430
+ - 15265
431
+ - 15618
432
+ - 16553
433
+ - 16604
434
+ - 18362
435
+ - 18956
436
+ - 20075
437
+ - 21675
438
+ - 22520
439
+ - 26130
440
+ - 26161
441
+ - 26435
442
+ - 28279
443
+ - 29464
444
+ - 31650
445
+ - 32302
446
+ - 32470
447
+ - 36865
448
+ - 42863
449
+ - 47425
450
+ - 49870
451
+ - 50254
452
+ - 50258
453
+ - 50358
454
+ - 50359
455
+ - 50360
456
+ - 50361
457
+ - 50362
458
+ torch_dtype: float32
459
+ use_cache: true
460
+ use_weighted_layer_sum: false
461
+ vocab_size: 51865
462
+ audio_pool_step: 5
463
+ auto_map:
464
+ AutoConfig: configuration_realtime_venus_omni.RealtimeVenusOmniConfig
465
+ AutoModel: modeling_realtime_venus_omni.RealtimeVenusOmni
466
+ AutoModelForCausalLM: modeling_realtime_venus_omni.RealtimeVenusOmni
467
+ batch_vision_input: true
468
+ bos_token_id: 151643
469
+ drop_vision_last_layer: false
470
+ eos_token_id: 151645
471
+ head_dim: 128
472
+ hidden_act: silu
473
+ hidden_size: 4096
474
+ image_size: 448
475
+ init_audio: true
476
+ init_tts: true
477
+ init_vision: true
478
+ initializer_range: 0.02
479
+ intermediate_size: 12288
480
+ listen_speak_type: asr
481
+ max_position_embeddings: 40960
482
+ max_window_layers: 36
483
+ model_type: realtime_venus_omni
484
+ num_attention_heads: 32
485
+ num_hidden_layers: 36
486
+ num_key_value_heads: 8
487
+ patch_size: 14
488
+ query_num: 64
489
+ rms_norm_eps: 1.0e-06
490
+ rope_scaling: null
491
+ rope_theta: 1000000
492
+ slice_config:
493
+ max_slice_nums: 1
494
+ model_type: realtime_venus_omni_vision
495
+ patch_size: 14
496
+ scale_resolution: 448
497
+ slice_mode: true
498
+ sliding_window: null
499
+ stream_input: true
500
+ tie_word_embeddings: false
501
+ torch_dtype: bfloat16
502
+ transformers_version: 4.51.0
503
+ tts_config:
504
+ _attn_implementation_autoset: true
505
+ attention_type: full_attention
506
+ attn_implementation: sdpa
507
+ audio_bos_token_id: 151687
508
+ audio_tokenizer_sample_rate: 16000
509
+ audio_tokenizer_type: s3tokenizer
510
+ aug_layer_loss_weight: false
511
+ aug_loss_weight: false
512
+ backbone_model: llama
513
+ condition_type: hidden_text_merge
514
+ cosyvoice_config_path: null
515
+ cosyvoice_model_dir: null
516
+ filter_tts_loss: false
517
+ hidden_act: silu
518
+ hidden_size: 768
519
+ interleaved: false
520
+ intermediate_size: 3072
521
+ llm_dim: 4096
522
+ llm_dim_model_base: 256
523
+ llm_down_scale: false
524
+ llm_hidden_size: 4096
525
+ llm_intermediate_size: 768
526
+ long_weight: 0.1
527
+ max_position_embeddings: 4096
528
+ model_type: realtime_venus_omni_tts
529
+ normalize_projected_hidden: true
530
+ num_attention_heads: 12
531
+ num_audio_tokens: 6562
532
+ num_hidden_layers: 20
533
+ num_key_value_heads: 12
534
+ num_mel_bins: 100
535
+ num_text_tokens: 152064
536
+ num_vq: 1
537
+ projector_type: mlp
538
+ recomputed_chunks: 1
539
+ s3_stream_chunk_size: 25
540
+ s3_stream_generate: false
541
+ s3_stream_n_timesteps: 10
542
+ s3_stream_prelook_size: 3
543
+ short_weight: 0.1
544
+ streaming: false
545
+ streaming_audio_chunk_size: 50
546
+ streaming_sliding_window: false
547
+ streaming_sliding_window_audio_frame_rate: 50
548
+ streaming_sliding_window_audio_init_text_length: 10
549
+ streaming_sliding_window_audio_window_size: 300
550
+ streaming_sliding_window_average_speed: 5
551
+ streaming_sliding_window_fast_speed: 7
552
+ streaming_sliding_window_max_text_len: 500
553
+ streaming_sliding_window_slow_speed: 3
554
+ streaming_sliding_window_text_window_size: 50
555
+ streaming_text_chunk_max: 7
556
+ streaming_text_chunk_min: 3
557
+ streaming_text_reserved_len: 300
558
+ text_eos_token_id: 151692
559
+ tts_filter_loss_fix: false
560
+ use_llm_hidden_state: false
561
+ use_text: true
562
+ window_size: 2
563
+ use_cache: true
564
+ use_image_id: true
565
+ use_sliding_window: false
566
+ vision_batch_size: 16
567
+ vision_config:
568
+ _attn_implementation_autoset: true
569
+ attention_dropout: 0.0
570
+ hidden_act: gelu_pytorch_tanh
571
+ hidden_size: 1152
572
+ image_size: 980
573
+ intermediate_size: 4304
574
+ layer_norm_eps: 1.0e-06
575
+ model_type: siglip_vision_model
576
+ num_attention_heads: 16
577
+ num_channels: 3
578
+ num_hidden_layers: 27
579
+ patch_size: 14
580
+ vocab_size: 151752
data/HEARTBEAT_Challenge/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1cb37a587a0d22ef84ecec21e3b6759abfa84f7a28b1b71b8d350409fc7e5f4f
3
+ size 6132
data/HEARTBEAT_Challenge/README_zh.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d43b8b715a6d627949175cedcf4b906496487192777ee669c94c61a48cf83c6
3
+ size 5726
data/HEARTBEAT_Challenge/fields/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f807a4ae8bc5a47f291ce7fd42ecfd648a98bbe9fef12d417f3c937e8073a4f4
3
+ size 14541
data/HEARTBEAT_Challenge/fields/README_zh.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d578d1d7763b74ab84cdcfb1836797fc309a16c4dfae8becb5ee67f9a0fac50
3
+ size 15101
examples/heartbeat_access.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Lossless HEARTBEAT records in Zarr v2, addressed by a ReferenceFS index.
2
+
3
+ Media stays in its original encoding. Row JSON uses schema-directed binary
4
+ references, so arbitrary user strings/objects cannot collide with the marker.
5
+ """
6
+ import base64
7
+ import hashlib
8
+ import json
9
+
10
+ import fsspec
11
+ import numpy as np
12
+ import pyarrow as pa
13
+ import zarr
14
+
15
+
16
+ def open_root(config_location, *, chunk_cache_bytes=128*1024*1024):
17
+ fs = fsspec.filesystem('reference', fo=config_location, skip_instance_cache=True)
18
+ if '.zgroup' not in fs.references:
19
+ raise ValueError('Missing Zarr root metadata')
20
+ for key in fs.references:
21
+ if key.endswith('/.zarray'):
22
+ md = json.loads(fs.cat_file(key))
23
+ if len(md['shape']) != 1 or len(md['chunks']) != 1:
24
+ raise ValueError('Expected one-dimensional dense arrays')
25
+ prefix = key[:-len('.zarray')]
26
+ for i in range((md['shape'][0] + md['chunks'][0] - 1)//md['chunks'][0]):
27
+ if prefix + str(i) not in fs.references:
28
+ raise ValueError('Missing dense chunk reference: ' + prefix + str(i))
29
+ store=fs.get_mapper('')
30
+ if chunk_cache_bytes:
31
+ # Adjacent samples frequently share a media block. Reuse compressed
32
+ # blocks instead of retransferring the same 16 MiB for each small clip.
33
+ store=zarr.LRUStoreCache(store,max_size=chunk_cache_bytes)
34
+ return zarr.open_group(store, mode='r', zarr_version=2), fs
35
+
36
+
37
+ def restore(value, dtype, group):
38
+ if value is None:
39
+ return None
40
+ if pa.types.is_binary(dtype) or pa.types.is_large_binary(dtype):
41
+ i = value['venus_blob_index']
42
+ start, end = map(int, group['media_offsets'][i:i+2])
43
+ return group['media_data'][start:end].tobytes()
44
+ if pa.types.is_struct(dtype):
45
+ return {f.name: restore(value[f.name], f.type, group) for f in dtype}
46
+ if pa.types.is_list(dtype) or pa.types.is_large_list(dtype):
47
+ return [restore(v, dtype.value_type, group) for v in value]
48
+ return value
49
+
50
+
51
+ def rows_from_shard(group, start=0, stop=None):
52
+ schema = pa.ipc.read_schema(pa.BufferReader(base64.b64decode(group.attrs['arrow_schema_base64'])))
53
+ n = group.attrs['num_rows']
54
+ for i in range(start, min(n, n if stop is None else stop)):
55
+ a, b = map(int, group['records_offsets'][i:i+2])
56
+ value = json.loads(group['records_data'][a:b].tobytes())
57
+ yield {f.name: restore(value[f.name], f.type, group) for f in schema}
58
+
59
+
60
+ def generate_rows(config_location, track, task, split, subset=None, max_rows=None, _index_identity=None):
61
+ if max_rows is not None and max_rows <= 0:
62
+ return
63
+ root, fs = open_root(config_location)
64
+ path = f'data/HEARTBEAT_Challenge/{track}/{task}/{split}'
65
+ if subset:
66
+ path += '/' + subset
67
+ group = root[path]
68
+ count = 0
69
+ for key in sorted(group.group_keys()):
70
+ for row in rows_from_shard(group[key]):
71
+ yield row
72
+ count += 1
73
+ if max_rows is not None and count >= max_rows:
74
+ return
75
+
76
+
77
+ def as_pandas(config_location, track, task, split, subset=None, max_rows=None):
78
+ import pandas as pd
79
+ return pd.DataFrame(generate_rows(config_location, track, task, split, subset, max_rows))
80
+
81
+
82
+ def as_datasets(config_location, track, task, split, subset=None, *, streaming=False,
83
+ cache_dir=None, max_rows=None):
84
+ from datasets import Dataset, IterableDataset, Features
85
+ root, fs = open_root(config_location)
86
+ group = root[f'data/HEARTBEAT_Challenge/{track}/{task}/{split}' + ('/'+subset if subset else '')]
87
+ first = group[sorted(group.group_keys())[0]]
88
+ schema = pa.ipc.read_schema(pa.BufferReader(base64.b64decode(first.attrs['arrow_schema_base64'])))
89
+ features = Features.from_arrow_schema(schema)
90
+ kwargs = dict(config_location=str(config_location), track=track, task=task,
91
+ split=split, subset=subset, max_rows=max_rows)
92
+ # In addition to immutable Hub revision paths, distinguish updated local
93
+ # reference indexes at the same filename without invalidating normal reuse.
94
+ kwargs['_index_identity'] = hashlib.sha256(json.dumps(
95
+ fs.references, sort_keys=True, separators=(',', ':')).encode()).hexdigest()
96
+ # Fixed commit URLs/local immutable indexes are part of generator identity.
97
+ if streaming:
98
+ return IterableDataset.from_generator(generate_rows, gen_kwargs=kwargs, features=features)
99
+ # Large original video blobs can overflow Arrow's 2 GiB binary-offset limit
100
+ # when accumulated into the default 1,000-record writer batch.
101
+ return Dataset.from_generator(generate_rows, gen_kwargs=kwargs, cache_dir=cache_dir,
102
+ features=features, writer_batch_size=1)
requirements-data.txt ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiohappyeyeballs==2.7.1
2
+ aiohttp==3.14.5
3
+ aiosignal==1.4.0
4
+ anyio==4.15.1
5
+ asciitree==0.3.3
6
+ attrs==26.1.0
7
+ certifi==2026.10.23
8
+ cffi==2.1.1
9
+ charset-normalizer==3.5.2
10
+ click==8.5.0
11
+ datasets==5.0.1
12
+ dill==0.4.1
13
+ fasteners==0.20
14
+ filelock==4.2.4
15
+ frozenlist==1.8.0
16
+ fsspec==2026.6.0
17
+ h11==0.16.0
18
+ hf-xet==1.7.0
19
+ httpcore==1.0.9
20
+ httpx==0.28.1
21
+ huggingface_hub==1.33.0
22
+ idna==3.20
23
+ multidict==7.1.0
24
+ multiprocess==0.70.19
25
+ numcodecs==0.13.1
26
+ numpy==1.26.4
27
+ packaging==26.3
28
+ pandas==2.3.3
29
+ propcache==0.5.4
30
+ pyarrow==25.0.1
31
+ pycparser==3.12
32
+ python-dateutil==3.0.0
33
+ pytz==2026.5
34
+ PyYAML==6.0.3
35
+ requests==2.34.2
36
+ six==1.17.0
37
+ soundfile==0.14.0
38
+ tqdm==4.70.1
39
+ typing_extensions==4.16.0
40
+ tzdata==2026.5
41
+ urllib3==2.8.0
42
+ xxhash==4.0.2
43
+ yarl==1.25.1
44
+ zarr==2.18.3