训练报错,需要查错
Created by: AIpioneer
在AiStudio上,我运行了“百度架构师手把手教深度学,https://aistudio.baidu.com/aistudio/education/group/info/888作业2: 用Paddle完成房价预测案例”的实例,我自己输入代码报错后,我把原始代码一个一个code block的运行了一遍,依然报错。请问这是什么原因?盼回复。
相关链接和报错代码如下:
我的作业的链接地址如下: https://aistudio.baidu.com/bdcpu2/user/63435/437638/notebooks/437638.ipynb?redirects=1
报错信息如下: ---------------------------------------------------------------------------EnforceNotMet Traceback (most recent call last) in 15 16 #前向计算 ---> 17 predicts = model(house_features) 18 19 #计算损失 /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py in call(self, *inputs, **kwargs) 176 parallel_helper.broadcast_parameters(self.parameters.values()) 177 --> 178 outputs = self.forward(*inputs, **kwargs) 179 self.built = True 180 return outputs in forward(self, inputs) 7 8 def forward(self, inputs): ----> 9 x = self.fc(inputs) 10 return x /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py in call(self, *inputs, **kwargs) 172 def call(self, *inputs, **kwargs): 173 if not self.built: --> 174 self.build_once(*inputs, kwargs) 175 if parallel_helper._is_data_parallel_mode(): 176 parallel_helper._broadcast_parameters(self._parameters.values()) /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/nn.py in _build_once(self, input) 1056 size = list([self._size]) 1057 self.b = self.create_parameter( -> 1058 attr=self.bias_attr, shape=size, dtype=self.dtype, is_bias=True) 1059 1060 # TODO(songyouwei): We should remove w property /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py in create_parameter(self, attr, shape, dtype, is_bias, default_initializer) 99 attr = ".".join([self.full_name, attr]) 100 return self.helper.create_parameter(attr, shape, dtype, is_bias, --> 101 default_initializer) 102 103 # TODO: Add more parameter list when we need them /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layer_helper_base.py in create_parameter(self, attr, shape, dtype, is_bias, default_initializer, stop_gradient) 323 shape=shape, 324 stop_gradient=stop_gradient, --> 325 **attr.to_kwargs(with_initializer=True)) 326 else: 327 self.startup_program.global_block().create_parameter( /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/framework.py in create_parameter(self, args, kwargs) 2375 pass 2376 else: -> 2377 initializer(param, self) 2378 param.stop_gradient = False 2379 return param /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/initializer.py in call(self, var, block) 187 'force_cpu': self._force_cpu or force_init_on_cpu() 188 }, --> 189 stop_gradient=True) 190 191 if var.dtype == VarDesc.VarType.FP16: /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/framework.py in _prepend_op(self, args, kwargs) 2484 kwargs.get("outputs", {}), attrs 2485 if attrs else {}, -> 2486 kwargs.get("stop_gradient", False)) 2487 else: 2488 op_desc = self.desc._prepend_op() /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/tracer.py in trace_op(self, type, inputs, outputs, attrs, stop_gradient) 45 self.trace(type, inputs, outputs, attrs, 46 framework._current_expected_place(), self._train_mode and ---> 47 not stop_gradient) 48 49 def train_mode(self): EnforceNotMet: 0 std::string paddle::platform::GetTraceBackString<std::string const&>(std::string const&, char const, int) 1 paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const, int) 2 paddle::platform::DeviceContextPool::Instance() 3 paddle::operators::FillConstantKernel::Compute(paddle::framework::ExecutionContext const&) const 4 std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CPUPlace, false, 0ul, paddle::operators::FillConstantKernel, paddle::operators::FillConstantKernel, paddle::operators::FillConstantKernel, paddle::operators::FillConstantKernel, paddle::operators::FillConstantKernel, paddle::operators::FillConstantKernelpaddle::platform::float16 >::operator()(char const, char const, int) const::{lambda(paddle::framework::ExecutionContext const&)#1 (closed)}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&) 5 paddle::imperative::PreparedOp::Run() 6 paddle::imperative::OpBase::Run(std::map<std::string, std::vector<std::shared_ptrpaddle::imperative::VarBase, std::allocator<std::shared_ptrpaddle::imperative::VarBase > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::shared_ptrpaddle::imperative::VarBase, std::allocator<std::shared_ptrpaddle::imperative::VarBase > > > > > const&, std::map<std::string, std::vector<std::shared_ptrpaddle::imperative::VarBase, std::allocator<std::shared_ptrpaddle::imperative::VarBase > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::shared_ptrpaddle::imperative::VarBase, std::allocator<std::shared_ptrpaddle::imperative::VarBase > > > > > const&) 7 paddle::imperative::Tracer::TraceOp(std::string const&, std::map<std::string, std::vector<std::shared_ptrpaddle::imperative::VarBase, std::allocator<std::shared_ptrpaddle::imperative::VarBase > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::shared_ptrpaddle::imperative::VarBase, std::allocator<std::shared_ptrpaddle::imperative::VarBase > > > > > const&, std::map<std::string, std::vector<std::shared_ptrpaddle::imperative::VarBase, std::allocator<std::shared_ptrpaddle::imperative::VarBase > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::shared_ptrpaddle::imperative::VarBase, std::allocator<std::shared_ptrpaddle::imperative::VarBase > > > > > const&, std::unordered_map<std::string, boost::variant<boost::blank, int, float, std::string, std::vector<int, std::allocator >, std::vector<float, std::allocator >, std::vector<std::string, std::allocatorstd::string >, bool, std::vector<bool, std::allocator >, paddle::framework::BlockDesc, long, std::vector<paddle::framework::BlockDesc, std::allocatorpaddle::framework::BlockDesc* >, std::vector<long, std::allocator >, boost::detail::variant::void, boost::detail::variant::void, boost::detail::variant::void, boost::detail::variant::void, boost::detail::variant::void, boost::detail::variant::void, boost::detail::variant::void>, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, boost::variant<boost::blank, int, float, std::string, std::vector<int, std::allocator >, std::vector<float, std::allocator >, std::vector<std::string, std::allocatorstd::string >, bool, std::vector<bool, std::allocator >, paddle::framework::BlockDesc, long, std::vector<paddle::framework::BlockDesc, std::allocatorpaddle::framework::BlockDesc* >, std::vector<long, std::allocator >, boost::detail::variant::void, boost::detail::variant::void, boost::detail::variant::void, boost::detail::variant::void, boost::detail::variant::void, boost::detail::variant::void_, boost::detail::variant::void_> > > >, boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&, bool) PaddleCheckError: pool should not be null Need to Create DeviceContextPool first! at [/paddle/paddle/fluid/platform/device_context.h:322]