跳到主要内容Skip to main content

safetensorssafetensors

safetensors

  • 数据与检索Data & retrieval
  • 第五站 · 跑起来Station 5 · Running It
解决什么问题What problem it solves

一种更安全的模型权重文件格式。A safer file format for model weights.

这是什么What it is

官方描述:一种新的简单张量存储格式,安全(相对 pickle)且仍然快(零拷贝)。

官方指出 pickle 不安全、会执行任意代码;该格式支持懒加载。

The official description: a simple format for storing tensors safely (as opposed to pickle) that is still fast (zero-copy).

The docs state pickle is unsafe and runs arbitrary code; the format supports lazy loading.

为什么需要知道Why it matters

加载不可信权重,等于运行别人写的代码。先看格式。Loading untrusted weights is running someone else's code. Check the format first.

出处Sources
  • safetensors 官方仓库safetensors repository ↗