pytorch split dataset

How does pytorch divide the data set, instead of reading the corresponding train and test files. For example, divide data.csv into train and test data sets.

I used data.split in torchtext to divide the data set, and the following error is displayed at train_data, val_data = dataset.split ():

payloads = pd.read_excel('data/payloads.xlsx')
print('加载数据中...')
text = data.Field(sequential=True, lower=True, tokenize=get3gram)
label = data.Field(sequential=False)

fields=[('index', None), ('payload', text), ('is_malicious', label), ('injection_type', None)]
dataset = data.Dataset(es_420,fields)
train_data, val_data = dataset.split()

KeyError Traceback (most recent call last)
D:\anaconda\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
2645 try:
-> 2646 return self._engine.get_loc(key)
2647 except KeyError:

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 1914