csv.field_size_limit(sys.maxsize) OverflowError: Python int too large to convert to C long

在运行torchtext.data.TabularDataset()时报错:csv.field_size_limit(sys.maxsize) OverflowError: Python int too large to convert to C long

在你电脑的某位置下的python3.X\Lib\site-packages\torchtext\utils.py脚本里将

maxInt = sys.maxsize
    while True:
        # decrease the maxInt value by factor 10
        # as long as the OverflowError occurs.
        try:
            csv.field_size_limit(maxInt)
            break
        except OverflowError:
            maxInt = int(maxInt / 10)

    csv.field_size_limit(sys.maxsize)
   

里面的csv.field_size_limit(sys.maxsize)注释掉,添加csv.field_size_limit(maxInt)即可

你可能感兴趣的:(torchtext,python,csv)