Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
8cdc6efd
Commit
8cdc6efd
authored
Jul 11, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lmdb __keys__
parent
0a0101d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
tensorpack/callbacks/common.py
tensorpack/callbacks/common.py
+2
-2
tensorpack/dataflow/format.py
tensorpack/dataflow/format.py
+12
-3
No files found.
tensorpack/callbacks/common.py
View file @
8cdc6efd
...
...
@@ -68,10 +68,10 @@ class ModelSaver(Callback):
linkname
=
os
.
path
.
join
(
os
.
path
.
dirname
(
latest
),
'latest'
)
try
:
os
.
unlink
(
linkname
)
except
FileNotFound
Error
:
except
OS
Error
:
pass
os
.
symlink
(
basename
,
linkname
)
except
Exception
:
# disk error sometimes.. just ignore
except
OSError
,
IOError
:
# disk error sometimes.. just ignore it
logger
.
exception
(
"Exception in ModelSaver.trigger_epoch!"
)
class
MinSaver
(
Callback
):
...
...
tensorpack/dataflow/format.py
View file @
8cdc6efd
...
...
@@ -8,6 +8,7 @@ from ..utils.loadcaffe import get_caffe_pb
from
.base
import
DataFlow
import
random
from
tqdm
import
tqdm
from
six.moves
import
range
try
:
...
...
@@ -69,8 +70,15 @@ class LMDBData(DataFlow):
self
.
rng
=
get_rng
(
self
)
self
.
_size
=
self
.
_txn
.
stat
()[
'entries'
]
if
shuffle
:
with
timed_operation
(
"Loading LMDB keys ..."
,
log_start
=
True
):
self
.
keys
=
[
k
for
k
,
_
in
self
.
_txn
.
cursor
()]
self
.
keys
=
self
.
_txn
.
get
(
'__keys__'
)
if
not
self
.
keys
:
self
.
keys
=
[]
with
timed_operation
(
"Loading LMDB keys ..."
,
log_start
=
True
),
\
tqdm
(
total
=
self
.
_size
,
ascii
=
True
)
as
pbar
:
for
k
in
self
.
_txn
.
cursor
():
if
k
!=
'__keys__'
:
self
.
keys
.
append
(
k
)
pbar
.
update
()
def
reset_state
(
self
):
self
.
_txn
=
self
.
_lmdb
.
begin
()
...
...
@@ -84,7 +92,8 @@ class LMDBData(DataFlow):
c
=
self
.
_txn
.
cursor
()
while
c
.
next
():
k
,
v
=
c
.
item
()
yield
[
k
,
v
]
if
k
!=
'__keys__'
:
yield
[
k
,
v
]
else
:
s
=
self
.
size
()
for
i
in
range
(
s
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment