mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-05 19:12:41 +08:00
dynamic_vram: silence pytorch buffer warning (#12210)
This is log clutter and concerning to users. Its a false alarm.
This commit is contained in:
parent
794d05bdb1
commit
2b5da3b72e
@ -32,6 +32,7 @@ from comfy.cli_args import args, enables_dynamic_vram
|
|||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import mmap
|
import mmap
|
||||||
|
import warnings
|
||||||
|
|
||||||
MMAP_TORCH_FILES = args.mmap_torch_files
|
MMAP_TORCH_FILES = args.mmap_torch_files
|
||||||
DISABLE_MMAP = args.disable_mmap
|
DISABLE_MMAP = args.disable_mmap
|
||||||
@ -85,7 +86,10 @@ def load_safetensors(ckpt):
|
|||||||
header_size = struct.unpack("<Q", mapping[:8])[0]
|
header_size = struct.unpack("<Q", mapping[:8])[0]
|
||||||
header = json.loads(mapping[8:8+header_size].decode("utf-8"))
|
header = json.loads(mapping[8:8+header_size].decode("utf-8"))
|
||||||
|
|
||||||
data_area = torch.frombuffer(mapping, dtype=torch.uint8)[8 + header_size:]
|
with warnings.catch_warnings():
|
||||||
|
#We are working with read-only RAM by design
|
||||||
|
warnings.filterwarnings("ignore", message="The given buffer is not writable")
|
||||||
|
data_area = torch.frombuffer(mapping, dtype=torch.uint8)[8 + header_size:]
|
||||||
|
|
||||||
sd = {}
|
sd = {}
|
||||||
for name, info in header.items():
|
for name, info in header.items():
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user