OpenICL icon indicating copy to clipboard operation
OpenICL copied to clipboard

TypeError: 'ListWrapper' object is not iterable

Open Shinning-Zhou opened this issue 1 year ago • 3 comments

I met:

  File "/mnt/sharedata/hdd/zhouxn/ICLCP/group_distance_k.py", line 33, in group_with_distance
    retriever = TopkRetriever(data, ice_num=3, batch_size=args.batch_size, index_split='train', test_split='test')
  File "/mnt/sharedata/hdd/zhouxn/ICLCP/openicl/icl_retriever/icl_topk_retriever.py", line 78, in __init__
    self.index = self.create_index()
  File "/mnt/sharedata/hdd/zhouxn/ICLCP/openicl/icl_retriever/icl_topk_retriever.py", line 86, in create_index
    res_list = self.forward(dataloader, process_bar=True, information="Creating index for index set...")
  File "/mnt/sharedata/hdd/zhouxn/ICLCP/openicl/icl_retriever/icl_topk_retriever.py", line 114, in forward
    res_list.extend([{"embed": r, "metadata": m} for r, m in zip(res, metadata)])
TypeError: 'ListWrapper' object is not iterable

I wonder what will cause this error?

Shinning-Zhou avatar Dec 18 '24 14:12 Shinning-Zhou

I have the same problem, could you please share your solution?

maxuetao avatar Jan 06 '25 10:01 maxuetao

I have the same problem, could you please share your solution?

bort64 avatar Apr 02 '25 02:04 bort64

I have the same problem, could you please share your solution?

Hi, I found that this problem might be caused by the version of environment. In the end, my solution was to run the relevant ICL method in the 'opencompass' project. Opencompass integrates Open-ICL and is continuously maintained, which makes it possible to avoid program environment problems.

maxuetao avatar Apr 02 '25 02:04 maxuetao