Reputation: 97
I am trying to create a Bert model for classifying Turkish Lan. here is my code:
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
)
I am using Anaconda and Spyder. I think every thing is correct but when I run this I got the following error:
'use_cuda' set to True when cuda is unavailable. Make sure CUDA is available or set use_cuda=False.
how can I fix this exactly?
Upvotes: 2
Views: 11418
Reputation: 21
model = ClassificationModel(
"bert", "dbmdz/bert-base-turkish-cased",
num_labels=4,
args=train_args,
use_cuda=False
)
Adding use_cuda=False
will help if GPU is not available
Upvotes: 1
Reputation: 1
If your GPU is unavailable on your computer. Make sure to check CUDA or try use_cuda=False
in args of your model. This error will be throw since CUDA does not exist on your computer.
Upvotes: -1
Reputation: 65
CUDA is a parallel computing platform and programming model developed by Nvidia for general computing on its own GPUs.
If your computer does not have GPU, this error will be thrown to you. Don't forget to include this parameter
use_cuda= False
This will not affect your result, just take a few more seconds than usual to process.
Upvotes: 0
Reputation: 76
I ran into the same problem. If you have CUDA available, then set both use_cuda
and fp16
to True
. If not, then set both to False
.
Upvotes: 0