Skip to content

Commit 0d10514

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into fix_warpctc_op
2 parents cf3b3d6 + 7205d33 commit 0d10514

File tree

501 files changed

+8400
-3317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

501 files changed

+8400
-3317
lines changed

.copyright.hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import subprocess
99
import platform
1010

1111
COPYRIGHT = '''
12-
Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
12+
Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
1313

1414
Licensed under the Apache License, Version 2.0 (the "License");
1515
you may not use this file except in compliance with the License.

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ message(STATUS "CXX compiler: ${CMAKE_CXX_COMPILER}, version: "
2525
message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: "
2626
"${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
2727

28-
find_package(Sphinx)
2928
if(NOT CMAKE_CROSSCOMPILING)
3029
find_package(CUDA QUIET)
3130
endif(NOT CMAKE_CROSSCOMPILING)
@@ -226,5 +225,7 @@ if(WITH_PYTHON)
226225
endif()
227226

228227
if(WITH_DOC)
228+
find_package(Sphinx REQUIRED)
229+
find_python_module(recommonmark REQUIRED)
229230
add_subdirectory(doc)
230231
endif()

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ RUN localedef -i en_US -f UTF-8 en_US.UTF-8
7070
# specify sphinx version as 1.5.6 and remove -U option for [pip install -U
7171
# sphinx-rtd-theme] since -U option will cause sphinx being updated to newest
7272
# version(1.7.1 for now), which causes building documentation failed.
73-
RUN pip install --upgrade pip==9.0.3 && \
73+
RUN easy_install -U pip && \
7474
pip install -U wheel && \
7575
pip install -U docopt PyYAML sphinx==1.5.6 && \
7676
pip install sphinx-rtd-theme==0.1.9 recommonmark

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ Please refer to our [release announcement](https://github.com/PaddlePaddle/Paddl
6262
## Installation
6363

6464
It is recommended to check out the
65-
[Docker installation guide](http://www.paddlepaddle.org/docs/develop/documentation/en/getstarted/build_and_install/docker_install_en.html)
65+
[Docker installation guide](http://www.paddlepaddle.org/docs/develop/documentation/fluid/en/build_and_install/docker_install_en.html)
6666
before looking into the
67-
[build from source guide](http://www.paddlepaddle.org/docs/develop/documentation/en/getstarted/build_and_install/build_from_source_en.html).
67+
[build from source guide](http://www.paddlepaddle.org/docs/develop/documentation/fluid/en/build_and_install/build_from_source_en.html).
6868

6969
## Documentation
7070

benchmark/cluster/vgg16/vgg16_fluid.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ def str2bool(v):
8080
type=str,
8181
default="",
8282
help="Comma-separated list of hostname:port pairs")
83+
parser.add_argument(
84+
"--profile", action='store_true', help="If set, profile a few steps.")
8385

8486
# Flags for defining the tf.train.Server
8587
parser.add_argument(
@@ -183,8 +185,8 @@ def train_loop(exe, trainer_prog):
183185
start_time = time.time()
184186
num_samples = 0
185187
train_pass_acc.reset()
186-
for batch_id, data in enumerate(train_reader()):
187-
ts = time.time()
188+
189+
def run_step(batch_id, data):
188190
img_data = np.array(
189191
map(lambda x: x[0].reshape(data_shape), data)).astype(
190192
"float32")
@@ -196,14 +198,28 @@ def train_loop(exe, trainer_prog):
196198
feed={"pixel": img_data,
197199
"label": y_data},
198200
fetch_list=[avg_cost, batch_acc, batch_size])
201+
return loss, acc, b_size
202+
203+
if args.profile and args.task_index == 0:
204+
# warmup.
205+
for batch_id, data in enumerate(train_reader()):
206+
if batch_id > 5: break
207+
run_step(batch_id, data)
208+
with profiler.profiler('All', 'total', '/tmp/profile_vgg'):
209+
for batch_id, data in enumerate(train_reader()):
210+
if batch_id > 5: break
211+
run_step(batch_id, data)
212+
213+
for batch_id, data in enumerate(train_reader()):
214+
ts = time.time()
215+
loss, acc, b_size = run_step(batch_id, data)
199216
iters += 1
200217
num_samples += len(data)
201218
train_pass_acc.add(value=acc, weight=b_size)
202219
print(
203-
"Task:%d Pass = %d, Iters = %d, Loss = %f, Accuracy = %f, "
204-
"Speed = %.2f img/s " % (args.task_index, pass_id, iters,
205-
loss, acc,
206-
len(data) / (time.time() - ts))
220+
"Pass = %d, Iters = %d, Loss = %f, Accuracy = %f, "
221+
"Speed = %.2f img/s" % (pass_id, iters, loss, acc,
222+
len(data) / (time.time() - ts))
207223
) # The accuracy is the accumulation of batches, but not the current batch.
208224

209225
pass_elapsed = time.time() - start_time

benchmark/fluid/mnist.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def run_benchmark(model, args):
159159
paddle.dataset.mnist.train(), batch_size=args.batch_size)
160160

161161
accuracy = fluid.metrics.Accuracy()
162+
train_exe = fluid.ParallelExecutor(use_cuda=True, loss_name=avg_cost.name)
162163
iters, num_samples, start_time = 0, 0, time.time()
163164
for pass_id in range(args.pass_num):
164165
accuracy.reset()
@@ -175,17 +176,20 @@ def run_benchmark(model, args):
175176
y_data = np.array(map(lambda x: x[1], data)).astype("int64")
176177
y_data = y_data.reshape([len(y_data), 1])
177178

178-
outs = exe.run(
179-
fluid.default_main_program(),
179+
outs = train_exe.run(
180180
feed={"pixel": img_data,
181181
"label": y_data},
182-
fetch_list=[avg_cost, batch_acc, batch_size_tensor]
182+
fetch_list=[
183+
avg_cost.name, batch_acc.name, batch_size_tensor.name
184+
]
183185
) # The accuracy is the accumulation of batches, but not the current batch.
184-
accuracy.update(value=outs[1], weight=outs[2])
186+
accuracy.update(
187+
value=np.array(np.mean(outs[1])),
188+
weight=np.mean(np.array(outs[2])))
185189
iters += 1
186190
num_samples += len(y_data)
187-
loss = np.array(outs[0])
188-
acc = np.array(outs[1])
191+
loss = np.mean(np.array(outs[0]))
192+
acc = np.mean(np.array(outs[1]))
189193
train_losses.append(loss)
190194
train_accs.append(acc)
191195
print("Pass: %d, Iter: %d, Loss: %f, Accuracy: %f" %

benchmark/fluid/resnet.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ def test(exe):
241241
exe = fluid.Executor(place)
242242
exe.run(fluid.default_startup_program())
243243
accuracy = fluid.average.WeightedAverage()
244+
train_exe = fluid.ParallelExecutor(use_cuda=True, loss_name=avg_cost.name)
244245
if args.use_fake_data:
245246
data = train_reader().next()
246247
image = np.array(map(lambda x: x[0].reshape(dshape), data)).astype(
@@ -264,14 +265,17 @@ def test(exe):
264265
data)).astype('float32')
265266
label = np.array(map(lambda x: x[1], data)).astype('int64')
266267
label = label.reshape([-1, 1])
267-
loss, acc, weight = exe.run(
268-
fluid.default_main_program(),
268+
loss, acc, weight = train_exe.run(
269269
feed={'data': image,
270270
'label': label},
271-
fetch_list=[avg_cost, batch_acc, batch_size_tensor])
271+
fetch_list=[
272+
avg_cost.name, batch_acc.name, batch_size_tensor.name
273+
])
272274
iters += 1
273275
num_samples += len(label)
274-
accuracy.add(value=acc, weight=weight)
276+
accuracy.add(value=np.array(np.mean(acc)), weight=np.mean(weight))
277+
loss = np.mean(np.array(loss))
278+
acc = np.mean(np.array(acc))
275279
train_losses.append(loss)
276280
train_accs.append(acc)
277281
print("Pass: %d, Iter: %d, Loss: %f, Accuracy: %f" %

benchmark/fluid/vgg.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def test(exe):
169169

170170
iters, num_samples, start_time = 0, 0, time.time()
171171
accuracy = fluid.average.WeightedAverage()
172+
train_exe = fluid.ParallelExecutor(use_cuda=True, loss_name=avg_cost.name)
172173
for pass_id in range(args.pass_num):
173174
accuracy.reset()
174175
train_accs = []
@@ -184,14 +185,17 @@ def test(exe):
184185
y_data = np.array(map(lambda x: x[1], data)).astype("int64")
185186
y_data = y_data.reshape([-1, 1])
186187

187-
loss, acc, weight = exe.run(
188-
fluid.default_main_program(),
188+
loss, acc, weight = train_exe.run(
189189
feed={"pixel": img_data,
190190
"label": y_data},
191-
fetch_list=[avg_cost, batch_acc, batch_size_tensor])
192-
accuracy.add(value=acc, weight=weight)
191+
fetch_list=[
192+
avg_cost.name, batch_acc.name, batch_size_tensor.name
193+
])
194+
accuracy.add(value=np.array(np.mean(acc)), weight=np.mean(weight))
193195
iters += 1
194196
num_samples += len(y_data)
197+
loss = np.mean(np.array(loss))
198+
acc = np.mean(np.array(acc))
195199
print(
196200
"Pass = %d, Iter = %d, Loss = %f, Accuracy = %f" %
197201
(pass_id, iters, loss, acc)

cmake/external/boost.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ set(BOOST_PROJECT "extern_boost")
2424
# So we use 1.41.0 here.
2525
set(BOOST_VER "1.41.0")
2626
set(BOOST_TAR "boost_1_41_0")
27-
set(BOOST_URL "http://paddlepaddledeps.bj.bcebos.com/${BOOST_TAR}.tar.gz")
27+
set(BOOST_URL "http://paddlepaddledeps.cdn.bcebos.com/${BOOST_TAR}.tar.gz")
2828
set(BOOST_SOURCES_DIR ${THIRD_PARTY_PATH}/boost)
2929
set(BOOST_DOWNLOAD_DIR "${BOOST_SOURCES_DIR}/src/${BOOST_PROJECT}")
3030
set(BOOST_INCLUDE_DIR "${BOOST_DOWNLOAD_DIR}/${BOOST_TAR}" CACHE PATH "boost include directory." FORCE)

cmake/external/eigen.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ else()
2121
ExternalProject_Add(
2222
extern_eigen3
2323
${EXTERNAL_PROJECT_LOG_ARGS}
24-
GIT_REPOSITORY "https://github.com/RLovelett/eigen.git"
24+
GIT_REPOSITORY "https://github.com/eigenteam/eigen-git-mirror"
2525
# eigen on cuda9.1 missing header of math_funtions.hpp
2626
# https://stackoverflow.com/questions/43113508/math-functions-hpp-not-found-when-using-cuda-with-eigen
2727
GIT_TAG 917060c364181f33a735dc023818d5a54f60e54c
2828
PREFIX ${EIGEN_SOURCE_DIR}
29+
DOWNLOAD_NAME "eigen"
2930
UPDATE_COMMAND ""
3031
CONFIGURE_COMMAND ""
3132
BUILD_COMMAND ""

0 commit comments

Comments
 (0)