# from_pretrained 未回填路径导致归一化为空

> 原文链接：https://robotics.hellobike.com/pitfalls/2026-10-12-lerobot-4647
> 频道：pitfalls | 更新日期：2026-10-12 | 标签：auto, github-issue, lerobot
> 核心摘要：程序化加载策略时 pretrained_path=None 会跳过归一化统计；手动回填路径或用 dataset_stats 重建处理器可恢复。

# from_pretrained 未回填路径导致归一化为空

::: v-pre
> 本文由 AI 根据公开内容整理，可能有误，请以原文为准：[PreTrainedConfig.from_pretrained() leaves pretrained_path=None → silently builds untrained processor pipeline (blind policy)](https://github.com/huggingface/lerobot/issues/4647)（GitHub huggingface/lerobot #4647）

**状态**：有绕过办法

## 问题

`PreTrainedConfig.from_pretrained(path)` 返回的配置中 `pretrained_path` 为 `None`，`make_pre_post_processors` 未加载 safetensors 统计，构建出空归一化流水线；策略无报错但推理近似随机，PushT 奖励接近 0。

## 环境

LeRobot；`lerobot/diffusion_pusht` 与 PushT；另有 0.4.4、ACT/Diffusion Policy、自定义 MuJoCo state-only 数据集；main 0.6.x 提到。

## 解决办法

1. 在 `from_pretrained` 后手动设置 `cfg.pretrained_path = "路径"`，再调用 `make_pre_post_processors(policy_cfg=cfg, pretrained_path=cfg.pretrained_path)`。
2. 或在推理时用数据集统计重建处理器：调用 `make_pre_post_processors(policy_cfg=policy.config, dataset_stats=ds.meta.stats)`。
3. 原文提到修复 PR `#4648` 会让程序化路径自动加载相邻的 stats safetensors。

讨论原作者：@DanMo661 等，版权归原作者所有。
:::

## 原始参考来源 (Sources)

- [GitHub huggingface/lerobot #4647：PreTrainedConfig.from_pretrained() leaves pretrained_path=None → silently builds untrained processor pipeline (blind policy)](https://github.com/huggingface/lerobot/issues/4647)