MCPcopy Index your code
hub / github.com/zai-org/CogView / __init__

Method __init__

data_utils/datasets.py:35–49  ·  view source on GitHub ↗
(self, path, process_fn)

Source from the content-addressed store, hash-verified

33
34class LMDBDataset(Dataset):
35 def __init__(self, path, process_fn):
36 self.env = lmdb.open(
37 path,
38 max_readers=32,
39 readonly=True,
40 lock=False,
41 readahead=False,
42 meminit=False,
43 )
44 self.process_fn = process_fn
45 if not self.env:
46 raise IOError('Cannot open lmdb dataset', path)
47
48 with self.env.begin(write=False) as txn:
49 self.length = int(txn.get('length'.encode('utf-8')).decode('utf-8'))
50
51 def __len__(self):
52 return self.length

Callers

nothing calls this directly

Calls 2

decodeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected