Skip to content

Commit 245b1f0

Browse files
authored
Merge pull request #15570 from luotao1/bert
fix compiler error, use len20 dataset for bert
2 parents 075df09 + 5504425 commit 245b1f0

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

paddle/fluid/inference/tests/api/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ inference_analysis_api_test_with_fake_data(test_analyzer_resnet50
128128
inference_analysis_api_test_with_fake_data(test_analyzer_mobilenet_depthwise_conv
129129
"${INFERENCE_DEMO_INSTALL_DIR}/mobilenet_depthwise_conv" analyzer_resnet50_tester.cc "mobilenet_model.tar.gz" SERIAL)
130130

131-
# bert
132-
set(BERT_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/bert")
133-
download_model_and_data(${BERT_INSTALL_DIR} "bert_model.tar.gz" "bert_data.txt.tar.gz")
134-
inference_analysis_api_test(test_analyzer_bert ${BERT_INSTALL_DIR} analyzer_bert_tester.cc)
131+
# bert, max_len=20
132+
set(BERT_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/bert20")
133+
download_model_and_data(${BERT_INSTALL_DIR} "bert_model.tar.gz" "bert_data_len20.txt.tar.gz")
134+
inference_analysis_api_test(test_analyzer_bert ${BERT_INSTALL_DIR} analyzer_bert_tester.cc SERIAL)
135135

136136
# anakin
137137
if (WITH_ANAKIN AND WITH_MKL) # only needed in CI

paddle/fluid/inference/tests/api/analyzer_bert_tester.cc

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ namespace paddle {
1818
namespace inference {
1919

2020
using paddle::PaddleTensor;
21-
using paddle::contrib::AnalysisConfig;
2221

2322
template <typename T>
2423
void GetValueFromStream(std::stringstream *ss, T *t) {
@@ -158,12 +157,10 @@ bool LoadInputData(std::vector<std::vector<paddle::PaddleTensor>> *inputs) {
158157
return true;
159158
}
160159

161-
void SetConfig(contrib::AnalysisConfig *config) {
162-
config->SetModel(FLAGS_infer_model);
163-
}
160+
void SetConfig(AnalysisConfig *config) { config->SetModel(FLAGS_infer_model); }
164161

165162
void profile(bool use_mkldnn = false) {
166-
contrib::AnalysisConfig config;
163+
AnalysisConfig config;
167164
SetConfig(&config);
168165

169166
if (use_mkldnn) {
@@ -213,17 +210,14 @@ TEST(Analyzer_bert, compare_mkldnn) { compare(true /* use_mkldnn */); }
213210
#endif
214211

215212
// Compare Deterministic result
216-
// TODO(luotao): Since each unit-test on CI only have 10 minutes, cancel this to
217-
// decrease the CI time.
218-
// TEST(Analyzer_bert, compare_determine) {
219-
// AnalysisConfig cfg;
220-
// SetConfig(&cfg);
221-
//
222-
// std::vector<std::vector<PaddleTensor>> inputs;
223-
// LoadInputData(&inputs);
224-
// CompareDeterministic(reinterpret_cast<const PaddlePredictor::Config
225-
// *>(&cfg),
226-
// inputs);
227-
// }
213+
TEST(Analyzer_bert, compare_determine) {
214+
AnalysisConfig cfg;
215+
SetConfig(&cfg);
216+
217+
std::vector<std::vector<PaddleTensor>> inputs;
218+
LoadInputData(&inputs);
219+
CompareDeterministic(reinterpret_cast<const PaddlePredictor::Config *>(&cfg),
220+
inputs);
221+
}
228222
} // namespace inference
229223
} // namespace paddle

paddle/fluid/inference/tests/api/analyzer_rnn1_tester.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ namespace paddle {
2020
namespace inference {
2121

2222
using namespace framework; // NOLINT
23-
using namespace contrib; // NOLINT
2423

2524
struct DataRecord {
2625
std::vector<std::vector<std::vector<float>>> link_step_data_all;

0 commit comments

Comments
 (0)