我正在尝试创建一个用于对土耳其语进行分类的 Bert 模型。这是我的代码:
import pandas as pd
import torch
df = pd.read_excel (r'preparedDataNoId.xlsx')
df = df.sample(frac = 1)
from sklearn.model_selection import train_test_split
train_df, test_df = train_test_split(df, test_size=0.10)
print('train shape: ',train_df.shape)
print('test shape: ',test_df.shape)
from simpletransformers.classification import ClassificationModel
# define hyperparameter
train_args ={"reprocess_input_data": True,
"fp16":False,
"num_train_epochs": 4}
# Create a ClassificationModel
model = ClassificationModel(
"bert", "dbmdz/bert-base-turkish-cased",
num_labels=4,
args=train_args
)
我正在使用 Anaconda 和 Spyder。我认为每件事都是正确的,但是当我运行它时,出现以下错误:
'use_cuda' set to True when cuda is unavailable. Make sure CUDA is available or set use_cuda=False.
我该如何解决这个问题?