# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. workspace: "models/contentunderstanding/textcnn_pretrain" dataset: - name: dataset_train batch_size: 128 type: DataLoader data_path: "{workspace}/senta_data/train" data_converter: "{workspace}/reader.py" - name: dataset_infer batch_size: 256 type: DataLoader data_path: "{workspace}/senta_data/test" data_converter: "{workspace}/reader.py" hyper_parameters: optimizer: class: adam learning_rate: 0.001 strategy: async mode: [train_runner,infer_runner] runner: - name: train_runner class: train epochs: 6 device: cpu save_checkpoint_interval: 1 save_checkpoint_path: "increment" init_model_path: "" print_interval: 10 # startup class for finetuning startup_class_path: "{workspace}/finetune_startup.py" # path of pretrained model. Please set empty if you don't use finetune function. init_pretraining_model_path: "{workspace}/pretrain_model/pretrain_model_params" phases: phase_train - name: infer_runner class: infer # device to run training or infer device: cpu print_interval: 1 init_model_path: "increment/3" # load model path phases: phase_infer phase: - name: phase_train model: "{workspace}/model.py" dataset_name: dataset_train thread_num: 1 - name: phase_infer model: "{workspace}/model.py" # user-defined model dataset_name: dataset_infer # select dataset by name thread_num: 1