PaddlePaddle / PaddleSlim

PaddleSlim is an open-source library for deep model compression and architecture search.
https://paddleslim.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.56k stars 345 forks source link

[Bug]TypeError: 'float' object is not iterable #1856

Closed lizexu123 closed 8 months ago

lizexu123 commented 9 months ago

软件环境

- paddlepaddle:2.6.0
- paddlepaddle-gpu: 2.6.0
- paddlenlp: 2.7.2
- paddleslim:2.6.0

重复问题

错误描述

Traceback (most recent call last):
  File "run.py", line 384, in <module>
    main()
  File "run.py", line 377, in main
    ac.compress()
  File "/root/.conda/envs/lzx/lib/python3.8/site-packages/paddleslim/auto_compression/compressor.py", line 586, in compress
    self.single_strategy_compress(strategy, config, strategy_idx,
  File "/root/.conda/envs/lzx/lib/python3.8/site-packages/paddleslim/auto_compression/compressor.py", line 753, in single_strategy_compress
    metric = self.eval_function(self._exe, inference_program,
  File "run.py", line 278, in eval_function
    res = metric.accumulate()
  File "/root/.conda/envs/lzx/lib/python3.8/site-packages/paddlenlp/metrics/glue.py", line 371, in accumulate
    preds = [item for sublist in self.preds for item in sublist]
  File "/root/.conda/envs/lzx/lib/python3.8/site-packages/paddlenlp/metrics/glue.py", line 371, in <listcomp>
    preds = [item for sublist in self.preds for item in sublist]
TypeError: 'float' object is not iterable

稳定复现步骤 & 代码

https://github.com/PaddlePaddle/PaddleSlim/tree/develop/example/auto_compression/pytorch_huggingface 在使用PaddleSlim,进行自动压缩时,python run.py --config_path=./config/stsb.yaml --save_dir='./output/stsb' stsb.yaml,改成了 image 只有这个,失败了

lizexu123 commented 8 months ago

已解决