Commit 9bbfa1c3 authored by soumith's avatar soumith
Browse files

even more lsun perf fixes

parent 261483fb
...@@ -14,7 +14,8 @@ class LSUNClass(data.Dataset): ...@@ -14,7 +14,8 @@ class LSUNClass(data.Dataset):
def __init__(self, db_path, transform=None, target_transform=None): def __init__(self, db_path, transform=None, target_transform=None):
import lmdb import lmdb
self.db_path = db_path self.db_path = db_path
self.env = lmdb.open(db_path, max_readers=1, readonly=True, lock=False) self.env = lmdb.open(db_path, max_readers=1, readonly=True, lock=False,
readahead=False, meminit=False)
with self.env.begin(write=False) as txn: with self.env.begin(write=False) as txn:
self.length = txn.stat()['entries'] self.length = txn.stat()['entries']
cache_file = '_cache_' + db_path.replace('/', '_') cache_file = '_cache_' + db_path.replace('/', '_')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment