in src/chug/hfds/collate.py [0:0]
def flatten_bytes(data):
for sample in data:
to_replace = {k for k, v in sample.items() if isinstance(v, dict) and 'bytes' in v}
if to_replace:
result = {k: v for k, v in sample.items() if k not in to_replace}
result.update({k: sample[k]['bytes'] for k in to_replace})
yield result
else:
yield sample