StreamingOmniDatasets / examples /stream_remote_dataset.py
skyzhou06's picture
v0.3 quality hardening: SFT-ready schema, portable media manifests, and seven-config parquet release
64ac96d verified
Raw
History Blame Contribute Delete
927 Bytes
#!/usr/bin/env python3
"""Example: Stream samples from a remote HF dataset."""
from datasets import load_dataset
REPO = "skyzhou06/StreamingOmniDatasets"
CONFIG = "LiveAVCommentary"
print(f"Streaming {REPO}/{CONFIG} train split...")
try:
ds = load_dataset(REPO, CONFIG, split="train", streaming=True)
for i, sample in enumerate(ds.take(3)):
print(f"\n--- Sample {i+1} ---")
print(f" id: {sample.get('id')}")
print(f" dataset: {sample.get('dataset')}")
timeline = sample.get("timeline", [])
print(f" timeline chunks: {len(timeline)}")
if timeline:
controls = [t.get("control") for t in timeline[:5]]
print(f" first 5 controls: {controls}")
except Exception as e:
print(f"\nConfig-based loading failed: {e}")
print("\nTry loading with parquet fallback:")
print(" See examples/load_streaming_omni_dataset.py for fallback example")