PaddlePaddle / PaddleSeg

Easy-to-use image segmentation library with awesome pre-trained model zoo, supporting wide-range of practical tasks in Semantic Segmentation, Interactive Segmentation, Panoptic Segmentation, Image Matting, 3D Segmentation, etc.
https://arxiv.org/abs/2101.06175
Apache License 2.0
8.72k stars 1.68k forks source link

模型导出失败 #882

Closed llO-Oll closed 1 year ago

llO-Oll commented 3 years ago

Traceback (most recent call last): File "export.py", line 85, in main(args) File "export.py", line 64, in main out = net(in_var) File "/home/whut/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 891, in call outputs = self.forward(*inputs, **kwargs) File "/home/whut/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 352, in call error_data.raise_new_exception() File "/home/whut/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/error.py", line 189, in raise_newexception six.exec("raise new_exception from None") File "", line 1, in IndexError: In transformed code:

File "/home/whut/PaddleSeg-develop/paddleseg/models/ocrnet.py", line 73, in forward (* user code *)
logit_list = self.head(feats)
File "/home/whut/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 891, in __call__
outputs = self.forward(*inputs, **kwargs)
File "/home/whut/PaddleSeg-develop/paddleseg/models/ocrnet.py", line 130, in forward (* user code *)
object_regions = self.spatial_gather(pixels, soft_regions)
File "/home/whut/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 891, in __call__
outputs = self.forward(*inputs, **kwargs)
File "/tmp/tmpabhcobul.py", line 17, in forward
False) * paddle.jit.dy2static.convert_var_shape(pixels, 3,
File "/home/whut/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 288, in convert_var_shape
if isinstance(x, Variable) and (in_control_flow or has_negetive(x.shape,
File "/home/whut/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 272, in has_negetive
return list_shape[idx] < 0
IndexError: tuple index out of range
nepeplwu commented 3 years ago

@llO-Oll 麻烦将paddle版本升级到2.0.1试试

MansGod commented 3 years ago

File "/home/ljd/Code/PaddleSeg/paddleseg/models/fast_scnn.py", line 75, in forward ( user code ) x = self.global_feature_extractor(higher_res_features) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 902, in call outputs = self.forward(*inputs, *kwargs) File "/home/ljd/Code/PaddleSeg/paddleseg/models/fast_scnn.py", line 189, in forward ( user code *) x = self.ppm(x) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_call_func.py", line 220, in convert_call forward_func = convert_to_static(forward_func) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 141, in convert_to_static static_func = _FUNCTION_CACHE.convert_with_cache(function) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 78, in convert_with_cache static_func = self._convert(func) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 116, in _convert root_wrapper = self._dygraph_to_static.get_static_ast(root) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/ast_transformer.py", line 61, in get_static_ast self.transfer_from_node_type(self.static_analysis_root) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/ast_transformer.py", line 92, in transfer_from_node_type self._apply(transformer, node_wrapper, log_level=index + 1) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/ast_transformer.py", line 65, in _apply transformer(node_wrapper).transform() File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/loop_transformer.py", line 435, in transform self.visit(self.root) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/loop_transformer.py", line 438, in visit self.generic_visit(node) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/ast.py", line 447, in generic_visit value = self.visit(value) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/loop_transformer.py", line 441, in visit self.replace_stmt_list(node.body) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/loop_transformer.py", line 457, in replace_stmt_list new_stmts = self.get_for_stmt_nodes(body_list[i]) File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/loop_transformer.py", line 479, in get_for_stmt_nodes stmts_tuple = current_for_node_parser.parse() File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/utils.py", line 1030, in parse return self._parse_for_stmts() File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/utils.py", line 1094, in _parse_for_stmts target_node, assign_node = self._build_assign_var_slice_node() File "/home/ljd/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/utils.py", line 1245, in _build_assign_var_slice_node slice=gast.Index(value=gast.Name( AttributeError: module 'gast' has no attribute 'Index'

您好 paddle==2.0.1,gast==0.4.0,模型导出的时候还是报了这个错,请问怎么解决呢

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.