DecisionRobust / scripts /io_utils.py
yflantmy's picture
Release five curated DecisionRobust configurations v1.0.0 (part 3)
08480b0 verified
Raw History Blame Contribute Delete
318 Bytes
import json
FIELDS = ('id','original_id','source','scenario','clean','adv','gt','task','attack')
JSON_FIELDS = ('clean','adv','gt','task')
def decode_record(row):
"""Recover the nine-field native record from a Hugging Face row."""
return {k: json.loads(row[k]) if k in JSON_FIELDS else row[k] for k in FIELDS}