transformer下按照readme执行train.py报错
按照步骤download demo数据。
但是执行训练 时报错。
python -u train.py (后面省略,就是示例命令)
...
Traceback (most recent call last):
File "train.py", line 775, in
求解答,谢谢了。
layers里面,根本就没有py_reader这个方法!
import paddle.fluid.layers as layers
dir(layers) ['BlockGuard', 'BlockGuardServ', 'BlockGuardWithCompletion', 'ConditionalBlock', 'DynamicRNN', 'IfElse', 'ListenAndServ', 'ParallelDo', 'Preprocessor', 'Print', 'Recv', 'Send', 'StaticRNN', 'Switch', 'While', 'WhileGuard', 'all', 'builtins', 'doc', 'file', 'name', 'package', 'path', 'abs', 'accuracy', 'append_LARS', 'argmax', 'argmin', 'array_length', 'array_read', 'array_to_lod_tensor', 'array_write', 'assign', 'auc', 'autoincreased_step_counter', 'batch', 'batch_norm', 'beam_search', 'beam_search_decode', 'bipartite_match', 'box_coder', 'brelu', 'cast', 'ceil', 'chunk_eval', 'clip', 'clip_by_norm', 'concat', 'control_flow', 'conv2d', 'conv2d_transpose', 'conv3d', 'conv3d_transpose', 'cos', 'cos_sim', 'create_array', 'create_global_var', 'create_parameter', 'create_tensor', 'crf_decoding', 'crop', 'cross_entropy', 'ctc_greedy_decoder', 'cumsum', 'data', 'detection', 'detection_map', 'detection_output', 'device', 'dice_loss', 'double_buffer', 'dropout', 'dynamic_gru', 'dynamic_lstm', 'dynamic_lstmp', 'edit_distance', 'elementwise_add', 'elementwise_div', 'elementwise_max', 'elementwise_min', 'elementwise_mul', 'elementwise_pow', 'elementwise_sub', 'elu', 'embedding', 'equal', 'exp', 'exponential_decay', 'fc', 'fill_constant', 'fill_constant_batch_size_like', 'floor', 'gather', 'gaussian_random', 'gaussian_random_batch_size_like', 'get_places', 'gru_unit', 'hard_shrink', 'hard_sigmoid', 'im2sequence', 'image_resize', 'image_resize_short', 'increment', 'inverse_time_decay', 'io', 'iou_similarity', 'is_empty', 'l2_normalize', 'label_smooth', 'layer_function_generator', 'layer_norm', 'leaky_relu', 'learning_rate_scheduler', 'less_than', 'linear_chain_crf', 'load', 'lod_rank_table', 'lod_reset', 'lod_tensor_to_array', 'log', 'logical_and', 'logical_not', 'logical_or', 'logical_xor', 'logsigmoid', 'lrn', 'lstm_unit', 'math_op_patch', 'matmul', 'max_sequence_len', 'maxout', 'mean', 'mean_iou', 'merge_lod_tensor', 'metric_op', 'monkey_patch_variable', 'mul', 'multi_box_head', 'multiplex', 'natural_exp_decay', 'nce', 'nn', 'noam_decay', 'one_hot', 'ones', 'open_files', 'open_recordio_file', 'ops', 'pad', 'piecewise_decay', 'polygon_box_transform', 'polynomial_decay', 'pool2d', 'pool3d', 'pow', 'prior_box', 'random_crop', 'random_data_generator', 'read_file', 'reciprocal', 'reduce_max', 'reduce_mean', 'reduce_min', 'reduce_prod', 'reduce_sum', 'relu', 'relu6', 'reorder_lod_tensor_by_rank', 'reshape', 'resize_bilinear', 'reverse', 'roi_pool', 'round', 'row_conv', 'scale', 'scatter', 'sequence_conv', 'sequence_expand', 'sequence_first_step', 'sequence_last_step', 'sequence_pool', 'sequence_reshape', 'sequence_softmax', 'shape', 'shrink_memory', 'shuffle', 'sigmoid', 'sigmoid_cross_entropy_with_logits', 'sin', 'slice', 'smooth_l1', 'soft_relu', 'softmax', 'softmax_with_cross_entropy', 'softplus', 'softshrink', 'softsign', 'split', 'split_lod_tensor', 'sqrt', 'square', 'square_error_cost', 'ssd_loss', 'stanh', 'sum', 'sums', 'swish', 'tanh', 'tanh_shrink', 'target_assign', 'tensor', 'thresholded_relu', 'topk', 'transpose', 'uniform_random', 'uniform_random_batch_size_like', 'utils', 'warpctc', 'zeros']
应该是使用了很早之前版本的paddle导致的,请先更新一下paddle。pip install paddlepaddle --upgrade 或者pip install paddlepaddle-gpu --upgrade