提交 a2702e5f 编写于 作者: D daming-lu

test on cluster

上级 d4414cbb
......@@ -14,6 +14,10 @@
from __future__ import print_function
import time
start = time.time()
import os
import paddle
import paddle.fluid as fluid
......@@ -133,8 +137,16 @@ def infer(use_cuda, inference_program, params_dirname=None):
# Note that lod info should be a list of lists.
reviews_str = [
'read the book forget the movie', 'this is a great movie',
'this is very bad'
'read the book forget the movie',
'this is a great movie',
'this is very bad',
'the movie makes me sick',
'you can never find a worse movie',
'what a masterpiece',
'it deserves any compliment',
'no movie this year could be better than this one',
'i would rather die',
'the movie should be burned in hell'
]
reviews = [c.split() for c in reviews_str]
......@@ -157,10 +169,16 @@ def main(use_cuda):
if use_cuda and not fluid.core.is_compiled_with_cuda():
return
params_dirname = "understand_sentiment_conv.inference.model"
import pdb;pdb.set_trace()
train(use_cuda, train_program, params_dirname)
infer(use_cuda, inference_program, params_dirname)
finish = time.time()
elapsed = finish - start
print(elapsed)
if __name__ == '__main__':
use_cuda = False # set to True if training with GPU
main(use_cuda)
......@@ -14,6 +14,9 @@
from __future__ import print_function
import time
start = time.time()
import os
import paddle
import paddle.fluid as fluid
......@@ -123,7 +126,7 @@ def train(use_cuda, train_program, params_dirname):
trainer.save_params(params_dirname)
trainer.train(
num_epochs=1,
num_epochs=2,
event_handler=event_handler,
reader=train_reader,
feed_order=feed_order)
......@@ -150,8 +153,16 @@ def infer(use_cuda, inference_program, params_dirname=None):
# Note that lod info should be a list of lists.
reviews_str = [
'read the book forget the movie', 'this is a great movie',
'this is very bad'
'read the book forget the movie',
'this is a great movie',
'this is very bad',
'the movie makes me sick',
'you can never find a worse movie',
'what a masterpiece',
'it deserves any compliment',
'no movie this year could be better than this one',
'i would rather die',
'the movie should be burned in hell'
]
reviews = [c.split() for c in reviews_str]
......@@ -177,6 +188,9 @@ def main(use_cuda):
train(use_cuda, train_program, params_dirname)
infer(use_cuda, inference_program, params_dirname)
finish = time.time()
elapsed = finish - start
print(elapsed)
if __name__ == '__main__':
use_cuda = False # set to True if training with GPU
......
......@@ -14,6 +14,9 @@
from __future__ import print_function
import time
start = time.time()
import os
import paddle
import paddle.fluid as fluid
......@@ -114,7 +117,7 @@ def train(use_cuda, train_program, params_dirname):
trainer.save_params(params_dirname)
trainer.train(
num_epochs=1,
num_epochs=4,
event_handler=event_handler,
reader=train_reader,
feed_order=feed_order)
......@@ -141,8 +144,16 @@ def infer(use_cuda, inference_program, params_dirname=None):
# Note that lod info should be a list of lists.
reviews_str = [
'read the book forget the movie', 'this is a great movie',
'this is very bad'
'read the book forget the movie',
'this is a great movie',
'this is very bad',
'the movie makes me sick',
'you can never find a worse movie',
'what a masterpiece',
'it deserves any compliment',
'no movie this year could be better than this one',
'i would rather die',
'the movie should be burned in hell'
]
reviews = [c.split() for c in reviews_str]
......@@ -168,6 +179,9 @@ def main(use_cuda):
train(use_cuda, train_program, params_dirname)
infer(use_cuda, inference_program, params_dirname)
finish = time.time()
elapsed = finish - start
print(elapsed)
if __name__ == '__main__':
use_cuda = False # set to True if training with GPU
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册