如题,使用paddle.jit.save保存模型的时候出错了
D:\Python\Python37\python.exe D:/BackgroundMattingV2-paddle-main/predict.py
W0323 16:49:16.129994 12012 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 11.4, Runtime API Version: 11.1
W0323 16:49:16.145615 12012 device_context.cc:465] device: 0, cuDNN Version: 8.1.
D:\Python\Python37\lib\site-packages\paddle\fluid\layers\utils.py:77: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
return (isinstance(seq, collections.Sequence) and
D:\Python\Python37\lib\site-packages\paddle\nn\layer\norm.py:653: UserWarning: When training, we now always track global mean and variance.
"When training, we now always track global mean and variance.")
Traceback (most recent call last):
File "D:/BackgroundMattingV2-paddle-main/predict.py", line 58, in
predict()
File "D:/BackgroundMattingV2-paddle-main/predict.py", line 41, in predict
paddle.jit.save(model, "./model/weights", input_spec=[InputSpec.from_tensor(src_data), InputSpec.from_tensor(src_data)])
File "D:\Python\Python37\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args, **kwargs)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\base.py", line 51, in __impl__
return func(*args, **kwargs)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\jit.py", line 744, in save
inner_input_spec)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 517, in concrete_program_specify_input_spec
*desired_input_spec)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 427, in get_concrete_program
concrete_program, partial_program_layer = self._program_cache[cache_key]
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 723, in __getitem__
self._caches[item] = self._build_once(item)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 714, in _build_once
**cache_key.kwargs)
File "D:\Python\Python37\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args, **kwargs)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\base.py", line 51, in __impl__
return func(*args, **kwargs)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 668, in from_func_spec
error_data.raise_new_exception()
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\error.py", line 336, in raise_new_exception
six.exec_("raise new_exception from None")
File "", line 1, in
TypeError: In transformed code:
File "D:\BackgroundMattingV2-paddle-main\model\model.py", line 175, in forward
x, *shortcuts = self.backbone(x)
File "D:\BackgroundMattingV2-paddle-main\model\decoder.py", line 53, in forward
x = self.conv1(x)
x = self.bn1(x)
x = self.relu(x)
~~~~~~~~~~~~~~~~ <--- HERE
x = F.interpolate(x, size=x2.shape[2:], mode='bilinear', align_corners=False)
x = paddle.concat([x, x2], axis=1)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in __call__
return self._dygraph_call_func(*inputs, **kwargs)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\Python\Python37\lib\site-packages\paddle\nn\layer\activation.py", line 430, in forward
return F.relu(x, self._name)
File "D:\Python\Python37\lib\site-packages\paddle\nn\functional\activation.py", line 524, in relu
out = helper.create_variable_for_type_inference(x.dtype)
File "D:\Python\Python37\lib\site-packages\paddle\fluid\layer_helper_base.py", line 405, in create_variable_for_type_inference
[self.name, 'tmp'])),
TypeError: sequence item 0: expected str instance, bool found
Process finished with exit code 1
代码如下