Bert-Chinese-Text-Classification-Pytorch
Bert-Chinese-Text-Classification-Pytorch copied to clipboard
你好 我想问你一下 换成自己的数据集 为什么总会出现 ValueError: too many values to unpack (expected 2) 想问一下怎么解决
我也是这样,看了下代码好像是因为每条数据都要定长成pad_size,用\t来增补。但是我也不知道怎么解决,请问您解决了吗?
因为你的数据集有空行,你可以将以下代码的路径换成你的数据集,报错就知道在哪是空行了 with open(r"D:\weibo\Bert-Chinese-Text-Classification-Pytorch-master\THUCNews\data\train.txt", 'r', encoding='UTF-8') as f: for line in tqdm(f): lin = line.strip() if not lin: continue content, label = lin.split('\t') print(content)