safetensors
https://github.com/huggingface/safetensorshuggingface/safetensors
This repository implements a new simple format for storing tensors safely (as opposed to pickle) and that is still fast (zero-copy).
通常のPyTorchモデルのチェックポイントファイル(通常は.ptまたは.ckpt、時には.bin)にはPythonのコードを含めることができ、基本的にあなたのPCに対して何でもできるようになります。
一方、SafeTensorsはデータ、つまり数字だけで、コードはありません。さらに、ロードの仕組みが改善されているので、理論的にはGPUへのロードが速くなるはずです。
https://www.reddit.com/r/StableDiffusion/comments/10cmfur/great_news_automatic1111_sd_webui_now_supports/
ckptにあるDreamBoothモデルを使うことのセキュリティリスクもなくなる
使うだけなら基本的にckptよりsafetensorsを使ったほうがいいのかな?基素.icon
YES!基素.icon
ほぼ完璧に上位互換ですねnomadoor.icon
safetensorsに追加学習はできないっぽい?
https://gyazo.com/257e23b0dc98c57e13da40bb5d31cb87
Flexibility: Can I save custom code in the format and be able to use it later with zero extra code ? (~ means we can store more than pure tensors, but no custom code)
https://github.com/huggingface/safetensors#yet-another-format-
https://economylife.net/safetensors-ckpt-difference/
.ckptは、pickleでserialize
関数だってピクル化できてしまう
もしもckptファイルが悪意をもって作成されていた場合、使用時に非ピクル化すると同時に任意コードが実行される
HuggingFaceはpickle内の実行コードを事前スキャンしてくれる
https://zenn.dev/platina/articles/e65c73cb01a900Safetensors のヘッダーを読む
safetensor