Spaces:
Runtime error
Runtime error
Update demo.py
Browse files
demo.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
|
2 |
import json
|
3 |
-
|
4 |
import werkzeug
|
5 |
import tensorflow as tf
|
6 |
|
@@ -13,8 +13,32 @@ import warnings
|
|
13 |
|
14 |
def predict(image, question):
|
15 |
parseArgs()
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
config.expName = 'PDF_exp_extra'
|
|
|
|
|
18 |
with open(config.configFile(), "a+") as outFile:
|
19 |
json.dump(vars(config), outFile)
|
20 |
|
@@ -41,8 +65,10 @@ def predict(image, question):
|
|
41 |
with tf.Session(config=sessionConfig) as sess:
|
42 |
sess.graph.finalize()
|
43 |
|
44 |
-
epoch =
|
45 |
-
|
|
|
|
|
46 |
|
47 |
evalRes = model.runBatch(sess, data['data'], data['image'], False)
|
48 |
answer = None
|
|
|
1 |
|
2 |
import json
|
3 |
+
import os
|
4 |
import werkzeug
|
5 |
import tensorflow as tf
|
6 |
|
|
|
13 |
|
14 |
def predict(image, question):
|
15 |
parseArgs()
|
16 |
+
config.parallel = True
|
17 |
+
config.evalTrain = True
|
18 |
+
config.retainVal = True
|
19 |
+
config.useEMA = True
|
20 |
+
config.lrReduce = True
|
21 |
+
config.adam = True
|
22 |
+
config.clip = True
|
23 |
+
config.memoryVariationalDropout = True
|
24 |
+
config.relu='ELU'
|
25 |
+
config.encBi = True
|
26 |
+
config.wrdEmbRandom = True
|
27 |
+
config.wrdEmbUniform = True
|
28 |
+
config.outQuestion = True
|
29 |
+
config.initCtrl='Q'
|
30 |
+
config.controlContextual = True
|
31 |
+
config.controlInputUnshared = True
|
32 |
+
config.readProjInputs = True
|
33 |
+
config.readMemConcatKB = True
|
34 |
+
config.readMemConcatProj = True
|
35 |
+
config.readMemProj = True
|
36 |
+
config.readCtrl = True
|
37 |
+
config.writeMemProj = True
|
38 |
+
config.restore = True
|
39 |
config.expName = 'PDF_exp_extra'
|
40 |
+
config.netLength = 16
|
41 |
+
configPDF()
|
42 |
with open(config.configFile(), "a+") as outFile:
|
43 |
json.dump(vars(config), outFile)
|
44 |
|
|
|
65 |
with tf.Session(config=sessionConfig) as sess:
|
66 |
sess.graph.finalize()
|
67 |
|
68 |
+
# epoch = loadWeights(sess, saver, init)
|
69 |
+
print('###############', config.weightsFile(25))
|
70 |
+
os.system('ls -l ./weights/PDF_exp_extra')
|
71 |
+
emaSaver.restore(sess, config.weightsFile(25))
|
72 |
|
73 |
evalRes = model.runBatch(sess, data['data'], data['image'], False)
|
74 |
answer = None
|