Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: Unable to load weights from pytorch checkpoint file. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True. #67

Open
caojiehui opened this issue Jan 31, 2024 · 0 comments

Comments

@caojiehui
Copy link

raceback (most recent call last):
File "/home/yingjie/miniconda3/envs/dpose/lib/python3.9/site-packages/transformers/modeling_utils.py", line 442, in load_state_dict
return torch.load(checkpoint_file, map_location="cpu")
File "/home/yingjie/miniconda3/envs/dpose/lib/python3.9/site-packages/torch/serialization.py", line 797, in load
with _open_zipfile_reader(opened_file) as opened_zipfile:
File "/home/yingjie/miniconda3/envs/dpose/lib/python3.9/site-packages/torch/serialization.py", line 283, in init
super().init(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/yingjie/miniconda3/envs/dpose/lib/python3.9/site-packages/transformers/modeling_utils.py", line 446, in load_state_dict
if f.read(7) == "version":
File "/home/yingjie/miniconda3/envs/dpose/lib/python3.9/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/yingjie/DreamPose/test.py", line 62, in
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model_id, unet=unet, torch_dtype=torch.float16, revision="fp16") #
File "/home/yingjie/miniconda3/envs/dpose/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/home/yingjie/miniconda3/envs/dpose/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py", line 1271, in from_pretrained
loaded_sub_model = load_sub_model(
File "/home/yingjie/miniconda3/envs/dpose/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py", line 525, in load_sub_model
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
File "/home/yingjie/miniconda3/envs/dpose/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2560, in from_pretrained
state_dict = load_state_dict(resolved_archive_file)
File "/home/yingjie/miniconda3/envs/dpose/lib/python3.9/site-packages/transformers/modeling_utils.py", line 458, in load_state_dict
raise OSError(
OSError: Unable to load weights from pytorch checkpoint file for '/data3/chc/DreamPose/demo/custom-chkpts/checkpoint-499/safety_checker/pytorch_model.bin' at '/data3/chc/DreamPose/demo/custom-chkpts/checkpoint-499/safety_checker/pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

@caojiehui caojiehui changed the title OSError: Unable to load weights from pytorch checkpoint file for '/data3/chc/DreamPose/demo/custom-chkpts/checkpoint-499/safety_checker/pytorch_model.bin' at '/data3/chc/DreamPose/demo/custom-chkpts/checkpoint-499/safety_checker/pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True. OSError: Unable to load weights from pytorch checkpoint file. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True. Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant