Skip to content

Commit e9166ed

Browse files
authored
Merge pull request #1615 from luotao1/ml
remove with_metric_learning compile option
2 parents 95b4e39 + 6492666 commit e9166ed

File tree

13 files changed

+3
-83
lines changed

13 files changed

+3
-83
lines changed

cmake/util.cmake

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,10 @@ function(link_paddle_exe TARGET_NAME)
7171
generate_rdma_links()
7272
endif()
7373

74-
if(WITH_METRIC)
75-
if(WITH_GPU)
76-
set(METRIC_LIBS paddle_metric_learning paddle_dserver_lib metric metric_cpu)
77-
else()
78-
set(METRIC_LIBS paddle_metric_learning paddle_dserver_lib metric_cpu)
79-
endif()
80-
else()
81-
set(METRIC_LIBS "")
82-
endif()
83-
8474
target_circle_link_libraries(${TARGET_NAME}
8575
ARCHIVE_START
8676
paddle_gserver
8777
paddle_function
88-
${METRIC_LIBS}
8978
ARCHIVE_END
9079
paddle_pserver
9180
paddle_trainer_lib
@@ -95,7 +84,6 @@ function(link_paddle_exe TARGET_NAME)
9584
paddle_parameter
9685
paddle_proto
9786
paddle_cuda
98-
${METRIC_LIBS}
9987
${EXTERNAL_LIBS}
10088
${CMAKE_THREAD_LIBS_INIT}
10189
${CMAKE_DL_LIBS}

doc/howto/usage/cmd_parameter/arguments_cn.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,6 @@
228228
<td class="left"></td><td class="left"></td><td class="left">√</td><td class="left">√</td>
229229
</tr>
230230

231-
<tr>
232-
<td class="left" rowspan = "2">度量学习(metric learning)</td><td class="left">external</td>
233-
<td class="left">√</td><td class="left">√</td><td class="left">√</td><td class="left">√</td>
234-
</tr>
235-
236-
<tr>
237-
<td class="left">data_server_port</td>
238-
<td class="left"></td><td class="left">√</td><td class="left"></td><td class="left">√</td>
239-
</tr>
240-
241231
<tr>
242232
<td class="left" rowspan = "16">参数服务器(PServer)</td><td class="left">start_pserver</td>
243233
<td class="left"></td><td class="left">√</td><td class="left"></td><td class="left">√</td>

doc/howto/usage/cmd_parameter/arguments_en.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,6 @@ It looks like there are a lot of arguments. However, most of them are for develo
228228
<td class="left"></td><td class="left"></td><td class="left">√</td><td class="left">√</td>
229229
</tr>
230230

231-
<tr>
232-
<td class="left" rowspan = "2">metric learning</td><td class="left">external</td>
233-
<td class="left">√</td><td class="left">√</td><td class="left">√</td><td class="left">√</td>
234-
</tr>
235-
236-
<tr>
237-
<td class="left">data_server_port</td>
238-
<td class="left"></td><td class="left">√</td><td class="left"></td><td class="left">√</td>
239-
</tr>
240-
241231
<tr>
242232
<td class="left" rowspan = "16">PServer</td><td class="left">start_pserver</td>
243233
<td class="left"></td><td class="left">√</td><td class="left"></td><td class="left">√</td>

doc/howto/usage/cmd_parameter/detail_introduction_cn.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,6 @@
180180
 - 用户可以自定义beam search的方法,编译成动态库,供PaddlePaddle加载。 该参数用于指定动态库路径.
181181
- 类型: string (默认: "", null).
182182

183-
## 度量学习(Metric Learning)
184-
* `--external`
185-
- 指示是否使用外部机器进行度量学习.
186-
- 类型: bool (默认: 0).
187-
188-
* `--data_server_port`
189-
- 数据服务器(data server)的监听端口,主要用在度量学习中.
190-
- 类型: int32 (默认: 21134).
191-
192183
## 数据支持(DataProvider)
193184

194185
* `--memory_threshold_on_load_data`

doc/howto/usage/cmd_parameter/detail_introduction_en.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,6 @@
184184
- Specify shared dynamic library. It can be defined out of paddle by user.
185185
- type: string (default: "", null).
186186

187-
## Metric Learning
188-
* `--external`
189-
- Whether to use external machine for metric learning.
190-
- type: bool (default: 0).
191-
192-
* `--data_server_port`
193-
- Listening port for dserver (data server), dserver is mainly used in metric learning.
194-
- type: int32 (default: 21134).
195-
196187
## DataProvider
197188

198189
* `--memory_threshold_on_load_data`

paddle/gserver/gradientmachines/MultiGradientMachine.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ limitations under the License. */
2424
DEFINE_bool(allow_only_one_model_on_one_gpu,
2525
true,
2626
"If true, do not allow multiple models on one GPU device");
27-
#ifdef PADDLE_METRIC_LEARNING
28-
DECLARE_bool(external);
29-
#endif
3027

3128
namespace paddle {
3229

@@ -45,11 +42,7 @@ MultiGradientMachine::MultiGradientMachine(const ModelConfig& config,
4542
trainerBarrier_(FLAGS_trainer_count),
4643
allBarrier_(FLAGS_trainer_count + 1),
4744
inArgsCopied_(false) {
48-
#ifdef PADDLE_METRIC_LEARNING
49-
isPassGrad_ = FLAGS_external;
50-
#else
5145
isPassGrad_ = false;
52-
#endif
5346
numThreads_ = FLAGS_trainer_count;
5447
if (useGpu) {
5548
//! TODO(yuyang18): When useGpu=false && paddle is not compiled with gpu,

paddle/gserver/layers/Layer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ void Layer::backwardActivation() {
381381
void Layer::forwardDropOut() {
382382
auto& outV = getOutputValue();
383383

384-
if (passType_ == PASS_TRAIN || passType_ == PASS_METRIC_TRAIN ||
385-
passType_ == PASS_METRIC_TRAIN_WITH_NOERROR) {
384+
if (passType_ == PASS_TRAIN) {
386385
// new dropOutMask_ if dropOutMask_ is null ptr
387386
Matrix::resizeOrCreate(dropOutMask_,
388387
outV->getHeight(),

paddle/pserver/BaseClient.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ namespace paddle {
3030
* the first solution arms with sendThreads_/recvThreads_ and sendJobQueue_/
3131
* recvJobQueue_. the second solution use some shared thread pool to manage
3232
* connections.
33-
* In addition to pserver, metric learning also uses network to exchange
34-
* features within multi-machines, so this class just abstracts some basic
35-
* threads and queue buffer creation for them
3633
*/
3734
class BaseClient {
3835
protected:

paddle/pserver/ParameterServer2.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,8 @@ void ParameterServer2::addGradient(const SendParameterRequest& request,
367367
std::vector<Buffer>* outputBuffers) {
368368
VLOG(1) << "pserver: addGradient";
369369

370-
/// forwardbackward delta from all trainers
371-
/// indicate the fluctuation caused by forwardbackward.
372-
#ifndef PADDLE_METRIC_LEARNING
373-
// @TODO(yanfei):
374-
// add support tuning forwardbackward balance for metric learning
370+
// forwardbackward delta from all trainers
371+
// indicate the fluctuation caused by forwardbackward.
375372
if (!numPassFinishClients_) {
376373
REGISTER_BARRIER_DELTA_SERVER_SET(
377374
*statSet_,
@@ -381,7 +378,6 @@ void ParameterServer2::addGradient(const SendParameterRequest& request,
381378
request.forwardbackward_time(),
382379
isSparseServer_ ? "_sparseUpdater" : "_denseUpdater");
383380
}
384-
#endif
385381

386382
{
387383
/// approximately pure network overhead

paddle/trainer/Trainer.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ limitations under the License. */
3030
#include "TrainerConfigHelper.h"
3131
#include "TrainerInternal.h"
3232

33-
#ifdef PADDLE_METRIC_LEARNING
34-
#include "paddle/internals/metric_learning/MetricTrainer.h"
35-
#endif
36-
3733
DECLARE_int32(num_passes);
3834

3935
namespace paddle {
@@ -201,12 +197,8 @@ class Trainer {
201197
// parameter util
202198
std::unique_ptr<ParameterUtil> paramUtil_;
203199

204-
#ifdef PADDLE_METRIC_LEARNING
205-
MetricTrainer trainerInternal_;
206-
#else
207200
// trainer Internal
208201
TrainerInternal trainerInternal_;
209-
#endif
210202
};
211203

212204
} // namespace paddle

0 commit comments

Comments
 (0)