Runtime error: (my folder) file cannot be opened when extracting LoRA #1130
Unanswered
mienaiteki
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Latest Mac OSX.
Can anyone help solve this runtime error? I am attempting to extract a LoRA with Kohya_ss. The extraction goes well, and it completes a LoRA, but when it tries to save, it prints the runtime error: file can't be opened. I've tried running it with sudo and changing permissions, and I've tried a variety of folders and locations, and the problem seems to be with the script. Can anyone help?
/Users/(me)/kohya_ss/networks/extract_lora_from_models.py:189 in │
│ │
│ 186 parser = setup_parser() │
│ 187 │
│ 188 args = parser.parse_args() │
│ ❱ 189 svd(args) │
│ 190 │
│ │
│ /Users/(me)/kohya_ss/networks/extract_lora_from_models.py:161 in svd │
│ │
│ 158 # minimum metadata │
│ 159 metadata = {"ss_network_module": "networks.lora", "ss_network_dim": str(args.dim), "ss │
│ 160 │
│ ❱ 161 lora_network_save.save_weights(args.save_to, save_dtype, metadata) │
│ 162 print(f"LoRA weights are saved to: {args.save_to}") │
│ 163 │
│ 164 │
│ │
│ /Users/(me)/kohya_ss/networks/lora.py:1049 in save_weights │
│ │
│ 1046 │ │ │ │
│ 1047 │ │ │ save_file(state_dict, file, metadata) │
│ 1048 │ │ else: │
│ ❱ 1049 │ │ │ torch.save(state_dict, file) │
│ 1050 │ │
│ 1051 │ # mask is a tensor with values from 0 to 1 │
│ 1052 │ def set_region(self, sub_prompt_index, is_last_network, mask): │
│ │
│ /Users/(me)/kohya_ss/venv/lib/python3.10/site-packages/torch/serialization.py:440 in │
│ save │
│ │
│ 437 │ _check_save_filelike(f) │
│ 438 │ │
│ 439 │ if _use_new_zipfile_serialization: │
│ ❱ 440 │ │ with _open_zipfile_writer(f) as opened_zipfile: │
│ 441 │ │ │ _save(obj, opened_zipfile, pickle_module, pickle_protocol) │
│ 442 │ │ │ return │
│ 443 │ else: │
│ │
│ /Users/(me)/kohya_ss/venv/lib/python3.10/site-packages/torch/serialization.py:315 in │
│ _open_zipfile_writer │
│ │
│ 312 │ │ container = _open_zipfile_writer_file │
│ 313 │ else: │
│ 314 │ │ container = _open_zipfile_writer_buffer │
│ ❱ 315 │ return container(name_or_buffer) │
│ 316 │
│ 317 │
│ 318 def _is_compressed_file(f) -> bool: │
│ │
│ /Users/(me)kohya_ss/venv/lib/python3.10/site-packages/torch/serialization.py:288 in │
│ init │
│ │
│ 285 │
│ 286 class _open_zipfile_writer_file(_opener): │
│ 287 │ def init(self, name) -> None: │
│ ❱ 288 │ │ super().init(torch._C.PyTorchFileWriter(str(name))) │
│ 289 │ │
│ 290 │ def exit(self, *args) -> None: │
│ 291 │ │ self.file_like.write_end_of_file() │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: File /Users/(my path)/Lora_extract cannot be opened.
Beta Was this translation helpful? Give feedback.
All reactions