+ | 参数 | +本地训练 | +集群训练 | +本地测试 | +集群测试 | +
---|---|---|---|---|---|
通用 | +job | +√ | √ | √ | √ | +
use_gpu | +√ | √ | √ | √ | +|
local | +√ | √ | √ | √ | +|
config | +√ | √ | √ | √ | +|
config_args | +√ | √ | √ | √ | +|
num_passes | +√ | √ | √ | √ | +|
trainer_count | +√ | √ | √ | √ | +|
version | +√ | √ | √ | √ | +|
show_layer_stat | +√ | √ | √ | √ | +|
训练 | dot_period | +√ | √ | + | |
test_period | +√ | √ | + | ||
saving_period | +√ | √ | + | ||
show_parameter_stats_period | +√ | √ | + | ||
init_model_path | +√ | √ | √ | + | |
load_missing_parameter_strategy | +√ | √ | + | ||
saving_period_by_batches | +√ | √ | + | ||
use_old_updater | +√ | √ | + | ||
enable_grad_share | +√ | √ | + | ||
grad_share_block_num | +√ | √ | + | ||
log_error_clipping | +√ | √ | + | ||
log_clipping | +√ | √ | + | ||
save_only_one | +√ | √ | + | ||
allow_inefficient_sparse_update | +√ | √ | + | ||
start_pass | +√ | √ | + | ||
训练/测试 | save_dir | +√ | √ | √ | √ | +
训练过程中测试 | test_period | +√ | √ | + | |
average_test_period | +√ | √ | + | ||
测试 | model_list | +√ | √ | +||
test_wait | +√ | √ | +|||
test_pass | +√ | √ | +|||
predict_output_dir | +√ | √ | +|||
distribute_test | +√ | √ | +|||
Auc/正负对验证(PnpairValidation) | predict_file | +√ | √ | +||
GPU | gpu_id | +√ | √ | √ | √ | +
parallel_nn | +√ | √ | √ | √ | +|
allow_only_one_model_on_one_gpu | +√ | √ | √ | √ | +|
cudnn_dir | +√ | √ | √ | √ | +|
cuda_dir | +√ | √ | √ | √ | +|
cudnn_conv_workspace_limit_in_mb | +√ | √ | √ | √ | +|
递归神经网络(RNN) | +beam_size | +√ | √ | +||
rnn_use_batch | +√ | √ | √ | √ | +|
prev_batch_state | +√ | √ | + | ||
diy_beam_search_prob_so | +√ | √ | +|||
度量学习(metric learning) | external | +√ | √ | √ | √ | +
data_server_port | +√ | √ | +|||
参数服务器(PServer) | start_pserver | +√ | √ | +||
pservers | +√ | √ | +|||
port | +√ | √ | +|||
port_num | +√ | √ | +|||
ports_num_for_sparse | +√ | √ | +|||
nics | +√ | √ | +|||
rdma_tcp | +√ | √ | +|||
small_messages | +√ | + | |||
loadsave_parameters_in_pserver | +√ | √ | +|||
log_period_server | +√ | + | |||
pserver_num_threads | +√ | + | |||
sock_send_buf_size | +√ | + | |||
sock_recv_buf_size | +√ | + | |||
num_gradient_servers | +√ | + | |||
parameter_block_size | +√ | + | |||
parameter_block_size_for_sparse | +√ | + | |||
异步随机梯度下降(Async SGD) | async_count | +√ | + | ||
async_lagged_ratio_min | +√ | + | |||
async_lagged_ratio_default | +√ | + | |||
性能调优(Performance Tuning) | log_barrier_abstract | +√ | + | ||
log_barrier_lowest_nodes | +√ | + | |||
log_barrier_show_log | +√ | + | |||
check_sparse_distribution_batches | +√ | + | |||
check_sparse_distribution_ratio | +√ | + | |||
check_sparse_distribution_unbalance_degree | +√ | + | |||
check_sparse_distribution_in_pserver | +√ | + | |||
show_check_sparse_distribution_log | +√ | + | |||
数据提供器(Data Provider) | memory_threshold_on_load_data | +√ | √ | + | |
随机数 | seed | +√ | √ | + | |
thread_local_rand_use_global_seed | +√ | √ | + | ||
单元测试 | checkgrad_eps | ++ | |||
矩阵/向量 | enable_parallel_vector | +√ | √ | √ | √ | +
-
-
Figure 1. GAN-Model-Structure figure credit @@ -111,9 +109,7 @@ $python gan_trainer.py -d uniform --useGpu 1 ``` The generated samples can be found in ./uniform_samples/ and one example is shown below as Figure 2. One can see that it roughly recovers the 2D uniform distribution. -
-
-
Figure 2. Uniform Sample
@@ -135,9 +131,7 @@ To train the GAN model on mnist data, one can use the following command: $python gan_trainer.py -d mnist --useGpu 1 ``` The generated sample images can be found at ./mnist_samples/ and one example is shown below as Figure 3. -
-
-
Figure 3. MNIST Sample
diff --git a/doc/tutorials/gan/uniform_sample.png b/doc/tutorials/gan/uniform_sample.png index 4a96c45cae82673f5a1df986f2643a8026da7937..e716c48e782019a757bed0cb443f2ed97386cbe2 100644 Binary files a/doc/tutorials/gan/uniform_sample.png and b/doc/tutorials/gan/uniform_sample.png differ diff --git a/doc/tutorials/index_cn.md b/doc/tutorials/index_cn.md index 97014d537655d21871295699381c5dd2106d0b56..6a27004d58d24cc466d930322be8cdbb2f434c74 100644 --- a/doc/tutorials/index_cn.md +++ b/doc/tutorials/index_cn.md @@ -2,6 +2,7 @@ * [快速入门](quick_start/index_cn.rst) * [个性化推荐](rec/ml_regression_cn.rst) +* [图像分类](image_classification/index_cn.md) * [情感分析](sentiment_analysis/index_cn.md) * [语义角色标注](semantic_role_labeling/index_cn.md) * [机器翻译](text_generation/index_cn.md) @@ -9,3 +10,4 @@ ## 常用模型 * [ResNet模型](imagenet_model/resnet_model_cn.md) +* [词向量模型](embedding_model/index_cn.md) diff --git a/doc/tutorials/index_en.md b/doc/tutorials/index_en.md index cce9d3a176a5e5c87e97c16362ec8a202e8eb80a..77331a703b6f0fdf92921ebcc476325b7327e976 100644 --- a/doc/tutorials/index_en.md +++ b/doc/tutorials/index_en.md @@ -7,6 +7,7 @@ There are several examples and demos here. * [Sentiment Analysis](sentiment_analysis/index_en.md) * [Semantic Role Labeling](semantic_role_labeling/index_en.md) * [Text Generation](text_generation/index_en.md) +* [Image Auto-Generation](gan/index_en.md) ## Model Zoo * [ImageNet: ResNet](imagenet_model/resnet_model_en.md) diff --git a/paddle/CMakeLists.txt b/paddle/CMakeLists.txt index 2daea052b01adc87f42e15cdcfec92301b7edae9..503024cff338dac42a6a8a32463472dc6b6451d9 100644 --- a/paddle/CMakeLists.txt +++ b/paddle/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(cuda) add_subdirectory(function) add_subdirectory(utils) +add_subdirectory(testing) add_subdirectory(math) add_subdirectory(parameter) add_subdirectory(gserver) diff --git a/paddle/api/Paddle.swig b/paddle/api/Paddle.swig index 3365927f9b59936244230bed439808fa7ead2c61..068ba286c07d8854a1a7c7042224a679b50b4957 100644 --- a/paddle/api/Paddle.swig +++ b/paddle/api/Paddle.swig @@ -178,6 +178,7 @@ namespace std { %newobject ParameterOptimizer::create; %newobject ParameterOptimizer::needSpecialTraversal; %newobject ParameterUpdater::createLocalUpdater; +%newobject ParameterUpdater::createRemoteUpdater; %feature("director") UpdateCallback; %feature("autodoc", 1); // To generate method stub, for code hint in ide diff --git a/paddle/api/PaddleAPI.h b/paddle/api/PaddleAPI.h index 09c891871a5ca8571216d211203fe8643fc3a63f..81c9eed0bccd5ad63f524cdb011fc73cd568f465 100644 --- a/paddle/api/PaddleAPI.h +++ b/paddle/api/PaddleAPI.h @@ -803,6 +803,8 @@ private: public: static ParameterUpdater* createLocalUpdater(OptimizationConfig* config); + static ParameterUpdater* createRemoteUpdater(OptimizationConfig* config, + int passCount); ~ParameterUpdater(); /** diff --git a/paddle/api/ParameterUpdater.cpp b/paddle/api/ParameterUpdater.cpp index 7cd8ed7e3907489a60f37090df6f51492def2612..75b0ae7cb6cc8c9ad0f8fe69963b7439a44bf55e 100644 --- a/paddle/api/ParameterUpdater.cpp +++ b/paddle/api/ParameterUpdater.cpp @@ -15,15 +15,25 @@ limitations under the License. */ #include "PaddleAPI.h" #include "PaddleAPIPrivate.h" +#include "paddle/trainer/RemoteParameterUpdater.h" #include "paddle/trainer/ThreadParameterUpdater.h" ParameterUpdater::ParameterUpdater() : m(new ParameterUpdaterPrivate()) {} ParameterUpdater *ParameterUpdater::createLocalUpdater( OptimizationConfig *config) { - auto param = new ParameterUpdater(); - param->m->updater.reset(new paddle::SgdThreadUpdater(config->m->getConfig())); - return param; + auto updater = new ParameterUpdater(); + updater->m->updater.reset( + new paddle::SgdThreadUpdater(config->m->getConfig())); + return updater; +} + +ParameterUpdater *ParameterUpdater::createRemoteUpdater( + OptimizationConfig *config, int passCount) { + auto updater = new ParameterUpdater(); + updater->m->updater.reset(new paddle::RemoteParameterUpdater( + config->m->getConfig(), passCount, nullptr)); + return updater; } ParameterUpdater::~ParameterUpdater() { delete m; } diff --git a/paddle/cuda/include/hl_sequence.h b/paddle/cuda/include/hl_sequence.h index 9bcd25b0623e569052e08c0befc8e09f937fa4bd..9f9d8f972e3a4c62e5caedcf85054be5681b96c1 100644 --- a/paddle/cuda/include/hl_sequence.h +++ b/paddle/cuda/include/hl_sequence.h @@ -48,78 +48,6 @@ extern void hl_max_sequence_forward(real* input, extern void hl_max_sequence_backward( real* outputGrad, int* index, real* inputGrad, int numSequences, int dim); -/** - * @brief Context projection forward. - * - * @param[in] input input sequence. - * @param[in] sequence sequence index. - * @param[in] weightData padding data. - * @param[out] output output sequence. - * @param[in] numSequences number of sequences. - * @param[in] inputDim input sequence dimension. - * @param[in] contextLength context length. - * @param[in] contextStart context start. - * @param[in] beginPad number of extra timesteps added at the - * beginning. - * @param[in] isPadding trainable padding. - * - */ -extern void hl_context_projection_forward(real* input, - const int* sequence, - real* weightData, - real* output, - int numSequences, - int inputDim, - int contextLength, - int contextStart, - int beginPad, - bool isPadding); - -/** - * @brief Context projection backward data. - * - * @param[in] outputGrad output gradient. - * @param[in] sequence sequence index. - * @param[out] inputGrad input gradient. - * @param[in] numSequences number of sequences. - * @param[in] inputDim input sequence dimension. - * @param[in] contextLength context length. - * @param[in] contextStart context start. - * - */ -extern void hl_context_projection_backward_data(real* outputGrad, - const int* sequence, - real* inputGrad, - int numSequences, - int inputDim, - int contextLength, - int contextStart); - -/** - * @brief Context projection backward weight. - * - * @param[in] outputGrad output gradient. - * @param[in] sequence sequence index. - * @param[out] weightGrad weight gradient. - * @param[in] numSequences number of sequences. - * @param[in] weightDim input sequence dimension. - * @param[in] totalPad number of extra timesteps. - * @param[in] contextLength context length. - * @param[in] contextStart context start. - * @param[in] beginPad number of extra timesteps added at the - * beginning. - * - */ -extern void hl_context_projection_backward_weight(real* outputGrad, - const int* sequence, - real* weightGrad, - int numSequences, - int weightDim, - int totalPad, - int contextLength, - int contextStart, - int beginPad); - /** * @brief Memory copy from sequence to batch. * diff --git a/paddle/cuda/include/stub/hl_sequence_stub.h b/paddle/cuda/include/stub/hl_sequence_stub.h index d6b07556f8958a62bd47f0b47b75bbebafeb58d3..05e51bce9e1df6fc6ef1cad891b44a9172da185d 100644 --- a/paddle/cuda/include/stub/hl_sequence_stub.h +++ b/paddle/cuda/include/stub/hl_sequence_stub.h @@ -27,35 +27,6 @@ inline void hl_max_sequence_forward(real* input, inline void hl_max_sequence_backward( real* outputGrad, int* index, real* inputGrad, int numSequences, int dim) {} -inline void hl_context_projection_forward(real* input, - const int* sequence, - real* weightData, - real* output, - int numSequences, - int inputDim, - int contextLength, - int contextStart, - int beginPad, - bool isPadding) {} - -inline void hl_context_projection_backward_data(real* outputGrad, - const int* sequence, - real* inputGrad, - int numSequences, - int inputDim, - int contextLength, - int contextStart) {} - -inline void hl_context_projection_backward_weight(real* outputGrad, - const int* sequence, - real* weightGrad, - int numSequences, - int weightDim, - int totalPad, - int contextLength, - int contextStart, - int beginPad) {} - inline void hl_sequence2batch_copy(real* batch, real* sequence, const int* batchIndex, diff --git a/paddle/cuda/src/hl_cuda_sequence.cu b/paddle/cuda/src/hl_cuda_sequence.cu index 4e33ac443c1f78b7fa50a15784875cbadfcf7497..ba823de2720336851bf9c49d8162360af93e8601 100644 --- a/paddle/cuda/src/hl_cuda_sequence.cu +++ b/paddle/cuda/src/hl_cuda_sequence.cu @@ -90,258 +90,6 @@ void hl_max_sequence_backward(real* outputGrad, CHECK_SYNC("hl_max_sequence_backward failed"); } -template