Skip to content

Commit

Permalink
version 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardCuiPeacock committed Apr 13, 2021
1 parent 00b178d commit 2580673
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions models/node2vec/node2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,12 @@ def parse_tensor_f(x):
data_uri_list = []
num_rows_saved = 0
for k, s in enumerate(tqdm(raw_data)):
tnow = time.time()
# generate skipgram
features = _make_skipgrams(s)
num_rows_saved += features.shape[0]

data_uri = os.path.join(save_path, f"skipgrams_{k:05}.tfrecord")
data_uri_list.append(data_uri)
t1 = time.time() - tnow
# Write to tfrecord with proper format
# tensors2tfrecord(
# data_uri,
Expand All @@ -488,10 +486,7 @@ def parse_tensor_f(x):
ds = tf.data.Dataset.from_tensor_slices(features).map(tf.io.serialize_tensor)
writer = tf.data.experimental.TFRecordWriter(data_uri)
writer.write(ds)

t2 = time.time() - tnow - t1
logging.info(f"Making skipgrams batch {k}: generation time: {t1} s, save time: {t2} s")


return data_uri_list, num_rows_saved


Expand Down

0 comments on commit 2580673

Please sign in to comment.