Commit ·
9914508
1
Parent(s): ee1f8d1
Update README.md
Browse files
README.md
CHANGED
|
@@ -26,11 +26,7 @@ sys.path.insert(0, "bert_experimental")
|
|
| 26 |
from bert_experimental.finetuning.text_preprocessing import build_preprocessor
|
| 27 |
from bert_experimental.finetuning.graph_ops import load_graph
|
| 28 |
|
| 29 |
-
|
| 30 |
df = pd.read_csv("test.tsv", sep='\t')
|
| 31 |
-
# visual information image caption
|
| 32 |
-
# standard poodle shopping cart footwear a close up of a dog laying in a basket
|
| 33 |
-
|
| 34 |
|
| 35 |
texts = []
|
| 36 |
delimiter = " ||| "
|
|
@@ -38,12 +34,10 @@ delimiter = " ||| "
|
|
| 38 |
for vis, cap in zip(df.visual.tolist(), df.caption.tolist()):
|
| 39 |
texts.append(delimiter.join((str(vis), str(cap))))
|
| 40 |
|
| 41 |
-
|
| 42 |
texts = np.array(texts)
|
| 43 |
|
| 44 |
trX, tsX = train_test_split(texts, shuffle=False, test_size=0.01)
|
| 45 |
|
| 46 |
-
|
| 47 |
restored_graph = load_graph("frozen_graph.pb")
|
| 48 |
|
| 49 |
graph_ops = restored_graph.get_operations()
|
|
@@ -59,16 +53,14 @@ py_func = tf.numpy_function(preprocessor, [x], [tf.int32, tf.int32, tf.int32], n
|
|
| 59 |
py_func = tf.numpy_function(preprocessor, [x], [tf.int32, tf.int32, tf.int32])
|
| 60 |
|
| 61 |
##predictions
|
| 62 |
-
|
| 63 |
sess = tf.Session(graph=restored_graph)
|
| 64 |
|
| 65 |
print(trX[:4])
|
| 66 |
|
| 67 |
y = tf.print(y, summarize=-1)
|
| 68 |
-
#x = tf.print(x, summarize=-1)
|
| 69 |
y_out = sess.run(y, feed_dict={
|
| 70 |
x: trX[:4].reshape((-1,1))
|
| 71 |
-
|
| 72 |
})
|
| 73 |
|
| 74 |
|
|
|
|
| 26 |
from bert_experimental.finetuning.text_preprocessing import build_preprocessor
|
| 27 |
from bert_experimental.finetuning.graph_ops import load_graph
|
| 28 |
|
|
|
|
| 29 |
df = pd.read_csv("test.tsv", sep='\t')
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
texts = []
|
| 32 |
delimiter = " ||| "
|
|
|
|
| 34 |
for vis, cap in zip(df.visual.tolist(), df.caption.tolist()):
|
| 35 |
texts.append(delimiter.join((str(vis), str(cap))))
|
| 36 |
|
|
|
|
| 37 |
texts = np.array(texts)
|
| 38 |
|
| 39 |
trX, tsX = train_test_split(texts, shuffle=False, test_size=0.01)
|
| 40 |
|
|
|
|
| 41 |
restored_graph = load_graph("frozen_graph.pb")
|
| 42 |
|
| 43 |
graph_ops = restored_graph.get_operations()
|
|
|
|
| 53 |
py_func = tf.numpy_function(preprocessor, [x], [tf.int32, tf.int32, tf.int32])
|
| 54 |
|
| 55 |
##predictions
|
|
|
|
| 56 |
sess = tf.Session(graph=restored_graph)
|
| 57 |
|
| 58 |
print(trX[:4])
|
| 59 |
|
| 60 |
y = tf.print(y, summarize=-1)
|
|
|
|
| 61 |
y_out = sess.run(y, feed_dict={
|
| 62 |
x: trX[:4].reshape((-1,1))
|
| 63 |
+
|
| 64 |
})
|
| 65 |
|
| 66 |
|