forked from tangger/lerobot
fix issue with saving freshly computed stats
This commit is contained in:
@@ -62,7 +62,7 @@ def make_dataset(
|
|||||||
stats = torch.load(precomputed_stats_path)
|
stats = torch.load(precomputed_stats_path)
|
||||||
else:
|
else:
|
||||||
logging.info(f"compute_stats and save to {precomputed_stats_path}")
|
logging.info(f"compute_stats and save to {precomputed_stats_path}")
|
||||||
# instantiate a one frame dataset with light transform
|
# Create a dataset for stats computation.
|
||||||
stats_dataset = clsfunc(
|
stats_dataset = clsfunc(
|
||||||
dataset_id=cfg.dataset_id,
|
dataset_id=cfg.dataset_id,
|
||||||
split="train",
|
split="train",
|
||||||
@@ -70,7 +70,8 @@ def make_dataset(
|
|||||||
transform=Prod(in_keys=clsfunc.image_keys, prod=1 / 255.0),
|
transform=Prod(in_keys=clsfunc.image_keys, prod=1 / 255.0),
|
||||||
)
|
)
|
||||||
stats = compute_stats(stats_dataset)
|
stats = compute_stats(stats_dataset)
|
||||||
torch.save(stats, stats_path)
|
os.makedirs(precomputed_stats_path.parent, exist_ok=True)
|
||||||
|
torch.save(stats, precomputed_stats_path)
|
||||||
else:
|
else:
|
||||||
stats = torch.load(stats_path)
|
stats = torch.load(stats_path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user