From 566b25adc9282e6e79711224da7d639bc2fd107a Mon Sep 17 00:00:00 2001 From: manjunathshiva Date: Mon, 20 Jul 2026 09:55:12 +0530 Subject: [PATCH] Add safetensors to the pytorch extra pip install tabfm[pytorch] cannot load the released checkpoint: tabfm_v1_0_0.load() fails with NameError: name 'safetensors' is not defined inside huggingface_hub's _load_as_safetensor. huggingface_hub declares safetensors optional and imports it lazily, but the PyTorch loader always goes through PyTorchModelHubMixin -> model.safetensors (since 1.0.1 dropped pytorch_model.bin), so safetensors is a hard runtime dependency of the pytorch extra. Torch does not pull it in transitively. Adds it to the pytorch extra and to the pinned requirements.txt lock. The JAX path is unaffected (weights restore via orbax). --- pyproject.toml | 4 ++++ requirements.txt | 2 ++ 2 files changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 784274d..b1fd7de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,10 @@ jax = [ "orbax-checkpoint", ] pytorch = [ + # safetensors is required to load the Hugging Face checkpoint + # (model.safetensors via PyTorchModelHubMixin); huggingface_hub treats it + # as optional and fails with a NameError at load() time without it. + "safetensors", "torch", ] diff --git a/requirements.txt b/requirements.txt index 9a5e4e4..6068f94 100644 --- a/requirements.txt +++ b/requirements.txt @@ -151,6 +151,8 @@ rich==13.7.1 # via # flax # typer +safetensors==0.8.0 + # via tabfm (pyproject.toml) scikit-learn==1.6.0 # via tabfm (pyproject.toml) scipy==1.17.1