Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
f3144eb0
Commit
f3144eb0
authored
Oct 18, 2016
by
蠍ヤ缘
Committed by
GitHub
Oct 18, 2016
Browse files
Add sys.stdout.flush()
parent
1fc268ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
swivel/swivel.py
swivel/swivel.py
+6
-0
No files found.
swivel/swivel.py
View file @
f3144eb0
...
@@ -164,6 +164,7 @@ def write_embeddings_to_disk(config, model, sess):
...
@@ -164,6 +164,7 @@ def write_embeddings_to_disk(config, model, sess):
row_vocab_path
=
config
.
input_base_path
+
'/row_vocab.txt'
row_vocab_path
=
config
.
input_base_path
+
'/row_vocab.txt'
row_embedding_output_path
=
config
.
output_base_path
+
'/row_embedding.tsv'
row_embedding_output_path
=
config
.
output_base_path
+
'/row_embedding.tsv'
print
'Writing row embeddings to:'
,
row_embedding_output_path
print
'Writing row embeddings to:'
,
row_embedding_output_path
sys
.
stdout
.
flush
()
write_embedding_tensor_to_disk
(
row_vocab_path
,
row_embedding_output_path
,
write_embedding_tensor_to_disk
(
row_vocab_path
,
row_embedding_output_path
,
sess
,
model
.
row_embedding
)
sess
,
model
.
row_embedding
)
...
@@ -171,6 +172,7 @@ def write_embeddings_to_disk(config, model, sess):
...
@@ -171,6 +172,7 @@ def write_embeddings_to_disk(config, model, sess):
col_vocab_path
=
config
.
input_base_path
+
'/col_vocab.txt'
col_vocab_path
=
config
.
input_base_path
+
'/col_vocab.txt'
col_embedding_output_path
=
config
.
output_base_path
+
'/col_embedding.tsv'
col_embedding_output_path
=
config
.
output_base_path
+
'/col_embedding.tsv'
print
'Writing column embeddings to:'
,
col_embedding_output_path
print
'Writing column embeddings to:'
,
col_embedding_output_path
sys
.
stdout
.
flush
()
write_embedding_tensor_to_disk
(
col_vocab_path
,
col_embedding_output_path
,
write_embedding_tensor_to_disk
(
col_vocab_path
,
col_embedding_output_path
,
sess
,
model
.
col_embedding
)
sess
,
model
.
col_embedding
)
...
@@ -184,6 +186,7 @@ class SwivelModel(object):
...
@@ -184,6 +186,7 @@ class SwivelModel(object):
# Create paths to input data files
# Create paths to input data files
print
'Reading model from:'
,
config
.
input_base_path
print
'Reading model from:'
,
config
.
input_base_path
sys
.
stdout
.
flush
()
count_matrix_files
=
glob
.
glob
(
config
.
input_base_path
+
'/shard-*.pb'
)
count_matrix_files
=
glob
.
glob
(
config
.
input_base_path
+
'/shard-*.pb'
)
row_sums_path
=
config
.
input_base_path
+
'/row_sums.txt'
row_sums_path
=
config
.
input_base_path
+
'/row_sums.txt'
col_sums_path
=
config
.
input_base_path
+
'/col_sums.txt'
col_sums_path
=
config
.
input_base_path
+
'/col_sums.txt'
...
@@ -196,9 +199,11 @@ class SwivelModel(object):
...
@@ -196,9 +199,11 @@ class SwivelModel(object):
self
.
n_cols
=
len
(
col_sums
)
self
.
n_cols
=
len
(
col_sums
)
print
'Matrix dim: (%d,%d) SubMatrix dim: (%d,%d) '
%
(
print
'Matrix dim: (%d,%d) SubMatrix dim: (%d,%d) '
%
(
self
.
n_rows
,
self
.
n_cols
,
config
.
submatrix_rows
,
config
.
submatrix_cols
)
self
.
n_rows
,
self
.
n_cols
,
config
.
submatrix_rows
,
config
.
submatrix_cols
)
sys
.
stdout
.
flush
()
self
.
n_submatrices
=
(
self
.
n_rows
*
self
.
n_cols
/
self
.
n_submatrices
=
(
self
.
n_rows
*
self
.
n_cols
/
(
config
.
submatrix_rows
*
config
.
submatrix_cols
))
(
config
.
submatrix_rows
*
config
.
submatrix_cols
))
print
'n_submatrices: %d'
%
(
self
.
n_submatrices
)
print
'n_submatrices: %d'
%
(
self
.
n_submatrices
)
sys
.
stdout
.
flush
()
# ===== CREATE VARIABLES ======
# ===== CREATE VARIABLES ======
...
@@ -320,6 +325,7 @@ def main(_):
...
@@ -320,6 +325,7 @@ def main(_):
global_step
,
n_submatrices_to_train
,
global_step
,
n_submatrices_to_train
,
100.0
*
global_step
/
n_submatrices_to_train
,
100.0
*
global_step
/
n_submatrices_to_train
,
n_steps_between_status_updates
/
elapsed
)
n_steps_between_status_updates
/
elapsed
)
sys
.
stdout
.
flush
()
t0
[
0
]
=
time
.
time
()
t0
[
0
]
=
time
.
time
()
# Start training threads
# Start training threads
...
...
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