missing model.safetensors when loading pretrained weights
Hi EPFL-VILAB,
I had cloned this repository to my NAS storage with the hope of loading pre-trained model weights from disk. I am running into the issue where the repo does not contain model.safetensor files, but the method call .from_pretrained is looking for this file.
My current file structure looks like this:
/mnt/cloudNAS3/jo/cache/
-4M_tokenizers_rgb_16k_224-448
-config.json
-LICENSE
-pytorch_model.bin
-README.md
-4M_tokenizers_depth_8k_224-448
- ...
- 4M_tokenizers_CLIP-B16_8k_224-448
Am I doing something blatantly wrong? I have tried the suggested method of loading pretrained weights via HF API call, but quickly ran out of disk space on my local machine. Any advice would be greatly appreciated. Please also let me know if there are any logs that might assist in the debugging process.
Hi @wang3450 ,
Have you tried setting the local_files_only
flag to True
? See the documentation.
This HF Hub model is only really intended to be loaded via the HF API. The safetensors weights are hosted in a different repository, see here: https://huggingface.co/EPFL-VILAB/4M/blob/main/4M_tokenizers_rgb_16k_224-448.safetensors
Once you downloaded them, you can load them as:
from fourm.utils import load_safetensors
from fourm.vq.vqvae import DiVAE
ckpt, config = load_safetensors('/path/to/checkpoint.safetensors')
tok = DiVAE(config=config)
tok.load_state_dict(ckpt)
See the README of the official repo for more information: https://github.com/apple/ml-4m
Best, Roman