wanted to try CUDA (I have an RTX 3070 TI) on my Windows setup, using this code:
import pandas as pd
from simpletransformers.classification import ClassificationModel
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
# Read data from JSON
df = pd.read_json(r"C:\Users\NLP and Computer Vision\Coding\News_Category_Dataset_v3.json", orient="records", lines=True)
print(df[df["headline"].isna() | df["short_description"].isna()])
print(df.head())
data = pd.DataFrame()
data["text"] = df.headline + " " + df.short_description
data["labels"] = df.category
labels = list(data["labels"].unique())
# Convert labels to numerical values
le = preprocessing.LabelEncoder()
le.fit(labels)
data["labels"] = le.transform(data["labels"])
train_df, eval_df = train_test_split(data, test_size=0.2)
# Create a classification model
model = ClassificationModel('bert', 'bert-base-uncased', num_labels=len(labels), use_cuda=False)
# Train the model
model.train_model(train_df)
# Evaluate the model
result, model_outputs, predictions = model.eval_model(eval_df)
It is running when I set use_cuda=False, when I enable it with True it's not working.
I installed the NVIDIA CUDA toolkit for Windows and on Anaconda. What am I doing wrong?
I don't know what went wrong with the environment, but that was the issue.
I solved it using this env setup as yaml file: