pick_up_socks_dataset_act / .debug /fix_converting.py
llinguini's picture
Upload folder using huggingface_hub
d84a12f verified
import json
import numpy as np
import copy
# Load stats file
stats_file = "../meta/stats.json"
with open(stats_file, 'r') as f:
stats = json.load(f)
print("Fixing stats.json file...")
# Create a deep copy to modify
fixed_stats = copy.deepcopy(stats)
# Fix all None std values
for key in fixed_stats:
if "std" in fixed_stats[key] and fixed_stats[key]["std"] is None:
# Use matching shape from mean if possible
if "mean" in fixed_stats[key]:
mean = fixed_stats[key]["mean"]
if isinstance(mean, list):
# Create a ones array with same shape as mean
fixed_stats[key]["std"] = [1.0] * len(mean)
else:
# Fallback to scalar
fixed_stats[key]["std"] = [1.0]
else:
# No mean to reference, use default
fixed_stats[key]["std"] = [1.0]
print(f"Fixed {key}.std: None → {fixed_stats[key]['std']}")
# Save the fixed stats file
output_file = "../meta/stats_fixed.json"
with open(output_file, 'w') as f:
json.dump(fixed_stats, f, indent=2)
print(f"\nFIXED! New stats file saved to: {output_file}")
print("\nTo use this fixed file:")
print("1. Rename the original file as a backup: mv ../meta/stats.json ../meta/stats.json.bak")
print("2. Replace with fixed version: mv ../meta/stats_fixed.json ../meta/stats.json")