修改paddle bert报错NameError: global name 'epoch' is not defined
Created by: littlepan0413
如题
W0811 18:55:44.980177 2901 device_context.cc:259] Please NOTE: device: 0, CUDA Capability: 35, Driver API Version: 9.0, Runtime API Version: 8.0 W0811 18:55:44.989336 2901 device_context.cc:267] device: 0, cuDNN Version: 6.0. W0811 18:55:44.989390 2901 device_context.cc:293] WARNING: device: 0. The installed Paddle is compiled with CUDNN 7.1, but CUDNN version in your machine is 6.0, which may cause serious incompatible bug. Please recompile or reinstall Paddle with compatible CUDNN version. Load pretraining parameters from models/base/uncased_L-12_H-768_A-12/params. WARNING:root: You can try our memory optimize feature to save your memory usage: # create a build_strategy variable to set memory optimize option build_strategy = compiler.BuildStrategy() build_strategy.enable_inplace = True build_strategy.memory_optimize = True
# pass the build_strategy to with_data_parallel API
compiled_prog = compiler.CompiledProgram(main).with_data_parallel(
loss_name=loss.name, build_strategy=build_strategy)
!!! Memory optimize is our experimental feature !!!
some variables may be removed/reused internal to save memory usage,
in order to fetch the right value of the fetch_list, please set the
persistable property to true for each variable in fetch_list
# Sample
conv1 = fluid.layers.conv2d(data, 4, 5, 1, act=None)
# if you need to fetch conv1, then:
conv1.persistable = True
I0811 18:55:46.771148 2901 parallel_executor.cc:329] The number of CUDAPlace, which is used in ParallelExecutor, is 1. And the Program will be copied 1 copies I0811 18:55:46.947717 2901 build_strategy.cc:340] SeqOnlyAllReduceOps:0, num_trainers:1 Exception in thread Thread-1: Traceback (most recent call last): File "/home/work/anaconda2/envs/paddle_gpu/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/home/work/anaconda2/envs/paddle_gpu/lib/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "/home/work/anaconda2/envs/paddle_gpu/lib/python2.7/site-packages/paddle/fluid/layers/io.py", line 593, in provider_thread raise ex NameError: global name 'epoch' is not defined
Traceback (most recent call last): File "hae.py", line 295, in main() File "hae.py", line 272, in main total_cost.extend(np_loss * np_num_seqs) TypeError: unsupported operand type(s) for *: 'NoneType' and 'long'