diff --git a/tinygrad/runtime/ops_disk.py b/tinygrad/runtime/ops_disk.py index ba9590436c933..0a01e22a08e5e 100644 --- a/tinygrad/runtime/ops_disk.py +++ b/tinygrad/runtime/ops_disk.py @@ -67,7 +67,7 @@ def __init__(self, device:DiskDevice, size:int, offset=0): self.device, self.size, self.offset = device, size, offset def __repr__(self): return f"" def _buf(self) -> memoryview: - assert self.device.mem is not None, "DiskBuffer wasn't opened" + assert hasattr(self.device, "mem"), "DiskBuffer wasn't opened" return memoryview(self.device.mem)[self.offset:self.offset+self.size] MAP_LOCKED, MAP_POPULATE = 0 if OSX else 0x2000, getattr(mmap, "MAP_POPULATE", 0 if OSX else 0x008000)